Skip to content
techrace/
TECHRACE DOCUMENTATION

YouTube

Connect YouTube channels, upload videos, read channel analytics and manage comments.

Quick reference

PropertyValue
Platform valueyoutube
One connected accountOne YouTube channel.
Text limit5,000 characters
SupportedMP4 video up to 20 MB
FeaturesPosting ✓ · Analytics ✓ · Inbox ✓
Provider approvalOAuth verification; channel authorization and applicable quota/compliance review
TokenAccess 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:

  1. In console.cloud.google.com create (or reuse) a project and a Web application OAuth client; copy its Client ID and Client secret.
  2. Enable the YouTube Data API v3.
  3. Authorized redirect URI: https://YOUR_DOMAIN/auth/callback/youtube
  4. 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.

PermissionRequested by defaultUsed for
https://www.googleapis.com/auth/youtube.uploadYesUpload videos
https://www.googleapis.com/auth/youtube.readonlyYesRead the channel and its videos
https://www.googleapis.com/auth/yt-analytics.readonlyOptionalChannel analytics
https://www.googleapis.com/auth/yt-analytics-monetary.readonlyOptionalRevenue analytics
https://www.googleapis.com/auth/youtube.force-sslOptionalRead, reply to and moderate comments

Connect an account

POST/api/v1/projects/{project_id}/connect-sessionsconnections:write

Create 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"
}
EOF

After 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

POST/api/v1/projects/{project_id}/executionsexecutions:write

Upload 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

POST/api/v1/projects/{project_id}/analytics/queryanalytics:read
reportWhat it returns
dailyDaily channel metrics
summaryTotals for the period
videosPer-video metrics
countriesMetrics by country
traffic_sourcesWhere views come from
traffic_source_detailsDetail for one traffic_source
devicesBy device type
operating_systemsBy operating system
demographicsViewer age and gender
retentionAudience retention for one video
sharing_servicesWhere 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.

Comments

POST/api/v1/projects/{project_id}/inbox/queryinbox:read

resource: youtube_threads (comment threads on a video) or youtube_replies.

curl -X POST "https://YOUR_DOMAIN/api/v1/projects/$TECHRACE_PROJECT_ID/inbox/query" \
  -H "Authorization: Bearer $TECHRACE_API_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "customer_id": "$CUSTOMER_ID",
  "connection_id": "$CONNECTION_ID",
  "resource": "youtube_threads",
  "youtube_video_id": "dQw4w9WgXcQ",
  "limit": 20
}
EOF

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.

Limitations

  • Upload size up to 20 MB, MP4 only.
  • Uploads count against the Google project's YouTube API quota.

Common errors

ErrorMeaningFix
access_deniedThe 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_requiredThe refresh token is no longer valid.Reconnect the account.