# Upload Media — Sonix

> Submits new media for processing. See the documentation

- Key: `sonix-upload-media`
- Type: Action (Write)
- Version: 1.0.4
- App: Sonix (`sonix`) — https://pipedream.com/apps/sonix.md
- This page (HTML): https://pipedream.com/apps/sonix/actions/upload-media
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/sonix/actions/upload-media/upload-media.mjs

## Description

Submits new media for processing. [See the documentation](https://sonix.ai/docs/api#new_media)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `file` | `string` | Yes | The audio or video file to upload (max 100MB). Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.txt) |
| `language` | `string` | Yes | Language code for the transcription. |
| `folderId` | `string` | No | ID of folder to place the media in Options are loaded from the connected account. |
| `name` | `string` | No | Name of the file in Sonix. If no name is provided, we will default to the filename. |
| `transcriptText` | `boolean` | No | Existing transcript - if present, will align the transcript rather than transcribing. |
| `keywords` | `string[]` | No | Comma separated list of words or phrases to use as hints to the transcription engine. If this is provided, then the account level keywords will not be used. |
| `customData` | `object` | No | Set of key-value pairs that you can attach to the media. This can be useful for storing additional information about file. |
| `callbackUrl` | `string` | No | URL for Sonix to make a POST request notifying of a change in transcript status (either failed or completed). The POST will include the media status JSON. |
| `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": "sonix",
      },
    },
  },
)

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: "sonix-upload-media",
  arguments: {
    file: "File Path or URL",
    language: "Language",
  },
})
```

**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: "sonix-upload-media",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    sonix: { authProvisionId: "apn_xxxxxxx" },
    file: "File Path or URL",
    language: "Language",
  },
})

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": "sonix-upload-media",
    "configured_props": {
      "sonix": { "authProvisionId": "apn_xxxxxxx" },
      "file": "File Path or URL",
      "language": "Language"
    }
  }'
```

---

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