Upload an ad image from base64
Uploads raw image bytes to the Meta ad account's image library — for callers whose
creatives aren't 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.
API key authentication - use your Zernio API key as a Bearer token
In: header
Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
Meta ad account id (act_).
Raw base64 image bytes, or a full data URL (the data:image/...;base64, prefix is stripped).
Optional filename shown in Meta's image library. Defaults to ad_image.jpg.
Response Body
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"
}
}{
"error": "Unauthorized"
}Render pre-create ad previews POST
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.
List custom audiences GET
Returns custom audiences for the given ad account. Supports Meta, Google, TikTok, Pinterest, LinkedIn, and X (Twitter).