Render pre-create ad 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.
API key authentication - use your Zernio API key as a Bearer token
In: header
Zernio SocialAccount id used to resolve the Meta token.
Meta ad account id (act_).
Meta ad_format values, one preview per format. Defaults to [DESKTOP_FEED_STANDARD].
1 <= items <= 10Preview an existing ad-account creative by id. Mutually exclusive with creativeSpec.
Raw Meta creative spec forwarded verbatim to /generatepreviews. Mutually exclusive with existingCreativeId.
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.generateAdPreviews({ body: { accountId: 'account_abc123', adAccountId: 'adaccount_abc123', },});console.log(data);{
"previews": [
{
"format": "string",
"html": "string"
}
]
}{
"error": "Unauthorized"
}Delete a creative DELETE
Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.
Upload an ad image from base64 POST
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.