Zernio
APIFor you
Zernio
APIFor you
API Reference

Creatives

Creative libraryGETAd image libraryGETAd video libraryGETList TikTok ad identitiesGETList partnership ad contentGETList partnership permissionsGETCreate a standalone creativePOSTCreative detailsGETDirect video and image URLs for an adGETRender previews of an existing adGETGet ad video processing statusGETSet partnership permissionPOSTRename a creativePUTDelete a creativeDELETEDelete an ad videoDELETERender pre-create ad previewsPOSTUpload an ad image from base64POSTUpload an ad videoPOST
Dashboard
OverviewPlatformsAPI ReferenceResources
Creatives

Upload an ad image from base64

Uploads an image file to a Meta ad account's library, for creatives that are not hosted at a public URL.

Returns the image hash (Meta's identifier for the asset) and the Meta-hosted url, which can be used directly as imageUrl on the create endpoints. Max 30 MB decoded.


PlatformsMeta
POST
/v1/ads/images

Authorization

bearerAuth
AuthorizationBearer <token>

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.adcreatives.uploadAdImage({  body: {    accountId: 'account_abc123',    adAccountId: 'adaccount_abc123',    imageBase64: 'string',  },});console.log(data);
{  "adAccountId": "string",  "image": {    "hash": "string",    "url": "string"  }}
Was this page helpful?

Render pre-create ad previews

Shows how a Meta creative will look in each placement before you create the ad, as embeddable previews. Renders how a creative would look per placement BEFORE any ad exists, via Meta's `/generatepreviews`. Provide exactly one creative source: `existingCreativeId` or `creativeSpec`. Each preview is an HTML `<iframe>` snippet embeddable directly. Unknown `formats` values return Meta's 400 verbatim.

Upload an ad video

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.

accountId*string

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

adAccountId*string

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

imageBase64*string

Raw base64 image bytes, or a full data URL (the data:image/...;base64, prefix is stripped).

filename?string

Optional filename shown in Meta's image library. Defaults to ad_image.jpg.