# Upload Thumbnail — YouTube Data

> Uploads a custom video thumbnail to YouTube and sets it for a video. Note: Account must be verified. See the documentation for more information

- Key: `youtube_data_api-upload-thumbnail`
- Type: Action (Read-only)
- Version: 1.0.4
- App: YouTube Data (`youtube_data_api`) — https://pipedream.com/apps/youtube-data-api.md
- This page (HTML): https://pipedream.com/apps/youtube-data-api/actions/upload-thumbnail
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/youtube_data_api/actions/upload-thumbnail/upload-thumbnail.mjs

## Description

Uploads a custom video thumbnail to YouTube and sets it for a video. Note: Account must be [verified](https://www.youtube.com/verify). [See the documentation](https://developers.google.com/youtube/v3/docs/thumbnails/set) for more information

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `videoId` | `string` | Yes | Select the video to update. E.g. wslno0wDSFQ Options are loaded from the connected account. |
| `filePath` | `string` | Yes | Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.pdf). |
| `onBehalfOfContentOwner` | `string` | No | This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners. The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner. |
| `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": "youtube_data_api",
      },
    },
  },
)

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: "youtube_data_api-upload-thumbnail",
  arguments: {
    videoId: "Video ID",
    filePath: "File Path or URL",
  },
})
```

**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: "youtube_data_api-upload-thumbnail",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    youtube_data_api: { authProvisionId: "apn_xxxxxxx" },
    videoId: "Video ID",
    filePath: "File Path or URL",
  },
})

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": "youtube_data_api-upload-thumbnail",
    "configured_props": {
      "youtube_data_api": { "authProvisionId": "apn_xxxxxxx" },
      "videoId": "Video ID",
      "filePath": "File Path or URL"
    }
  }'
```

---

- App: https://pipedream.com/apps/youtube-data-api.md · All apps: https://pipedream.com/apps
