Ad Creatives

Upload an ad video

Changed on

Uploads a video to a Meta ad account from a URL or file, so you can preview it or use it in ads before any ad exists.

Standalone ad-video upload (parallel to POST /v1/ads/images), so a video creative can be rendered via POST /v1/ads/preview or attached via video.id on POST /v1/ads/create before an ad exists.

Accepts either an https videoUrl we download server-side (SSRF-guarded) or raw videoBase64 bytes; exactly one is required. videoBase64 is capped by Vercel's body limit, around 4.5 MB payload in practice, so larger videos must come via videoUrl.

Returns the Meta video.id (reusable wherever video.id is accepted) plus Meta's auto-generated poster URL when available. By default the endpoint waits until Meta reports the video ready (chunked upload + transcode can take minutes; the handler runs up to 800 s) and answers 201.

Async mode. Send async: true to get a 202 as soon as Meta has accepted the bytes, with video.status: processing. Then either poll GET /v1/ads/videos/{videoId} until status is ready, or subscribe to the ad.video.processed webhook. A create call that references the video while it is still processing waits up to 30 s, then answers 409 invalid_resource_state naming the status endpoint. With videoUrl the download and byte transfer still happen inside the request; only Meta's transcode is skipped.

post/v1/ads/videos

Request

  • Base URL: https://zernio.com/api
  • URL: https://zernio.com/api/v1/ads/videos
  • Auth: HTTP bearer

Request body

accountIdstring required

Zernio SocialAccount id (posting or ads variant); its platform decides where the campaign is created.

adAccountIdstring required

Platform ad account id (Meta act_<n>, Google customer id, LinkedIn account id, ...).

videoUrlstring

Public https URL of the video; downloaded server-side (SSRF-guarded) before chunked upload. Provide exactly one of videoUrl or videoBase64.

videoBase64string

Raw base64 video bytes, or a full data URL (the data:video/...;base64, prefix is stripped). Capped by Vercel's body limit (~4.5 MB payload). Provide exactly one of videoUrl or videoBase64.

filenamestring

Optional file name, sent to Meta as the video's name and title so it shows and is searchable in the Ads Manager media library. Applies to both videoUrl and videoBase64. Without it (and without name), a videoUrl upload is named after the last path segment of the URL.

namestring

Optional video name shown in the Ads Manager media library. Takes precedence over filename.

asyncboolean

true: answer 202 once Meta accepts the upload instead of waiting for processing. Poll GET /v1/ads/videos/{videoId} or subscribe to ad.video.processed.

Response

Video uploaded and ready

adAccountIdstring

Changes