Overview
The YouTube integration lets you publish completed video jobs directly to a YouTube channel. The OAuth flow is handled server-side; once connected, you can upload videos programmatically or from the dashboard.
Step 1 — Initiate OAuth
POST /api/youtube/auth/initiate/Redirects the user to Google’s OAuth consent screen. Call this from your backend and redirect the browser to the returned URL.
curl -X POST https://api.oshara.ai/api/youtube/auth/initiate/ \
-H "Authorization: Bearer <token>"Response:
{
"authorization_url": "https://accounts.google.com/o/oauth2/auth?..."
}Redirect the user’s browser to authorization_url.
Step 2 — OAuth callback
GET /api/youtube/auth/callback/?code=...&state=...Google redirects to this endpoint after the user grants permission. Oshara stores the OAuth tokens server-side. This endpoint is called by Google — you don’t call it directly.
Get connected channel info
GET /api/youtube/channel/Returns details about the connected YouTube channel.
curl https://api.oshara.ai/api/youtube/channel/ \
-H "Authorization: Bearer <token>"Response:
{
"channel_id": "UCxxxxxxxxxxxxxxxxxx",
"title": "Acme Inc",
"description": "Official Acme channel",
"subscriber_count": 1200,
"thumbnail_url": "https://yt3.ggpht.com/..."
}Returns 404 if no channel is connected yet.
Upload a video to YouTube
POST /api/youtube/upload/Publishes a completed video job to YouTube. The job must have status: "COMPLETED".
curl -X POST https://api.oshara.ai/api/youtube/upload/ \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"job_id": 42,
"title": "Acme Product Demo — June 2025",
"description": "See how Acme helps you...",
"tags": ["demo", "acme", "saas"],
"privacy_status": "public"
}'Request body
| Field | Type | Required | Description |
|---|---|---|---|
job_id | integer | ✓ | ID of the completed video job to upload. |
title | string | YouTube video title. Defaults to the job’s title. | |
description | string | YouTube video description. | |
tags | string[] | YouTube tags. | |
privacy_status | "public" | "unlisted" | "private" | Visibility (default "public"). |
Response
{
"upload_id": 7,
"youtube_video_id": "dQw4w9WgXcQ",
"youtube_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"status": "PROCESSING"
}The upload processes asynchronously — YouTube transcodes the video after receipt. Poll the upload status endpoint to confirm completion.
List uploads
GET /api/youtube/uploads/curl https://api.oshara.ai/api/youtube/uploads/ \
-H "Authorization: Bearer <token>"Returns all upload records for the authenticated user.
Upload status
GET /api/youtube/uploads/{id}/status/curl https://api.oshara.ai/api/youtube/uploads/7/status/ \
-H "Authorization: Bearer <token>"Response:
{
"upload_id": 7,
"youtube_video_id": "dQw4w9WgXcQ",
"youtube_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"status": "COMPLETED",
"error_message": null
}| Status | Meaning |
|---|---|
PROCESSING | Oshara is uploading the file to YouTube. |
COMPLETED | Video is live on YouTube. |
FAILED | Upload failed — see error_message. |