Quick reference
| Property | Value |
|---|---|
| Platform value | youtube |
| One connected account | One YouTube channel. |
| Text limit | 5,000 characters |
| Supported | MP4 video up to 20 MB |
| Features | Posting ✓ · Analytics ✓ · Inbox ✓ |
| Provider approval | OAuth verification; channel authorization and applicable quota/compliance review |
| Token | Access token plus refresh token (renewed automatically) |
Before you start
The person connecting needs:
- A Google account that owns or manages a YouTube channel.
- While your Google app is unverified: added as a test user on the OAuth consent screen.
You (the platform owner) need:
- In console.cloud.google.com create (or reuse) a project and a Web application OAuth client; copy its Client ID and Client secret.
- Enable the YouTube Data API v3.
- Authorized redirect URI: https://YOUR_DOMAIN/auth/callback/youtube
- On the OAuth consent screen, add your Google account as a test user while the app is unverified.
Permissions (scopes)
Techrace puts these permissions in the login link. The person approves them on the provider's own screen; only approved permissions are granted.
| Permission | Requested by default | Used for |
|---|---|---|
https://www.googleapis.com/auth/youtube.upload | Yes | Upload videos |
https://www.googleapis.com/auth/youtube.readonly | Yes | Read the channel and its videos |
https://www.googleapis.com/auth/yt-analytics.readonly | Optional | Channel analytics |
https://www.googleapis.com/auth/yt-analytics-monetary.readonly | Optional | Revenue analytics |
https://www.googleapis.com/auth/youtube.force-ssl | Optional | Read, reply to and moderate comments |
Connect an account
/api/v1/projects/{project_id}/connect-sessionsconnections:writeCreate a connect link with provider "youtube" and send the person's browser to the returned url. return_url is the page in your app where they land afterwards (https, or http://localhost while testing).
curl -X POST "https://YOUR_DOMAIN/api/v1/projects/$TECHRACE_PROJECT_ID/connect-sessions" \
-H "Authorization: Bearer $TECHRACE_API_KEY" \
-H "Content-Type: application/json" \
--data @- <<EOF
{
"customer_id": "$CUSTOMER_ID",
"provider": "youtube",
"return_url": "https://your-app.com/integrations/done"
}
EOFAfter approval the person lands on your return_url with ?connected=youtube&customer_id=…&connection_id=…, or ?error=access_denied|expired|failed&provider=youtube. Your webhook also receives account.connected. Keep the connection_id: every call below uses it.
Publish a post
/api/v1/projects/{project_id}/executionsexecutions:writeUpload an MP4 video (up to 20 MB) with a title and description.
curl -X POST "https://YOUR_DOMAIN/api/v1/projects/$TECHRACE_PROJECT_ID/executions" \
-H "Authorization: Bearer $TECHRACE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: unique-key-per-post" \
--data @- <<EOF
{
"customer_id": "$CUSTOMER_ID",
"connection_id": "$CONNECTION_ID",
"action": "publish",
"input": {
"title": "Our bakery tour",
"content": "A look inside our kitchen.",
"media_ids": [
"$VIDEO_MEDIA_ID"
]
}
}
EOF- Publishing is asynchronous: the response has status queued. Poll GET /executions/{id} or subscribe to execution.succeeded / execution.failed.
- Upload images or video first with POST /customers/{customer_id}/media and pass the returned media IDs in media_ids.
- Re-sending the same Idempotency-Key never posts twice.
- title up to 160 characters; description (content) up to 5,000 characters.
Analytics
/api/v1/projects/{project_id}/analytics/queryanalytics:read| report | What it returns |
|---|---|
daily | Daily channel metrics |
summary | Totals for the period |
videos | Per-video metrics |
countries | Metrics by country |
traffic_sources | Where views come from |
traffic_source_details | Detail for one traffic_source |
devices | By device type |
operating_systems | By operating system |
demographics | Viewer age and gender |
retention | Audience retention for one video |
sharing_services | Where videos are shared |
curl -X POST "https://YOUR_DOMAIN/api/v1/projects/$TECHRACE_PROJECT_ID/analytics/query" \
-H "Authorization: Bearer $TECHRACE_API_KEY" \
-H "Content-Type: application/json" \
--data @- <<EOF
{
"customer_id": "$CUSTOMER_ID",
"connection_id": "$CONNECTION_ID",
"report": "summary",
"since": "2026-11-01",
"until": "2026-11-07"
}
EOF- Needs yt-analytics.readonly.
Limitations
- Upload size up to 20 MB, MP4 only.
- Uploads count against the Google project's YouTube API quota.
Common errors
| Error | Meaning | Fix |
|---|---|---|
access_denied | The person cancelled on Google. | Try again and approve. |
redirect_uri_mismatch (Google screen) | Callback not registered. | Add https://YOUR_DOMAIN/auth/callback/youtube to the OAuth client. |
account_reconnection_required | The refresh token is no longer valid. | Reconnect the account. |
Comments
/api/v1/projects/{project_id}/inbox/queryinbox:readresource: youtube_threads (comment threads on a video) or youtube_replies.
Replies and moderation use POST /inbox/operations with action reply_youtube_comment, moderate_youtube_comment, reject_youtube_comment or delete_youtube_comment. Needs youtube.force-ssl.