Draft a campaign
Create a campaign draft with its brief. Nobody sees a draft until publish_campaign makes it live, so the person can review it first. Takes productId, or product to add a new one.
View as Markdownhttps://yapfactory.com/api/v1/campaigns| Who can use it | Brands |
| Tier | write: Changes your own things only. Nobody else is told. |
| Scope | campaigns:write, or write |
| Idempotency-Key | Optional, and recommended |
| Rate limit | Writes: 20 a minute |
| MCP tool | create_campaign_draft |
Parameters
productIdFrom list_products.
productA new product, when productId isn't given.
product.nameThe product's name. 1 to 80 characters.
product.urlApp Store, Play Store or website link. Up to 500 characters.
product.platformWhere people use it.
product.descriptionWhat it is and who it's for. Up to 2000 characters.
titleThe campaign's name, as creators see it. 3 to 100 characters.
templateone_video: 1 video for your own channels. test_openings: 1 video with 3 openings. ad_bundle: 3 videos you can run as ads for 3 months. Default "one_video".
videosVideos per creator (overrides the template). 1 to 20.
adRightsorganic = your own channels, no ads. paid_*: how long you can run it as an ad.
targetCountriesWhere the creators' audiences should be. Left out: your own country. 1 to 5 items.
lengthSecondsHow long each video runs. Default 30.
deadlineyyyy-mm-dd, at least 5 days away. Default: the template's (2-3 weeks).
briefbrief.keyMessageWhat the video must get across. Leave out to let the creator decide. Up to 600 characters.
brief.hooksOpening lines to try. Leave out to let the creator decide. Up to 5 items.
brief.ctaClosing call to action. Leave out to let the creator decide. Up to 200 characters.
brief.dosThings the video should do. Up to 8 items.
brief.dontsThings it must not do or say. Up to 8 items.
brief.exampleVideoUrlA video in the style you want. Up to 500 characters.
What a draft gets
- Price. There's no price to set. Each creator sets their own rate per video, and you see it in
GET /creatorsbefore you invite anyone. Ad rights are priced by each creator too. - Revisions. Every deal includes 3 rounds of changes.
- Disclosure. Videos are marked
#ad. - Set on the site, not here: exclusivity, a rush deadline, bonuses, raw footage and cut-downs. The draft's
reviewlink opens the page where the person can change them before publishing.
Example request
curl -X POST "https://yapfactory.com/api/v1/campaigns" \
-H "Authorization: Bearer $YAP_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"productId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
"title": "Morning routine with Sleepwell",
"template": "one_video",
"lengthSeconds": 30,
"brief": {
"keyMessage": "Sleepwell helps you fall asleep in 10 minutes without your phone.",
"hooks": [
"I used to scroll until 2am."
],
"cta": "Try it free tonight."
}
}'Response
201 with the result in data: the same object the MCP tool returns.
{
"data": {
"campaignId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
"status": "draft",
"review": "https://yapfactory.com/brand/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/edit",
"next": "Show the person the draft (get_campaign), then publish_campaign when they're happy."
}
}An example: fields that don't apply are null, and new fields can be added at any time, so ignore ones you don't know. Every response carries Request-Id and the RateLimit-* headers.
Errors
| Code | Status | When |
|---|---|---|
invalid_request | 400 | A field failed validation (see meta.issues), or an unknown query parameter. |
unauthorized | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
insufficient_scope | 403 | The token doesn't have campaigns:write (or write). |
forbidden | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
conflict | 409 | Its current state doesn't allow this. message says why, in words you can show. |
idempotency_conflict | 409 | The same Idempotency-Key came with a different body. |
rate_limited | 429 | Over the limit. Wait for Retry-After seconds. |
internal | 500 | Our fault. Retry later, and send us the requestId if it keeps happening. |
Every error has the same shape. See Errors for what to do about each one.