# Submit Image to Alttextify — AltTextify

> Upload or submit an image to Alttextify for alt text generation. See the documentation

- Key: `alttextify-submit-image`
- Type: Action (Write)
- Version: 0.0.5
- App: AltTextify (`alttextify`) — https://pipedream.com/apps/alttextify.md
- This page (HTML): https://pipedream.com/apps/alttextify/actions/submit-image
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/alttextify/actions/submit-image/submit-image.mjs

## Description

Upload or submit an image to Alttextify for alt text generation. [See the documentation](https://apidoc.alttextify.net/#api-Image-UploadRawImage)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `async` | `boolean` | Yes | Whether to add the image in the background or immediately (synchronously). If async is set to true, the API response will always be successful with an empty response body. |
| `image` | `string` | Yes | The URL of the file or path to the file saved to the /tmp directory. See the documentation on working with files |
| `lang` | `string` | Yes | The language for the alt text. Supported language codes are accepted. If not provided, the account's default language is used. |
| `maxChars` | `integer` | Yes | Maximum length of the generated alt text. |
| `assetId` | `string` | No | The unique identifier for the asset. |
| `keywords` | `string[]` | No | List of keywords/phrases for SEO-optimized alt text. Only one or two will be used per alt text, but all are considered. Keywords must be in English, even for alt text in other languages. |
| `ecommerceRunOCR` | `boolean` | Yes | Flag to indicate if OCR should be run on the product. |
| `ecommerceProductName` | `string` | No | The name of the product in the image. |
| `ecommerceProductBrand` | `string` | No | The brand of the product in the image. |
| `ecommerceProductColor` | `string` | No | The color of the product in the image. |
| `ecommerceProductSize` | `string` | No | The size of the product in the image. |
| `syncDir` | `dir` | No | SyncDir |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "alttextify",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "alttextify-submit-image",
  arguments: {
    async: true,
    image: "Image",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "alttextify-submit-image",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    alttextify: { authProvisionId: "apn_xxxxxxx" },
    async: true,
    image: "Image",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "alttextify-submit-image",
    "configured_props": {
      "alttextify": { "authProvisionId": "apn_xxxxxxx" },
      "async": true,
      "image": "Image"
    }
  }'
```

---

- App: https://pipedream.com/apps/alttextify.md · All apps: https://pipedream.com/apps
