# Translate Document — Eden AI

> Translates a document from a local file or URL. See the documentation

- Key: `eden_ai-translate-document`
- Type: Action (Write)
- Version: 1.0.3
- App: Eden AI (`eden_ai`) — https://pipedream.com/apps/eden-ai.md
- This page (HTML): https://pipedream.com/apps/eden-ai/actions/translate-document
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/eden_ai/actions/translate-document/translate-document.mjs

## Description

Translates a document from a local file or URL. [See the documentation](https://docs.edenai.co/reference/translation_document_translation_create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `providers` | `string[]` | Yes | One or more providers that the data will be redirected to in order to get the processed results. See the documentation for available providers. |
| `fallbackProviders` | `string[]` | No | Providers to be used as fallback if the call to the first provider fails. To use this, you must input only one provider in the Providers prop, and you can input up to 5 fallbacks. They will be tried in the same order they are input, and it will stop on the first provider who doesn't fail. |
| `showOriginalResponse` | `boolean` | No | If set, the response will include the original response of the provider. |
| `sourceLanguage` | `string` | No | This should be a language code (e.g. en, fr) |
| `targetLanguage` | `string` | Yes | This should be a language code (e.g. en, fr) |
| `file` | `string` | Yes | Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/example.pdf) |
| `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": "eden_ai",
      },
    },
  },
)

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: "eden_ai-translate-document",
  arguments: {
    providers: ["Providers"],
    fallbackProviders: ["Fallback Providers"],
  },
})
```

**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: "eden_ai-translate-document",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    eden_ai: { authProvisionId: "apn_xxxxxxx" },
    providers: ["Providers"],
    fallbackProviders: ["Fallback Providers"],
  },
})

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": "eden_ai-translate-document",
    "configured_props": {
      "eden_ai": { "authProvisionId": "apn_xxxxxxx" },
      "providers": ["Providers"],
      "fallbackProviders": ["Fallback Providers"]
    }
  }'
```

---

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