← All documentation
Networks

YouTube

Upload a video to a YouTube channel (Data API v3).

Connect

Google OAuth:

curl -X POST https://api.herald.leiritech.com/v1/accounts/connect \
  -H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
  -d '{"network":"youtube","redirect_url":"https://your-app.example/connected"}'

Prerequisites (owner) — gated: a Google Cloud project with the YouTube Data API enabled and an OAuth client (youtube.upload scope); its Client ID/Secret in admin → Platform apps; redirect https://herald.leiritech.com/api/oauth/youtube/callback registered. Videos from an unverified project are forced to PRIVATE until Google audits the project.

Publish

Upload the video (MP4/MOV) then publish — Herald fetches the hosted bytes and does the resumable upload to YouTube:

# 1) upload the video → media id
curl -X POST https://api.herald.leiritech.com/v1/media \
  -H "Authorization: Bearer hld_…" -F "file=@clip.mp4"

# 2) publish (title = video title, text = description)
curl -X POST https://api.herald.leiritech.com/v1/posts \
  -H "Authorization: Bearer hld_…" -H "Content-Type: application/json" \
  -d '{"targets":["<youtube-uuid>"],"title":"My Video","text":"Full description here","media_ids":["v1…"],"mode":"now"}'
{ "id":"…","status":"published","title":"My Video",
  "targets":[{"network":"youtube","status":"published","permalink":"https://www.youtube.com/watch?v=VID123"}] }

Rules & gotchas

  • A video is required. title (or the first line of text) becomes the video title; text is the description.
  • Default privacy is public, but an unverified project publishes private regardless — complete Google's audit to publish public.
  • Large videos are held in memory during upload; current cap is 300 MB.