> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dohoo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# YouTube Posting API: Videos and Thumbnails | Dohoo

> Use the Dohoo YouTube posting API to upload videos, set metadata, choose privacy, and attach custom thumbnails.

The YouTube API endpoints let you upload videos to a connected YouTube channel and optionally set a custom thumbnail after publishing. Use the publish endpoint to send a video live with a title, description, and privacy status, then call the thumbnail endpoint with the returned video ID to attach a custom thumbnail image. Both endpoints authenticate via your Dohoo API key.

<Note>
  Dohoo uses YouTube API Services. By connecting your YouTube channel, you agree to the [YouTube Terms of Service](https://www.youtube.com/t/terms).
</Note>

***

## Publish a video

Upload a video to your connected YouTube channel.

### Endpoint

```
POST https://dohoo.ai/api/v2/youtube/publish
```

### Request headers

| Header         | Required | Description                |
| -------------- | -------- | -------------------------- |
| `X-API-Key`    | ✅        | Your Dohoo API key         |
| `Content-Type` | ✅        | Must be `application/json` |

### Request body

| Field           | Type   | Required | Description                                                                  |
| --------------- | ------ | -------- | ---------------------------------------------------------------------------- |
| `connectionId`  | string | ✅        | The ID of the YouTube connection to publish from                             |
| `fileId`        | string | ✅        | The ID of the uploaded video file                                            |
| `title`         | string | ✅        | Title of the YouTube video. Maximum 100 characters                           |
| `description`   | string | ❌        | Description for the video. Maximum 5,000 characters                          |
| `privacyStatus` | string | ❌        | Visibility: `"public"`, `"unlisted"`, or `"private"`. Defaults to `"public"` |

### Example request

```bash theme={null}
curl -X POST https://dohoo.ai/api/v2/youtube/publish \
  -H "X-API-Key: dh_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "connectionId": "conn_youtube_001",
    "fileId": "abc123",
    "title": "My Video Title",
    "description": "Video description",
    "privacyStatus": "public"
  }'
```

### Example response

```json theme={null}
{
  "success": true,
  "platform": "youtube",
  "videoId": "dQw4w9WgXcQ",
  "connectionId": "conn_youtube_001",
  "status": "published",
  "privacyStatus": "public",
  "publishedAt": "2025-01-15T09:00:00Z",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
```

<Tip>
  Set `privacyStatus` to `"unlisted"` while testing so your video is accessible via direct link but won't appear in search results or on your channel page.
</Tip>

***

## Set a custom thumbnail

Attach a custom thumbnail image to a previously published YouTube video.

### Endpoint

```
POST https://dohoo.ai/api/v2/youtube/thumbnail/:videoId
```

Replace `:videoId` in the URL with the `videoId` returned from the publish endpoint above.

### Request headers

| Header         | Required | Description                |
| -------------- | -------- | -------------------------- |
| `X-API-Key`    | ✅        | Your Dohoo API key         |
| `Content-Type` | ✅        | Must be `application/json` |

### Request body

| Field             | Type   | Required | Description                                 |
| ----------------- | ------ | -------- | ------------------------------------------- |
| `thumbnailFileId` | string | ✅        | The ID of the uploaded thumbnail image file |

### Example request

```bash theme={null}
curl -X POST https://dohoo.ai/api/v2/youtube/thumbnail/VIDEO_ID \
  -H "X-API-Key: dh_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "thumbnailFileId": "thumb456" }'
```

### Example response

```json theme={null}
{
  "success": true,
  "videoId": "dQw4w9WgXcQ",
  "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
  "status": "thumbnail_set",
  "updatedAt": "2025-01-15T09:05:00Z"
}
```

<Warning>
  Custom thumbnails are only available on YouTube channels that are **verified**. If your channel is unverified, the thumbnail endpoint will return an error and YouTube will auto-generate a thumbnail instead.
</Warning>

<Note>
  YouTube recommends thumbnail images at **1280×720 pixels** (16:9 aspect ratio), under 2 MB, in JPG, GIF, or PNG format.
</Note>
