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

# YouTube Community Posts API

> Fetches a channel's community tab posts including text, attachment type, like and comment counts and post date, in English. Reads up to about 450 recent posts per channel.

`POST /v1/data/youtube/community-posts/run`

**Pricing:** $0.002 per post ($2.00 per 1,000).

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**channels** `string[]` *required*

One or more YouTube channel IDs to fetch community posts for.

**maxResults** `integer` (default: 50)

How many posts to return in total across all channels, shared evenly between them. Defaults to 50; use 0 for all. Each channel is read up to 50 pages (about 450 most recent posts), so very active channels may return fewer posts than their full history.

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/youtube/community-posts/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "channels": [
      "UCBJycsmduvYEL83R_U4JriQ",
      "UCX6OQ3DkcsbYNE6H8uQQuVA",
      "UCXuqSBlHAE6Xw-yeJA0Tunw"
    ]
  }
}'
```

```python Python theme={null}
import os, requests

r = requests.post(
    "https://api.mindcase.co/v1/data/youtube/community-posts/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "channels": [
        "UCBJycsmduvYEL83R_U4JriQ",
        "UCX6OQ3DkcsbYNE6H8uQQuVA",
        "UCXuqSBlHAE6Xw-yeJA0Tunw"
    ]
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/youtube/community-posts/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "channels": [
    "UCBJycsmduvYEL83R_U4JriQ",
    "UCX6OQ3DkcsbYNE6H8uQQuVA",
    "UCXuqSBlHAE6Xw-yeJA0Tunw"
  ]
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one post, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `postId` | Post ID | text |
| `postUrl` | Post URL | url |
| `channelId` | Channel ID | text |
| `channelName` | Channel Name | text |
| `text` | Text | text |
| `published` | Published | date |
| `publishedAsShown` | Published (As Shown) | text |
| `likes` | Likes | integer |
| `comments` | Comments | integer |
| `attachmentType` | Attachment Type | text |
| `inputChannel` | Input Channel | text |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "youtube/community-posts",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "published": "2024-11-08",
      "inputChannel": "UCBJycsmduvYEL83R_U4JriQ",
      "attachmentType": "image",
      "postUrl": "https://www.youtube.com/post/UgkxX6gkDxQ0KRucvyG7NLui0LhjHp0CLlfZ",
      "text": "Alright, it's that time: https://vote.mkbhd.com\n\nWelcome to the Blind Smartphone Camera Test 2023! 20 smartphones. 3 categories. Scientific winners revealed ...",
      "channelName": "Marques Brownlee",
      "likes": 12000,
      "comments": 1000,
      "publishedAsShown": "2 years ago (edited)",
      "postId": "UgkxX6gkDxQ0KRucvyG7NLui0LhjHp0CLlfZ",
      "channelId": "UCBJycsmduvYEL83R_U4JriQ"
    }
  ]
}
```

## Related APIs

For videos use [`youtube/videos`](https://docs.mindcase.co/apis/youtube/videos); for channel stats use [`youtube/channels`](https://docs.mindcase.co/apis/youtube/channels).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.