# Yap Factory developer docs

> The REST API, the MCP server, OAuth and webhooks for Yap Factory, the UGC marketplace for brands. Every page below is also at its own URL with `.md` added.

Index: https://yapfactory.com/llms.txt

---

<!-- https://yapfactory.com/developers.md -->

# Run your UGC from an assistant, a script or your own app.

> Everything a brand or creator does on Yap Factory can be done from ChatGPT, Claude, a script or your own product: find creators, publish a campaign, invite, schedule posts and keep deals moving. Payment stays on yapfactory.com.

- **[Use it in ChatGPT or Claude](https://yapfactory.com/developers/mcp.md)**: No code. Add the connector, sign in, and ask for what you need.
- **[Automate your own account](https://yapfactory.com/developers/quickstart.md)**: An API key for your scripts, a sync with your tools, or a headless agent.
- **[Build for other brands](https://yapfactory.com/developers/oauth.md)**: OAuth with PKCE. Each brand signs in and approves what your app can do.

## What you can do

- **Brands:** search creators and read their profiles, draft a campaign and its brief, publish it, invite up to 8 creators to a campaign, pass on a creator, send a draft back with notes, and pause or close a campaign.
- **Brands, posting:** schedule finished videos and photos to your own TikTok and Instagram accounts, and change or cancel them before they go out.
- **Creators:** browse live campaigns and what each pays, read a brief, ask to join, and say yes or no to an invite.
- **Everyone:** list your deals, read one with whose move it is, and message the other side.
- **Webhooks:** hear about every deal event as it happens, signed so you know it came from us.

That's 30 REST operations and 28 MCP tools. Both run the same checks as the site: who owns what, the screening for contact details, and the emails to the other side.

## Payment stays with people

No call moves money. Starting a deal charges the brand's card, and approving a draft pays the creator. Both happen on the deal page on yapfactory.com, and the payment is held by Yap Factory in between.

The API returns a link for those steps (a **handoff**), and an agent shows it to you. Publishing a campaign, inviting creators, answering an invite and scheduling a post reach other people, so agents confirm those with you first.

## Authentication

Every surface takes the same bearer tokens. Make API keys in **Settings → AI agents → Make an API key**: a key can only read, or read and act.

| Surface | URL | Credential | Header |
| --- | --- | --- | --- |
| REST API | `https://yapfactory.com/api/v1` | API key `yf_live_…` or OAuth token `yfa_…` | `Authorization: Bearer …` |
| MCP server | `https://yapfactory.com/mcp` | OAuth through your client, or an API key | `Authorization: Bearer …` |
| Webhooks | Your https URL | Signing secret `whsec_…`, to check what we send | `Yap-Signature` |
| OpenAPI spec | `https://yapfactory.com/api/v1/openapi.json` | None | None |

Scopes are `read` and `write`, or one resource at a time, such as `campaigns:write`. See [scopes](https://yapfactory.com/developers/oauth.md#scopes).

## All the docs

- [Quickstart](https://yapfactory.com/developers/quickstart.md): a key, then your first four calls, in cURL, Node and Python.
- [Connect ChatGPT, Claude and others](https://yapfactory.com/developers/mcp.md): the MCP server, step by step for each app.
- [OAuth](https://yapfactory.com/developers/oauth.md): the sign-in flow for apps that act for other people.
- [REST API reference](https://yapfactory.com/developers/api.md): every operation, with parameters and examples.
- [MCP tools](https://yapfactory.com/developers/tools.md): every tool an agent sees.
- [Errors](https://yapfactory.com/developers/errors.md) and [Pagination, idempotency and limits](https://yapfactory.com/developers/pagination.md): the rules every call follows.
- [Webhooks](https://yapfactory.com/developers/webhooks.md): events, payloads and checking signatures.
- [Testing safely](https://yapfactory.com/developers/sandbox.md): build without reaching anyone, then go live.
- [Changelog](https://yapfactory.com/developers/changelog.md) and [Status](https://yapfactory.com/status).

Every page is also plain Markdown: add `.md` to its address. All of it in one file: [/developers/llms-full.txt](https://yapfactory.com/developers/llms-full.txt).

## Help

Questions, a bug or an idea: [support@yapfactory.com](mailto:support@yapfactory.com). Send the `requestId` from any error and we can find the call.

---

HTML version: https://yapfactory.com/developers


---

<!-- https://yapfactory.com/developers/quickstart.md -->

# Quickstart

> Make a key, check who you are, list your campaigns and draft a new one. About five minutes, in cURL, Node or Python.

## 1. Make an API key

1. Sign in to yapfactory.com with your brand account.
2. Open **Settings → AI agents → Make an API key**, turn on **Let it act for me** and make the key.
3. Copy it. It's shown once, and starts with `yf_live_`.

```bash
export YAP_API_KEY="yf_live_..."
```

> Trying things out? Leave **Let it act for me** off for a read-only key, and see [Testing safely](https://yapfactory.com/developers/sandbox.md) for what reaches other people.

## 2. Check who you are

`GET /me` returns your account: brand, creator or both, your country and currency, and what this key is allowed to do.

cURL:

```bash
curl "https://yapfactory.com/api/v1/me" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

Node:

```js
const res = await fetch("https://yapfactory.com/api/v1/me", {
  headers: { Authorization: `Bearer ${process.env.YAP_API_KEY}` },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
console.log(body.data);
```

Python:

```python
import os, requests

r = requests.get(
    "https://yapfactory.com/api/v1/me",
    headers={"Authorization": f"Bearer {os.environ['YAP_API_KEY']}"},
)
body = r.json()
if not r.ok:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
print(body["data"])
```

```json
{
  "data": {
    "name": "Dana Lee",
    "email": "dana@sleepwell.app",
    "country": "US",
    "currency": "USD",
    "sides": [
      "brand"
    ],
    "brand": {
      "company": "Sleepwell",
      "country": "US",
      "paused": false,
      "home": "https://yapfactory.com/brand"
    },
    "creator": null,
    "canAct": true,
    "gettingStarted": {
      "step": "review_draft",
      "say": "Maya R.'s draft is ready to review.",
      "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
    },
    "environment": "live",
    "connection": {
      "app": "API key",
      "kind": "api_key",
      "scopes": [
        "read",
        "write"
      ],
      "manage": "https://yapfactory.com/brand/settings#agents"
    }
  }
}
```

`gettingStarted` is the one next thing worth doing on this account, or `null` when nothing is waiting ([every step](https://yapfactory.com/developers/statuses.md#getting-started)). `connection.scopes` says what this key may do. `canAct` is about the account, not the key: it's false until the email is confirmed.

## 3. List your campaigns

Lists come back as `{ data, nextCursor, hasMore }`. Pass `nextCursor` back as `?cursor=` for the next page, until `hasMore` is false.

cURL:

```bash
curl "https://yapfactory.com/api/v1/campaigns?status=live" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

Node:

```js
const res = await fetch("https://yapfactory.com/api/v1/campaigns?status=live", {
  headers: { Authorization: `Bearer ${process.env.YAP_API_KEY}` },
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
console.log(body.data);
```

Python:

```python
import os, requests

r = requests.get(
    "https://yapfactory.com/api/v1/campaigns?status=live",
    headers={"Authorization": f"Bearer {os.environ['YAP_API_KEY']}"},
)
body = r.json()
if not r.ok:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
print(body["data"])
```

## 4. Draft a campaign

A draft is private: nobody sees it until you publish. Give `productId` from `GET /products`, or `product` to add a new one, as here. Send an `Idempotency-Key`, so a retry never makes two drafts.

cURL:

```bash
curl -X POST "https://yapfactory.com/api/v1/campaigns" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "product": {
      "name": "Sleepwell",
      "platform": "ios",
      "url": "https://apps.apple.com/app/id0000000000"
    },
    "title": "Morning routine with Sleepwell",
    "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."
    }
  }'
```

Node:

```js
const res = await fetch("https://yapfactory.com/api/v1/campaigns", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.YAP_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    "product": {
      "name": "Sleepwell",
      "platform": "ios",
      "url": "https://apps.apple.com/app/id0000000000"
    },
    "title": "Morning routine with Sleepwell",
    "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."
    }
  }),
});
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
console.log(body.data.campaignId);
```

Python:

```python
import os, uuid, requests

r = requests.post(
    "https://yapfactory.com/api/v1/campaigns",
    headers={
        "Authorization": f"Bearer {os.environ['YAP_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
      "product": {
        "name": "Sleepwell",
        "platform": "ios",
        "url": "https://apps.apple.com/app/id0000000000"
      },
      "title": "Morning routine with Sleepwell",
      "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."
      }
    },
)
body = r.json()
if not r.ok:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")
print(body["data"]["campaignId"])
```

You get `201` with the new draft's id and the page to review it on:

```json
{
  "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."
  }
}
```

When it reads well, `POST /campaigns/{campaignId}/publish` makes it live and matching creators can ask to join. Publishing tells other people, so it needs an `Idempotency-Key`.

## Next

- [Webhooks](https://yapfactory.com/developers/webhooks.md): hear about asks, yeses and drafts as they happen, instead of polling.
- [REST API reference](https://yapfactory.com/developers/api.md): every operation, with what it needs.
- [Errors](https://yapfactory.com/developers/errors.md): what each code means and what to do.
- [OAuth](https://yapfactory.com/developers/oauth.md): when your app acts for other brands.

---

HTML version: https://yapfactory.com/developers/quickstart


---

<!-- https://yapfactory.com/developers/sandbox.md -->

# Testing safely

> A public sandbox with test data is on the way. Until then you build against yapfactory.com, and these rules keep testing from reaching anyone.

## Start read-only

1. Make a key in **Settings → AI agents → Make an API key** and leave **Let it act for me** off. A read-only key can list and read everything you can see, and can't change anything.
2. Explore with `GET` calls: `/me`, `/campaigns`, `/creators`, `/deals`. Nothing you read tells anyone.
3. When you're ready to act, make a second key that can. Revoke either one at any time.

## What stays private

- **Campaign drafts.** `POST /campaigns` makes a draft that only you can see, and you can change the brief as often as you like. Nobody is told until you publish it.
- **Uploads.** A file from `POST /posts/uploads` sits unused until you schedule it.
- **Money never moves through the API.** Starting a deal and approving a draft return a link to the deal page, where the person finishes the step.

## What reaches other people

These calls tell someone straight away. They need an `Idempotency-Key`, and agents should get a clear yes from the person first:

- Publishing, pausing or closing a campaign, and inviting creators.
- Passing on a creator, asking for changes to a draft, and messaging on a deal.
- Asking to join a campaign and answering an invite (creators).
- Scheduling a post: it goes out publicly on your account at its time. Cancel it before then with `POST /posts/{postId}/cancel`.

Want to try webhooks? **Send test event** in Settings → Webhooks delivers a signed `ping` to your endpoint without anything else happening.

## Sandbox: coming soon

A separate sandbox with demo brands, creators and campaigns, where nothing reaches anyone and payments use Stripe test mode. Its keys will start with `yf_test_`. It will be listed in the [changelog](https://yapfactory.com/developers/changelog.md) when it opens.

## Before you go live

1. Use the base URL `https://yapfactory.com/api/v1`.
2. Make a `yf_live_` key on yapfactory.com, with only the access you need (read-only if you never act). Keep it in a secret store, never in code.
3. OAuth apps: point your redirect URIs at your production app. Loopback addresses are for development.
4. Send an `Idempotency-Key` on every `POST`, `PATCH` and `DELETE`, and reuse it when you retry.
5. Branch on `error.code`, never on `message`. Log the `requestId`.
6. Handle `429`: wait `Retry-After` seconds. Stay under 20 changes a minute per connection.
7. Page through lists with `cursor` until `hasMore` is false.
8. Add your production webhook endpoint in Settings → Webhooks. Each endpoint has its own `whsec_` secret. Check signatures, and dedupe on `Yap-Event-Id`.
9. Show people the handoff link for starting a deal and approving a draft. Never try to take payment yourself.
10. Confirm with the person before anything that reaches other people: publishing, pausing or closing a campaign, inviting or passing on a creator, asking for changes to a draft, asking to join a campaign, answering an invite, sending a message and scheduling a post.

---

HTML version: https://yapfactory.com/developers/sandbox


---

<!-- https://yapfactory.com/developers/mcp.md -->

# Connect ChatGPT, Claude or your own agent

> Add Yap Factory to the assistant you already use, sign in, and ask for what you need: find creators, draft and publish a campaign, invite, schedule posts and keep deals moving. Payment stays with you.

## Add it in one click

- **[Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=yapfactory&config=eyJ1cmwiOiJodHRwczovL3lhcGZhY3RvcnkuY29tL21jcCJ9)**: Opens Cursor with Yap Factory ready to add. Sign in when it asks.
- **[VS Code](https://vscode.dev/redirect/mcp/install?name=yapfactory&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fyapfactory.com%2Fmcp%22%7D)**: Opens VS Code with Yap Factory ready to add. Sign in when it asks.

In a terminal, one line adds it:

Claude Code:

```bash
claude mcp add --transport http yapfactory https://yapfactory.com/mcp
```

Codex:

```bash
codex mcp add yapfactory --url https://yapfactory.com/mcp
```

Gemini CLI:

```bash
gemini mcp add --transport http yapfactory https://yapfactory.com/mcp
```

In a chat app, add it as a custom connector. The steps for each app are below.

## Claude

1. In claude.ai or Claude Desktop, open **Customize → Connectors**, choose **+ Add**, then **Add custom connector**.
2. Name it Yap Factory, paste `https://yapfactory.com/mcp` and choose **Add**.
3. Choose **Connect**, sign in to Yap Factory, and allow it.

On Team and Enterprise plans, an owner adds it first in **Organization settings → Connectors**.

## ChatGPT

1. On chatgpt.com, open **Plugins**, press **+** and choose **Add custom MCP server**.
2. Name it Yap Factory, paste `https://yapfactory.com/mcp` and choose OAuth.
3. Sign in to Yap Factory and allow it.

ChatGPT offers custom MCP servers on Business, Enterprise and Edu plans, on the web. On Business an owner or admin adds it; on Enterprise and Edu an admin gives people that permission. Checked on 2 December 2026; ChatGPT's own help has the current steps.

## Perplexity

1. On perplexity.ai, open **Plugins** in the sidebar, choose **Add custom**, then **Add MCP connector**, then **Remote**.
2. Name it Yap Factory, paste `https://yapfactory.com/mcp`, choose OAuth and **Add**.
3. Choose the Yap Factory card, sign in to Yap Factory, and allow it.

Perplexity offers custom connectors on Pro, Max and Enterprise. On Enterprise an admin adds them in **Organization settings → Connectors**.

## Grok

1. Go to grok.com/connectors, choose **New Connector**, then **Custom**.
2. Paste `https://yapfactory.com/mcp`, sign in to Yap Factory, and allow it.

Checked on 3 December 2026. Each app's own help has the current steps.

## Try asking

- "What needs me today on Yap Factory?"
- "Draft a campaign for my app: one 30-second video for our own TikTok. Show me the brief before you publish anything."
- "Find five creators for my skincare campaign who've made brand videos before, and tell me why each one fits."
- "The draft from Maya is in. Summarise it and write notes asking for a brighter opening."
- "Schedule the approved video to our TikTok for Thursday at 6pm. Ask me who should see it."
- Creators: "Find campaigns I'd be a good fit for and what each pays."

The server also offers ready-made workflows. Apps that support MCP prompts list them:

- **Run a UGC campaign** (`run_campaign`): Plan, draft and publish a campaign, then line up creators.
- **Find creators for a campaign** (`find_creators`): Shortlist and invite creators for one live campaign.
- **What needs me today** (`check_deals`): Go through open deals and say what's waiting on me: creators who said yes, drafts to review, messages.
- **Write a UGC brief** (`write_brief`): Turn a product and a goal into a short creator brief, and save it to a draft.
- **Schedule posts to TikTok and Instagram** (`schedule_posts`): Plan and schedule finished videos to the brand's own TikTok and Instagram accounts.
- **Find campaigns to make** (`find_work`): Browse live campaigns, read the briefs that fit and ask to join.
- **Answer my invites** (`answer_invites`): Go through invites from brands and answer them with me.

A longer walk-through: [Hire UGC creators from ChatGPT or Claude](https://yapfactory.com/guides/hire-ugc-creators-from-chatgpt-or-claude).

## Coding agents and other clients

MCP server:

```
https://yapfactory.com/mcp
```

It speaks the Model Context Protocol over Streamable HTTP and signs people in with OAuth. An agent gets up to 28 tools, depending on whether you're a brand, a creator or both. Each one is in the [tools reference](https://yapfactory.com/developers/tools.md).

### Claude Code

```bash
claude mcp add --transport http yapfactory https://yapfactory.com/mcp
```

Then run `/mcp` in Claude Code and pick yapfactory to sign in.

Or install the plugin, which adds the server plus three skills: running a campaign, scheduling posts, and (for creators) finding work.

```text
/plugin marketplace add shehrum/yapfactory-plugin
/plugin install yapfactory@yapfactory
```

### Codex

```bash
codex mcp add yapfactory --url https://yapfactory.com/mcp
```

Then run `codex mcp login yapfactory` to sign in in your browser.

Or install the plugin, with the same three skills:

```bash
codex plugin marketplace add shehrum/yapfactory-plugin
codex plugin add yapfactory@yapfactory
```

### Gemini CLI

```bash
gemini mcp add --transport http yapfactory https://yapfactory.com/mcp
```

Then run `/mcp auth yapfactory` in Gemini CLI to sign in.

### Cursor

[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=yapfactory&config=eyJ1cmwiOiJodHRwczovL3lhcGZhY3RvcnkuY29tL21jcCJ9), or add it to your config by hand:

.cursor/mcp.json:

```json
{
  "mcpServers": {
    "yapfactory": {
      "url": "https://yapfactory.com/mcp"
    }
  }
}
```

### VS Code

[Add to VS Code](https://vscode.dev/redirect/mcp/install?name=yapfactory&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fyapfactory.com%2Fmcp%22%7D), or add it to your config by hand:

.vscode/mcp.json:

```json
{
  "servers": {
    "yapfactory": {
      "type": "http",
      "url": "https://yapfactory.com/mcp"
    }
  }
}
```

Each client opens a browser for you to sign in the first time.

### Scripts and headless agents

Make an API key in **Settings → AI agents → Make an API key** ([brands](https://yapfactory.com/brand/settings#agents), [creators](https://yapfactory.com/creator/settings#agents)) and send it as a bearer token. A key can only look, or look and act. You can have 10 keys.

```bash
curl https://yapfactory.com/mcp \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

For scripts, the [REST API](https://yapfactory.com/developers/api.md) is usually simpler: the same operations, with plain JSON.

### Discovery

Clients that look for servers on their own find this one from the [AI Catalog](https://yapfactory.com/.well-known/ai-catalog.json), which points to the [MCP Server Card](https://yapfactory.com/mcp/server-card): its name, version, address and the protocol versions it speaks. The [API catalog](https://yapfactory.com/.well-known/api-catalog) lists the REST API and the MCP server together.

## What an agent can do

An agent sees the tools for your side of Yap Factory. If you have a brand and a creator profile, it gets both.

- **Brands:** search creators and read their profiles, draft a campaign and its brief, publish it, invite up to 8 creators to a campaign, pass on a creator, send a draft back with notes, and pause or close a campaign.
- **Brands, posting:** schedule finished videos and photos to your own TikTok and Instagram accounts, then change or cancel them before they go out. On TikTok you always choose who can see the post; there's no default, and comments, Duet and Stitch start off.
- **Creators:** browse live campaigns and what each pays, read a brief, ask to join, and say yes or no to an invite.
- **Everyone:** list your deals, read one with whose move it is, and message the other side.

Everything goes through the same rules as the site: the same checks on who owns what, the same screening for contact details, and the same emails to the other side.

## What stays with you

No tool moves money. Starting a deal charges the brand's card, and approving a draft pays the creator, so both happen on the deal page on yapfactory.com. So do a paid extra revision round, uploading a draft, cancelling a deal and disputes. When one of these is next, the agent gets the link and gives it to you.

Agents are told to check with you before anything that reaches other people or the public: publishing, pausing or closing a campaign, inviting or passing on a creator, asking for changes to a draft, asking to join a campaign, answering an invite, sending a message and scheduling a post. Claude and ChatGPT may also ask you to confirm those tools.

## Limits and errors

- Each connection can make 120 reads and 20 changes a minute. At most 10 of those changes a minute can reach other people. Across all of your connections together: 300 reads, 40 changes and 15 that reach other people.
- A tool that can't do what was asked returns `isError` with a sentence written for the person, such as "Pick a deadline at least 5 days away".
- Amounts come in minor units (pence or cents), with the currency and a formatted string.

The full rules: [Pagination, idempotency and limits](https://yapfactory.com/developers/pagination.md).

## Privacy and safety

An agent sees what you'd see on the site, nothing more. Brands never see a creator's handles or contact details. Briefs, profiles and messages are written by other people, and agents are told to treat them as content, not instructions.

See every connection and disconnect any of them in **Settings → AI agents**. Our [privacy policy](https://yapfactory.com/privacy) covers what we store.

---

HTML version: https://yapfactory.com/developers/mcp


---

<!-- https://yapfactory.com/developers/oauth.md -->

# OAuth for apps

> For apps that act for other brands and creators. Each person signs in to Yap Factory and approves what your app can do. OAuth 2.1 with PKCE, for public clients: no client secrets.

Building for your own account only? An [API key](https://yapfactory.com/developers/quickstart.md) is simpler. MCP clients such as Claude and ChatGPT do all of this for you.

## The flow

1. **Discover** the authorization server from the metadata.
2. **Identify your app** with a Client ID Metadata Document, or register it.
3. **Send the person to authorize** with a PKCE challenge. They sign in and approve.
4. **Swap the code for tokens** at the token endpoint.
5. **Call the API or the MCP server** with the access token. Refresh it when it expires.
6. **Revoke** when the person disconnects in your app.

## Discovery

A call to the MCP server without a token gets `401` with `WWW-Authenticate: Bearer resource_metadata="…"`, which points to the protected resource metadata (RFC 9728). That names the authorization server, whose metadata (RFC 8414) lists every endpoint below.

| What | URL |
| --- | --- |
| Protected resource metadata | `https://yapfactory.com/.well-known/oauth-protected-resource/mcp` (MCP) and `https://yapfactory.com/.well-known/oauth-protected-resource/api/v1` (REST) |
| Authorization server metadata | `https://yapfactory.com/.well-known/oauth-authorization-server` (also at `/.well-known/openid-configuration`) |
| Authorize | `https://yapfactory.com/oauth/authorize` |
| Token | `https://yapfactory.com/oauth/token` |
| Register (DCR) | `https://yapfactory.com/oauth/register` |
| Revoke | `https://yapfactory.com/oauth/revoke` |

```bash
curl https://yapfactory.com/.well-known/oauth-authorization-server
```

## Identify your app

### Client ID Metadata Document (preferred)

Host a small JSON file on your own https domain and use its URL as your `client_id`. We fetch it when someone first connects, and again once a day. Nothing to register, and your name and logo stay up to date.

https://yourapp.com/oauth/client.json:

```json
{
  "client_id": "https://yourapp.com/oauth/client.json",
  "client_name": "Your App",
  "client_uri": "https://yourapp.com",
  "logo_uri": "https://yourapp.com/logo.png",
  "redirect_uris": [
    "https://yourapp.com/oauth/callback"
  ],
  "grant_types": [
    "authorization_code",
    "refresh_token"
  ],
  "token_endpoint_auth_method": "none"
}
```

- `client_id` must equal the file's URL exactly.
- Serve it with status `200`, no redirects, under 20 KB, and answer within 5 seconds.
- Up to 20 `redirect_uris`.

### Dynamic Client Registration

Or register once (RFC 7591) and keep the `client_id` you get back. Clients are always public: no secret is issued, and `token_endpoint_auth_method` is `none`.

```bash
curl -X POST https://yapfactory.com/oauth/register \
  -H "Content-Type: application/json" \
  -d '{
    "client_name": "Your App",
    "redirect_uris": ["https://yourapp.com/oauth/callback"],
    "grant_types": ["authorization_code", "refresh_token"]
  }'
```

201 Created:

```json
{
  "client_id": "yfc_8fK2mQ9xLp3VtR7nYc1B4dWz",
  "client_name": "Your App",
  "redirect_uris": [
    "https://yourapp.com/oauth/callback"
  ],
  "grant_types": [
    "authorization_code",
    "refresh_token"
  ],
  "response_types": [
    "code"
  ],
  "token_endpoint_auth_method": "none"
}
```

Send 1 to 10 redirect URIs. Client ids from registration start with `yfc_`.

### Redirect URIs

- `https` anywhere.
- `http` only on loopback (`localhost`, `127.0.0.1`, `[::1]`), for desktop apps and CLIs. Loopback redirects match on any port.
- A native app's own scheme, such as `cursor://` or `vscode://`.
- Never a fragment, or a user name or password in the URL.

## Authorize

Make a random `code_verifier` (43 to 128 characters), hash it with SHA-256 for the `code_challenge`, and send the person's browser here. Only `S256` is accepted.

```text
https://yapfactory.com/oauth/authorize
  ?response_type=code
  &client_id=https%3A%2F%2Fyourapp.com%2Foauth%2Fclient.json
  &redirect_uri=https%3A%2F%2Fyourapp.com%2Foauth%2Fcallback
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256
  &scope=read%20write
  &state=af0ifjsldkj
  &resource=https%3A%2F%2Fyapfactory.com%2Fapi%2Fv1
```

- `resource` (RFC 8707) is `https://yapfactory.com/api/v1` or `https://yapfactory.com/mcp`. One token works for both.
- The person signs in if they need to, sees your app's name, where it sends them back to, and what it asks for. They can untick the second line to give read-only access, so check the `scope` you get back with the tokens.
- The consent screen says the app can draft and publish campaigns, invite creators, answer invites, send messages and schedule posts to their TikTok and Instagram, and that it can never charge their card, pay a creator or cancel a deal.
- If the person says no, we redirect back with `error=access_denied` and your `state`. Anything wrong with the request itself (an unknown `client_id`, a `redirect_uri` that isn't registered, a missing challenge) is shown to the person on our page, and we never redirect.
- We redirect back with `code`, your `state` and `iss` (RFC 9207). Check that `iss` is the issuer from the metadata. Codes last 10 minutes and work once.

## Get tokens

Swap the code at the token endpoint, form-encoded (JSON works too). Send `client_id`; there's no secret.

```bash
curl -X POST https://yapfactory.com/oauth/token \
  -d grant_type=authorization_code \
  -d code=yfo_... \
  -d redirect_uri=https://yourapp.com/oauth/callback \
  -d client_id=https://yourapp.com/oauth/client.json \
  -d code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
```

```json
{
  "access_token": "yfa_...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "yfr_...",
  "scope": "read write"
}
```

Send the access token as `Authorization: Bearer yfa_...` to the REST API or the MCP server.

## Refresh

Access tokens last an hour. Refresh tokens last 30 days and **rotate**: each refresh returns a new pair, and the old refresh token stops working. Store the new one every time.

```bash
curl -X POST https://yapfactory.com/oauth/token \
  -d grant_type=refresh_token \
  -d refresh_token=yfr_... \
  -d client_id=https://yourapp.com/oauth/client.json
```

- A refresh keeps the scope the person approved, and the answer's `scope` says what that is. Asking for more returns `invalid_scope`: send the person through authorize again.
- **Using a code or a refresh token twice ends the connection.** We take it as a sign someone else has a copy. The person connects again.

## Revoke

When someone disconnects in your app, revoke (RFC 7009). Revoking any token of a connection ends the whole connection. The answer is always `200`.

```bash
curl -X POST https://yapfactory.com/oauth/revoke -d token=yfr_...
```

People can also see and disconnect every connection themselves in **Settings → AI agents**. After that your tokens return `401`.

## Errors and limits

The token, register and revoke endpoints answer errors the OAuth way, not with the API's envelope:

```json
{
  "error": "invalid_grant",
  "error_description": "That code is invalid or has expired."
}
```

| `error` | Status | When |
| --- | --- | --- |
| `invalid_grant` | 400 | The code or refresh token is wrong, expired, already used, or was issued to another client; the `redirect_uri` doesn't match; or the PKCE check failed. |
| `invalid_client` | 401 | No `client_id`, one we don't know, or a metadata document we couldn't read. |
| `invalid_scope` | 400 | A scope we don't have, or a refresh asking for more than was approved. |
| `invalid_target` | 400 | A `resource` that isn't the API or the MCP server. |
| `unsupported_grant_type` | 400 | Anything but `authorization_code` and `refresh_token`. |
| `invalid_client_metadata` | 400 | Registration with a bad redirect URI or grant type. |
| `invalid_request` | 400 | A missing or malformed parameter. |
| `temporarily_unavailable` | 429 | Too many calls from one place. Wait a few minutes. |

Limits per caller: 60 authorize requests and 120 token requests every 10 minutes, 60 revokes every 10 minutes, and 30 registrations an hour. Register once and keep the `client_id`; don't register per person.

## Scopes

Ask for the coarse scopes, which is what the consent screen shows, or one resource at a time.

| Scope | Allows |
| --- | --- |
| `read` | Every operation that reads. |
| `write` | Every operation that acts, and every read. Asking for `write` adds `read`. |
| `<resource>:read` | Reads on one resource. |
| `<resource>:write` | Acts on one resource, and reads it. |

Resources: `account`, `deals`, `campaigns`, `creators`, `marketplace`, `posts`. So the full list is `read`, `write`, `account:read`, `account:write`, `deals:read`, `deals:write`, `campaigns:read`, `campaigns:write`, `creators:read`, `creators:write`, `marketplace:read`, `marketplace:write`, `posts:read`, `posts:write`. A missing or empty `scope` means `read write`.

Each [operation's page](https://yapfactory.com/developers/api.md) names the scope it needs. Without it you get `403 insufficient_scope`, with the scope to ask for in `meta.required`.

---

HTML version: https://yapfactory.com/developers/oauth


---

<!-- https://yapfactory.com/developers/api.md -->

# REST API reference

> 30 operations, grouped by what they touch. Each one has its own page with parameters, an example and the errors it can return.

Base URL:

```
https://yapfactory.com/api/v1
```

Send your token as `Authorization: Bearer …`. Bodies are JSON. Every success is `{ "data": … }` and every error is `{ "error": … }`. The [OpenAPI 3.1 spec](https://yapfactory.com/api/v1/openapi.json) describes all of it, for code generators and API clients.

- [Quickstart](https://yapfactory.com/developers/quickstart.md): your first call in a few minutes.
- [Errors](https://yapfactory.com/developers/errors.md), [Pagination, idempotency and limits](https://yapfactory.com/developers/pagination.md) and [Webhooks](https://yapfactory.com/developers/webhooks.md).
- Money moves only on yapfactory.com. The two money operations return a link instead.

## Account

Who is signed in and what this connection can do.

- `GET /me`: [Your Yap Factory account](https://yapfactory.com/developers/api/get_account.md)

## Deals

A deal is one creator making the videos for one campaign. Both sides can read and message.

- `GET /deals`: [List deals](https://yapfactory.com/developers/api/list_deals.md)
- `GET /deals/{dealId}`: [Get a deal](https://yapfactory.com/developers/api/get_deal.md)
- `POST /deals/{dealId}/messages`: [Message the other side of a deal](https://yapfactory.com/developers/api/send_deal_message.md)
- `POST /deals/{dealId}/pass`: [Pass on a creator](https://yapfactory.com/developers/api/pass_on_creator.md) (Brands)
- `POST /deals/{dealId}/revisions`: [Ask for changes to a draft](https://yapfactory.com/developers/api/request_revision.md) (Brands)
- `POST /deals/{dealId}/answer`: [Answer an invite](https://yapfactory.com/developers/api/respond_to_invite.md) (Creators)
- `POST /deals/{dealId}/start`: [Start a deal (payment link)](https://yapfactory.com/developers/api/start_deal.md) (Brands)
- `POST /deals/{dealId}/approve`: [Approve a draft (review link)](https://yapfactory.com/developers/api/approve_draft.md) (Brands)

## Campaigns

A brand's campaigns: the brief, the shortlist and the invites.

- `GET /products`: [List your products](https://yapfactory.com/developers/api/list_products.md) (Brands)
- `GET /campaigns`: [List campaigns](https://yapfactory.com/developers/api/list_campaigns.md) (Brands)
- `GET /campaigns/{campaignId}`: [Get a campaign](https://yapfactory.com/developers/api/get_campaign.md) (Brands)
- `POST /campaigns`: [Draft a campaign](https://yapfactory.com/developers/api/create_campaign_draft.md) (Brands)
- `PATCH /campaigns/{campaignId}/brief`: [Edit a campaign brief](https://yapfactory.com/developers/api/update_campaign_brief.md) (Brands)
- `POST /campaigns/{campaignId}/publish`: [Publish a campaign](https://yapfactory.com/developers/api/publish_campaign.md) (Brands)
- `POST /campaigns/{campaignId}/status`: [Pause, resume or close a campaign](https://yapfactory.com/developers/api/set_campaign_status.md) (Brands)
- `POST /campaigns/{campaignId}/invites`: [Invite creators](https://yapfactory.com/developers/api/invite_creators.md) (Brands)

## Creators

Creators a brand can invite, as brands see them.

- `GET /creators`: [Search creators](https://yapfactory.com/developers/api/search_creators.md) (Brands)
- `GET /creators/{creatorId}`: [Get a creator](https://yapfactory.com/developers/api/get_creator.md) (Brands)

## Marketplace

Live campaigns, as creators see them.

- `GET /marketplace/campaigns`: [Browse campaigns](https://yapfactory.com/developers/api/browse_campaigns.md) (Creators)
- `GET /marketplace/campaigns/{campaignId}`: [Read a campaign brief](https://yapfactory.com/developers/api/view_campaign_brief.md) (Creators)
- `POST /marketplace/campaigns/{campaignId}/ask`: [Ask to join a campaign](https://yapfactory.com/developers/api/ask_to_join.md) (Creators)

## Posts

Schedule videos and photos to the brand's own TikTok and Instagram accounts. On TikTok the person always chooses the audience; there's no default, and comments, Duet and Stitch start off.

- `GET /posts/accounts`: [List accounts you can post to](https://yapfactory.com/developers/api/list_post_accounts.md) (Brands)
- `GET /posts/accounts/{accountId}`: [Get posting options for an account](https://yapfactory.com/developers/api/get_post_account.md) (Brands)
- `GET /posts/videos`: [List videos you can post](https://yapfactory.com/developers/api/list_postable_videos.md) (Brands)
- `POST /posts/uploads`: [Upload your own video or photo to post](https://yapfactory.com/developers/api/prepare_post_upload.md) (Brands)
- `POST /posts`: [Schedule a post](https://yapfactory.com/developers/api/schedule_post.md) (Brands)
- `GET /posts`: [List scheduled posts](https://yapfactory.com/developers/api/list_posts.md) (Brands)
- `PATCH /posts/{postId}`: [Change a scheduled post](https://yapfactory.com/developers/api/update_post.md) (Brands)
- `POST /posts/{postId}/cancel`: [Cancel a scheduled post](https://yapfactory.com/developers/api/cancel_post.md) (Brands)

---

HTML version: https://yapfactory.com/developers/api


---

<!-- https://yapfactory.com/developers/tools.md -->

# MCP tools reference

> The 28 tools on the [MCP server](https://yapfactory.com/developers/mcp.md), plus one that returns the rules and 7 prompts. An agent only sees the tools for your side, and only the ones that read on a read-only connection. No tool moves money.

## Everyone

For brands and creators alike.

### Your Yap Factory account (`get_account`)

_Reads_

Who is signed in: brand and/or creator, country and currency, what this connection is allowed to do, and the one next thing worth doing (gettingStarted). Shows which tools apply to this account. REST: [`GET /me`](https://yapfactory.com/developers/api/get_account.md).

No inputs.

### List deals (`list_deals`)

_Reads_

Deals you're part of, newest activity first, with each one's status and what happens next. A deal is one creator making videos for one campaign. REST: [`GET /deals`](https://yapfactory.com/developers/api/list_deals.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `"open" \| "closed" \| "all"` | no | open: still in progress (default). closed: finished, declined or cancelled. Default `"open"`. |
| `limit` | `integer` | no | 1 to 50. Default `20`. |

### Get a deal (`get_deal`)

_Reads_

One deal in full: the offer, status, whose move it is, the latest draft's review state, recent messages and the link to the deal page. Paying, approving a draft and cancelling happen on that page. REST: [`GET /deals/{dealId}`](https://yapfactory.com/developers/api/get_deal.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `dealId` | `uuid` | yes | The deal's id. |
| `messages` | `integer` | no | How many recent messages to include. 0 to 50. Default `10`. |

### Message the other side of a deal (`send_deal_message`)

_Changes things · Tells other people_

Send a message in a deal's chat. The other side gets it in the app (and by email if they allow it). Contact details and off-platform payment talk are blocked. Feedback on a draft goes through request_revision, which gives the creator the notes to work from. For use once the person has agreed the words. REST: [`POST /deals/{dealId}/messages`](https://yapfactory.com/developers/api/send_deal_message.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `dealId` | `uuid` | yes | The deal's id. |
| `body` | `string` | yes | The message, in plain words. No contact details or payment talk. 1 to 2000 characters. |

## Brands

Only on a brand account.

### Search creators (`search_creators`)

_Reads_

Browse UGC creators you can invite: niches, rating, delivery record, rate per video and sample videos (each with a link that plays it on Yap Factory). With campaignId, results are ranked by fit for that campaign. A live campaign's ranked shortlist is already in get_campaign; search finds more or different creators. REST: [`GET /creators`](https://yapfactory.com/developers/api/search_creators.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | `string` | no | Words to match in names, summaries and niches. Up to 100 characters. |
| `niches` | `string[]` | no | Only creators in these niches, e.g. skincare, fitness, pets. Up to 10 items. |
| `country` | `string` | no | ISO country code such as US or GB. Up to 10 characters. |
| `platform` | `"tiktok" \| "instagram" \| "youtube"` | no | Only creators with this platform linked. |
| `priceBand` | `"new" \| "intermediate" \| "specialist"` | no | Rate per video: new (lowest), intermediate (rising creators) or specialist (established creators). |
| `verifiedOnly` | `boolean` | no | Only creators who passed an ID check. |
| `minRating` | `number` | no | Only creators rated at least this, out of 5. 0 to 5. |
| `campaignId` | `uuid` | no | One of your live campaigns, to rank and show fit for it. |
| `sort` | `"relevance" \| "price" \| "rating"` | no | relevance: best fit first (default). price: lowest rate first. rating: best rated first. |
| `page` | `integer` | no | 1 to 50. Default `1`. |

### Get a creator (`get_creator`)

_Reads_

A creator's profile as brands see it: summary, niches, audience, rating, delivery record, rate and their videos per platform. Each video has a `watch` link that plays it on Yap Factory; social handles and links to the creator's own accounts are never included. REST: [`GET /creators/{creatorId}`](https://yapfactory.com/developers/api/get_creator.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `creatorId` | `uuid` | yes | The creator's id. |
| `campaignId` | `uuid` | no | One of your campaigns, to see how this creator fits it. |

### List your products (`list_products`)

_Reads_

The products (apps, sites or brands) on your account. Every campaign is for one of them. REST: [`GET /products`](https://yapfactory.com/developers/api/list_products.md).

No inputs.

### List campaigns (`list_campaigns`)

_Reads_

Your campaigns with status (draft, live, paused, closed), price per video and how many creators are invited, working or done. REST: [`GET /campaigns`](https://yapfactory.com/developers/api/list_campaigns.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `"draft" \| "live" \| "paused" \| "closed" \| "any"` | no | Only campaigns in this status. Default `"any"`. |

### Get a campaign (`get_campaign`)

_Reads_

One of your campaigns: the brief, the deal terms, the ranked shortlist of creators (with who asked to join) and every deal on it. REST: [`GET /campaigns/{campaignId}`](https://yapfactory.com/developers/api/get_campaign.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |

### Draft a campaign (`create_campaign_draft`)

_Changes things_

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. REST: [`POST /campaigns`](https://yapfactory.com/developers/api/create_campaign_draft.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `productId` | `uuid` | no | From list_products. |
| `product` | `object` | no | A new product, when productId isn't given. |
| `product.name` | `string` | yes | The product's name. 1 to 80 characters. |
| `product.url` | `url` | no | App Store, Play Store or website link. Up to 500 characters. |
| `product.platform` | `"ios" \| "android" \| "web"` | yes | Where people use it. |
| `product.description` | `string` | no | What it is and who it's for. Up to 2000 characters. |
| `title` | `string` | yes | The campaign's name, as creators see it. 3 to 100 characters. |
| `template` | `"one_video" \| "test_openings" \| "ad_bundle"` | no | one_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"`. |
| `videos` | `integer` | no | Videos per creator (overrides the template). 1 to 20. |
| `adRights` | `"organic" \| "paid_3m" \| "paid_6m" \| "paid_12m" \| "paid_forever"` | no | organic = your own channels, no ads. paid_*: how long you can run it as an ad. |
| `targetCountries` | `("GB" \| "US" \| "IE" \| "CA" \| "AU")[]` | no | Where the creators' audiences should be. Left out: your own country. 1 to 5 items. |
| `lengthSeconds` | `15 \| 30 \| 60` | no | How long each video runs. Default `30`. |
| `deadline` | `date` | no | yyyy-mm-dd, at least 5 days away. Default: the template's (2-3 weeks). |
| `brief` | `object` | yes |  |
| `brief.keyMessage` | `string` | no | What the video must get across. Leave out to let the creator decide. Up to 600 characters. |
| `brief.hooks` | `string[]` | no | Opening lines to try. Leave out to let the creator decide. Up to 5 items. |
| `brief.cta` | `string` | no | Closing call to action. Leave out to let the creator decide. Up to 200 characters. |
| `brief.dos` | `string[]` | no | Things the video should do. Up to 8 items. |
| `brief.donts` | `string[]` | no | Things it must not do or say. Up to 8 items. |
| `brief.exampleVideoUrl` | `url` | no | A video in the style you want. Up to 500 characters. |

### Edit a campaign brief (`update_campaign_brief`)

_Changes things_

Change the creative brief of a draft or paused campaign (title, message, openings, call to action, dos and don'ts). Only the fields sent change: a field sent replaces what was there, and fields left out keep their value. A live campaign has to be paused before its brief can change. REST: [`PATCH /campaigns/{campaignId}/brief`](https://yapfactory.com/developers/api/update_campaign_brief.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |
| `title` | `string` | no | The campaign's name, as creators see it. 3 to 100 characters. |
| `keyMessage` | `string` | no | The one thing the video should get across. Up to 600 characters. |
| `hooks` | `string[]` | no | Opening lines to use. Replaces the whole list. Up to 5 items. |
| `cta` | `string` | no | What the viewer should do at the end. Up to 200 characters. |
| `dos` | `string[]` | no | Things the video should do. Replaces the whole list. Up to 8 items. |
| `donts` | `string[]` | no | Things it must not do or say. Replaces the whole list. Up to 8 items. |

### Publish a campaign (`publish_campaign`)

_Changes things · Tells other people_

Make a draft campaign live: matching creators see the brief and can ask to join. Free; nothing is charged until you start a deal. For use once the person has agreed to go live. REST: [`POST /campaigns/{campaignId}/publish`](https://yapfactory.com/developers/api/publish_campaign.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |

### Pause, resume or close a campaign (`set_campaign_status`)

_Changes things · Tells other people · Can't be undone_

Pause a live campaign (hidden from new creators), resume it, or close it (creators who asked are told it closed). Deals already running carry on. A draft goes live through publish_campaign. For use once the person has agreed. REST: [`POST /campaigns/{campaignId}/status`](https://yapfactory.com/developers/api/set_campaign_status.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |
| `status` | `"live" \| "paused" \| "closed"` | yes | paused: hidden from new creators. live: resume a paused or closed campaign. closed: finished; creators who asked are told. |

### Invite creators (`invite_creators`)

_Changes things · Tells other people_

Invite hand-picked creators to a live campaign: up to 8 per campaign in all. Invites are free; each creator gets the offer and has 2 days to say yes. You only pay when you start a deal with someone who said yes (on yapfactory.com). The result lists who was invited and who couldn't be, with why. For use once the person has agreed the list. REST: [`POST /campaigns/{campaignId}/invites`](https://yapfactory.com/developers/api/invite_creators.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |
| `creatorIds` | `uuid[]` | yes | Creator ids from search_creators or get_campaign. 1 to 8 items. |

### Pass on a creator (`pass_on_creator`)

_Changes things · Tells other people · Can't be undone_

Say "Not this time" to a creator who said yes but you won't start a deal with. They're told politely, and it can't be taken back. Only for deals not yet started. For use once the person has agreed. REST: [`POST /deals/{dealId}/pass`](https://yapfactory.com/developers/api/pass_on_creator.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `dealId` | `uuid` | yes | The deal's id. |
| `reason` | `string` | no | A short, kind reason. The creator sees it. Up to 500 characters. |

### Ask for changes to a draft (`request_revision`)

_Changes things · Tells other people · Can't be undone_

Send a draft back with notes, once the person has agreed them. Uses one of the included revision rounds (get_deal says how many are left). Once they're used, another round is paid and can only be asked for on the deal page: this returns the link instead. Approving a draft pays the creator, so that happens on the deal page too. REST: [`POST /deals/{dealId}/revisions`](https://yapfactory.com/developers/api/request_revision.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `dealId` | `uuid` | yes | The deal's id. |
| `notes` | `string` | yes | What to change, specifically. 10 to 4000 characters. |

### List accounts you can post to (`list_post_accounts`)

_Reads_

The brand's own TikTok and Instagram accounts connected to Yap Factory that can take a scheduled post now, with what each allows (post directly, or send to TikTok drafts). Connect accounts on yapfactory.com under Accounts. REST: [`GET /posts/accounts`](https://yapfactory.com/developers/api/list_post_accounts.md).

No inputs.

### Get posting options for an account (`get_post_account`)

_Reads_

Live posting options for one account, straight from TikTok or Instagram: its name, who a post can be shown to (TikTok audiences), whether comments, Duet and Stitch can be on, the longest video, and whether it can post right now. Scheduling to a TikTok account needs these options, and the audience is the person's choice. REST: [`GET /posts/accounts/{accountId}`](https://yapfactory.com/developers/api/get_post_account.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | `uuid` | yes | The account's id. |

### List videos you can post (`list_postable_videos`)

_Reads_

Finished videos the brand may post: approved videos from completed deals. An id from here is the video for schedule_post; prepare_post_upload is for posting your own file. REST: [`GET /posts/videos`](https://yapfactory.com/developers/api/list_postable_videos.md).

No inputs.

### Upload your own video or photo to post (`prepare_post_upload`)

_Changes things_

Get a one-time upload link for a video (MP4 or MOV, up to 300 MB) or photo (JPG) to post on one of the brand's accounts. The file goes to uploadUrl with the given method and headers, and the returned upload object is what schedule_post takes. Only for clients that can send files. REST: [`POST /posts/uploads`](https://yapfactory.com/developers/api/prepare_post_upload.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `accountId` | `uuid` | yes | The account the file is for. |
| `filename` | `string` | yes | The file's name, with its extension. 1 to 200 characters. |
| `contentType` | `string` | yes | video/mp4, video/quicktime or image/jpeg. |
| `sizeBytes` | `integer` | yes | The file's size in bytes. Up to 9007199254740991. |

### Schedule a post (`schedule_post`)

_Changes things · Tells other people_

Schedule a video or photos to go out on one or more of the brand's own TikTok and Instagram accounts at a set time (at least 10 minutes and at most 60 days ahead). It posts publicly at that time, so it is for use once the person has seen the account, video, caption, time and (TikTok) audience and agreed. For TikTok the audience is the person's own choice from get_post_account. Not for creators' accounts. REST: [`POST /posts`](https://yapfactory.com/developers/api/schedule_post.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `accounts` | `object[]` | yes | The accounts to post to, from list_post_accounts. 1 to 10 items. |
| `accounts[].accountId` | `uuid` | yes | The account's id. |
| `accounts[].mode` | `"direct" \| "drafts"` | no | direct posts it; drafts sends it to the TikTok app's drafts for the person to finish (TikTok only). Default `"direct"`. |
| `media` | `({ deliverableId } \| { upload })[]` | yes | One video, one photo, or several photos (a carousel), in order. 1 to 35 items. |
| `caption` | `string` | no | The words under the post, hashtags included. Up to 2200 characters. Default `""`. |
| `publishAt` | `datetime` | yes | When it goes out, ISO 8601 with a time zone, e.g. 2026-12-10T18:00:00Z. |
| `timeZone` | `string` | no | The person's IANA time zone, for how times are shown to them, e.g. Europe/London. Up to 60 characters. Default `"UTC"`. |
| `tiktok` | `object` | no | Needed when posting directly to a TikTok account. |
| `tiktok.privacy` | `"PUBLIC_TO_EVERYONE" \| "MUTUAL_FOLLOW_FRIENDS" \| "FOLLOWER_OF_CREATOR" \| "SELF_ONLY"` | yes | Who can see it: the person's choice, from get_post_account. |
| `tiktok.allowComments` | `boolean` | no | Let people comment, if get_post_account says the account allows it. Default `false`. |
| `tiktok.allowDuet` | `boolean` | no | Let people Duet it (videos only). Default `false`. |
| `tiktok.allowStitch` | `boolean` | no | Let people Stitch it (videos only). Default `false`. |
| `tiktok.disclose` | `boolean` | no | Disclose commercial content. Default `false`. |
| `tiktok.yourBrand` | `boolean` | no | Promotional content for your own brand. Default `false`. |
| `tiktok.brandedContent` | `boolean` | no | A paid partnership for another brand (can't be Only me). Default `false`. |
| `instagram` | `object` | no |  |
| `instagram.shareToFeed` | `boolean` | no | Reels also show in the main feed. Default `true`. |

### List scheduled posts (`list_posts`)

_Reads_

The brand's posts across its accounts: what's coming up, what went live (with its link) and anything that needs the person (a failed post says why). Defaults to the last 7 days and everything ahead. REST: [`GET /posts`](https://yapfactory.com/developers/api/list_posts.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `"upcoming" \| "live" \| "needs_action" \| "all"` | no | upcoming: not out yet. live: posted. needs_action: stopped and needs the person. Default `"all"`. |
| `from` | `datetime` | no | Start of the range (default: 7 days ago). |
| `to` | `datetime` | no | End of the range (default: 60 days ahead). |

### Change a scheduled post (`update_post`)

_Changes things_

Change the caption or time of a post that hasn't gone out. For use once the person has agreed the change. REST: [`PATCH /posts/{postId}`](https://yapfactory.com/developers/api/update_post.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `postId` | `uuid` | yes | The post's id. |
| `caption` | `string` | no | The new caption. Up to 2200 characters. |
| `publishAt` | `datetime` | no | The new time, ISO 8601 with a time zone, 10 minutes to 60 days ahead. |

### Cancel a scheduled post (`cancel_post`)

_Changes things · Can't be undone_

Cancel a post that hasn't gone out, so it never posts. It can't be undone, though the post can be scheduled again. A post that's already live has to be deleted in TikTok or Instagram. REST: [`POST /posts/{postId}/cancel`](https://yapfactory.com/developers/api/cancel_post.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `postId` | `uuid` | yes | The post's id. |

## Creators

Only on a creator account.

### Browse campaigns (`browse_campaigns`)

_Reads_

Live campaigns you could work on, with what each pays you, its fit with your profile and the brand's rating. REST: [`GET /marketplace/campaigns`](https://yapfactory.com/developers/api/browse_campaigns.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | `string` | no | Words to look for in the product or brief. Up to 100 characters. |
| `category` | `string` | no | Only this product category, e.g. Health & Fitness. Up to 60 characters. |
| `country` | `string` | no | Only campaigns for this audience country, e.g. US. Up to 10 characters. |
| `sort` | `"fit" \| "newest" \| "pay" \| "rating"` | no | fit: best match for your profile first. pay: what you'd earn, highest first. rating: best rated brands first. Default `"fit"`. |
| `page` | `integer` | no | 1 to 50. Default `1`. |

### Read a campaign brief (`view_campaign_brief`)

_Reads_

A live campaign's full brief as a creator sees it: what to make, the deadline, the ad rights, what it pays you line by line, and whether you can ask to join. REST: [`GET /marketplace/campaigns/{campaignId}`](https://yapfactory.com/developers/api/view_campaign_brief.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |

### Ask to join a campaign (`ask_to_join`)

_Changes things · Tells other people_

Tell the brand you'd like to make this campaign. You go on their shortlist; some brands invite straight away. Free, no limit. For use once the person has agreed. REST: [`POST /marketplace/campaigns/{campaignId}/ask`](https://yapfactory.com/developers/api/ask_to_join.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `campaignId` | `uuid` | yes | The campaign's id. |

### Answer an invite (`respond_to_invite`)

_Changes things · Tells other people · Can't be undone_

Say yes ("I'm in") or no to a brand's invite. A yes commits you to the offer if the brand starts the deal within 3 days. For use once the person has agreed. REST: [`POST /deals/{dealId}/answer`](https://yapfactory.com/developers/api/respond_to_invite.md).

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `dealId` | `uuid` | yes | The deal's id. |
| `accept` | `boolean` | yes | true: I'm in. false: not this time. |
| `reason` | `string` | no | When declining, a short reason for the brand. Up to 500 characters. |

## Also on the server

### How to use Yap Factory well (`get_usage_instructions`)

_Everyone · Reads_

Returns the server's rules for working on someone's account: what needs their OK first, what happens on the website, and how amounts and links work. The same text the server sends as its instructions, for apps that don't pass those to the model. No inputs, and no REST twin.

### Prompts

Ready-made workflows a person can pick in apps that support MCP prompts. Each gives the assistant the steps and the rules.

| Prompt | For | What it does |
| --- | --- | --- |
| `run_campaign` | Brands | Plan, draft and publish a campaign, then line up creators. Not for checking on deals already running (use check_deals). |
| `find_creators` | Brands | Shortlist and invite creators for one live campaign. Not for writing the brief (use run_campaign). |
| `check_deals` | Brands | Go through open deals and say what's waiting on me: creators who said yes, drafts to review, messages. Not for starting new campaigns. |
| `write_brief` | Brands | Turn a product and a goal into a short creator brief, and save it to a draft. Not for publishing or inviting. |
| `schedule_posts` | Brands | Plan and schedule finished videos to the brand's own TikTok and Instagram accounts. Not for finding creators or reviewing drafts. |
| `find_work` | Creators | Browse live campaigns, read the briefs that fit and ask to join. Not for answering invites (use answer_invites). |
| `answer_invites` | Creators | Go through invites from brands and answer them with me. Not for finding new campaigns (use find_work). |

---

HTML version: https://yapfactory.com/developers/tools


---

<!-- https://yapfactory.com/developers/statuses.md -->

# Deals and statuses

> A deal is one creator making the videos for one campaign. This is every status it can be in, who moves next, and what your integration can do there.

## How a deal runs

1. The brand publishes a campaign. Matching creators are ranked into a shortlist, and creators can also ask to join.
2. The brand invites creators with `invite_creators`. Each invite is a deal with status `invited`.
3. The creator says yes with `respond_to_invite`. The deal is `accepted`.
4. The brand starts the deal on yapfactory.com. Their card is charged and the payment is held. The deal is `funded`.
5. The creator films and uploads a draft on yapfactory.com. The deal is `draft_submitted`.
6. The brand asks for changes with `request_revision`, or approves on yapfactory.com. Approving pays the creator.
7. The deal is `completed`, and `schedule_post` can send the video to the brand's own accounts.

> Three steps always happen on yapfactory.com, never through the API: starting a deal (charges the brand), approving a draft (pays the creator) and uploading a draft. `start_deal` and `approve_draft` return the link to show the person.

## Deal statuses

| Status | What it means | Who moves next | From the API |
| --- | --- | --- | --- |
| `invited` | The brand invited the creator. The invite lasts 2 days. | Creator | `respond_to_invite` (creator) |
| `declined` | The creator said no, or the invite ran out. | Nobody | `invite_creators` again re-opens the same deal |
| `accepted` | The creator said yes. The brand has 3 days to start the deal. Nothing is charged yet. | Brand | `start_deal` returns the link; `pass_on_creator` says not this time |
| `funded` | The brand started the deal. Payment is held by Yap Factory, and the creator films. | Creator | `send_deal_message` |
| `draft_submitted` | A draft is waiting for the brand's review. After 3 days without an answer it's approved automatically. | Brand | `request_revision`; `approve_draft` returns the link |
| `revision_requested` | The brand sent the draft back with notes. The creator uploads a new version. | Creator | `send_deal_message` |
| `reshoot_offered` | Only on older deals: a paid re-record was offered. | Brand | Read only |
| `draft_approved` | The brand approved the draft. The creator is paid and the final file is released. | Nobody | Read only |
| `posted` | Delivered and posted (campaigns that include posting). | Nobody | Read only |
| `completed` | Done. The video is in the brand's library. | Nobody | `list_postable_videos`, `schedule_post` |
| `stalled` | A draft is overdue. One upload puts the deal back in review. | Creator | `send_deal_message` |
| `cancelled` | Called off: the brand passed or cancelled, or a payment never came. | Nobody | Read only |
| `disputed` | One side asked Yap Factory to step in. We decide and both sides are told. | Yap Factory | Read only |

`list_deals` with `status=open` leaves out `declined`, `completed` and `cancelled`. `get_deal` returns `nextStep`, a sentence that says what happens next in the person's own words, so show that instead of writing your own.

Every status change sends a `deal.updated` [webhook](https://yapfactory.com/developers/webhooks.md) with `status` and `previousStatus`.

## Campaign statuses

| Status | What it means |
| --- | --- |
| `draft` | Only the brand can see it. The brief can be changed freely. |
| `live` | Creators can see it and ask to join. The brand can invite. |
| `paused` | Hidden from creators. Deals already under way carry on. |
| `closed` | Finished. Deals already under way carry on. |

`publish_campaign` takes a draft live. `set_campaign_status` moves between `live`, `paused` and `closed`.

## Campaign templates

| Template | What the creator makes | Where the brand can use it |
| --- | --- | --- |
| `one_video` | 1 video | The brand's own channels, no ads |
| `test_openings` | 1 video with 3 different openings | The brand's own channels, no ads |
| `ad_bundle` | 3 videos | Paid ads for 3 months |

## Scheduled post statuses

| Status | What it means |
| --- | --- |
| `awaiting_approval` | Waiting for the brand to approve it on yapfactory.com. |
| `changes_asked` | The brand asked for changes before it goes out. |
| `scheduled` | Will go out at `publishAt`. |
| `publishing` | Being sent to TikTok or Instagram now. |
| `in_drafts` | Sent to the account's TikTok drafts. The person finishes it in the TikTok app. |
| `live` | Posted. `postUrl` has the link. |
| `needs_action` | Stopped. `problem` says why, and the person fixes it on yapfactory.com. |
| `missed` | Its time passed before it was approved. |
| `cancelled` | Cancelled before it went out. |

`list_posts` with `status=upcoming` returns everything that hasn't gone out yet. `post.published` and `post.failed` webhooks tell you when one lands or stops.

## The next step: `gettingStarted`

[`GET /me`](https://yapfactory.com/developers/api/get_account.md) (the `get_account` tool) returns `gettingStarted`: the one next thing worth doing, as `{ step, say, url }`, or `null` when nothing is waiting. `say` is a sentence for the person; `url` is there when the step happens on yapfactory.com.

| `step` | Who | Means |
| --- | --- | --- |
| `confirm_email` | Everyone | The email isn't confirmed yet. Nothing that acts works until it is. |
| `start_deal` | Brand | A creator said yes. Start the deal on its page to secure payment. |
| `review_draft` | Brand | A draft is waiting for review. |
| `create_campaign` | Brand | No campaigns yet: draft the first one. |
| `publish_campaign` | Brand | There are drafts but nothing live. |
| `invite_creators` | Brand | A campaign is live with nobody invited. |
| `answer_invite` | Creator | A brand's invite is waiting for a yes or no. |
| `upload_draft` | Creator | Payment is secured, or changes were asked for: film and upload on the deal page. |
| `browse_campaigns` | Creator | No open deals: look for campaigns to make. |
| `finish_profile`, `finish_onboarding` | Everyone | Sign-up isn't finished on yapfactory.com. |

---

HTML version: https://yapfactory.com/developers/statuses


---

<!-- https://yapfactory.com/developers/errors.md -->

# Errors

> Every error has the same shape and a fixed status for each code. Branch on `code`. Show `message` to people.

## The shape

```json
{
  "error": {
    "code": "insufficient_scope",
    "message": "This key can only read. Make one that can act in Settings → AI agents.",
    "requestId": "req_8fK2mQ9xLp3VtR7nYc1B",
    "meta": {
      "required": "campaigns:write"
    }
  }
}
```

- **`code`** is stable. Write your logic against it.
- **`message`** is a sentence written for the person, and safe to show them. It can change, so never parse it.
- **`requestId`** is `req_` and 20 letters and digits. Every response, success or not, also sends it as the `Request-Id` header. Log it.
- **`meta`** is there when there's more to say, such as `meta.issues` for a failed validation or `meta.required` for a missing scope.

## Codes

| Code | Status | What it means | What to do |
| --- | --- | --- | --- |
| `invalid_request` | 400 | Bad JSON, a field that failed validation or that we don't know (`meta.issues`), an unknown query parameter, or no `Idempotency-Key` on an outbound call. | Fix the request. Don't retry it as it is. |
| `unauthorized` | 401 | The token is missing, wrong, expired or revoked, or it's a key from the other environment. | Refresh the OAuth token, or check the key and the host. The message names the right host for a key. |
| `insufficient_scope` | 403 | The token lacks the scope. `meta.required` names it, and `WWW-Authenticate` carries `scope=`. | Ask the person to connect again with that scope, or make a key that can act. |
| `forbidden` | 403 | Never allowed for this account: the wrong side (a creator calling a brand operation), email not confirmed, or the account is paused. | Show the message. The person sorts it out on yapfactory.com. |
| `not_found` | 404 | It doesn't exist, or it isn't yours. We never say which. | Check the id. Don't retry. |
| `conflict` | 409 | Its state doesn't allow this, such as editing a live brief. Also a request whose `Idempotency-Key` is still running. | Show the message, which is written for people. Read the thing again before deciding what to do. If `meta.handoff` is there, the step happens on yapfactory.com: give the person `meta.handoff.url`. |
| `idempotency_conflict` | 409 | The same `Idempotency-Key` came with a different body. | Use a new key for a new request. |
| `rate_limited` | 429 | Over the limit for this connection, or for the person across all their connections. | Wait `Retry-After` seconds, then retry. |
| `internal` | 500 | Our fault. | Retry with backoff. If it keeps happening, send us the `requestId`. |

## Validation errors

A `400 invalid_request` from a failed validation lists each problem in `meta.issues`, with the field's path, so you can point at the right input. A field we don't know is a problem too, so a typo never passes quietly.

```json
{
  "error": {
    "code": "invalid_request",
    "message": "Unknown field: brief.key_message. See https://yapfactory.com/developers/api/create_campaign_draft.",
    "requestId": "req_8fK2mQ9xLp3VtR7nYc1B",
    "meta": {
      "issues": [
        {
          "path": "brief.key_message",
          "message": "Unknown field"
        }
      ]
    }
  }
}
```

## Retrying

- Retry `429` after `Retry-After`, and `500` with backoff. Nothing else gets better by retrying.
- Send the same `Idempotency-Key` when you retry a `POST`, `PATCH` or `DELETE`. Then a retry can never do the thing twice. See [idempotency](https://yapfactory.com/developers/pagination.md#idempotency).

## On the MCP server

Tools return the same `message` as an `isError` result, so the assistant can tell the person what went wrong in plain words. There are no status codes or `code` values to branch on there: the sentence is the error.

Stuck? Email [support@yapfactory.com](mailto:support@yapfactory.com) with the `requestId`.

---

HTML version: https://yapfactory.com/developers/errors


---

<!-- https://yapfactory.com/developers/pagination.md -->

# Pagination, idempotency and limits

> Three rules every call follows: lists page with a cursor, retries are safe with an `Idempotency-Key`, and each connection has a limit per minute.

## Pagination

Lists come back like this. Any summary fields go in `meta`.

```json
{
  "data": [ { … }, { … } ],
  "nextCursor": "eyJvIjoyMH0",
  "hasMore": true
}
```

- `?limit=` runs from 1 to 50. The default is 20.
- Every list pages this way, to the end. `GET /creators` and `GET /marketplace/campaigns` are ranked afresh on each call, so a creator can move between pages while you read: dedupe on `id`.
- `?cursor=` takes the `nextCursor` from the page before. Treat it as opaque: don't build or change one.
- Stop when `hasMore` is false. Then `nextCursor` is `null`.

Node:

```js
let cursor = null;
do {
  const url = new URL("https://yapfactory.com/api/v1/deals");
  url.searchParams.set("limit", "50");
  if (cursor) url.searchParams.set("cursor", cursor);
  const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.YAP_API_KEY}` } });
  const page = await res.json();
  for (const deal of page.data) console.log(deal.id);
  cursor = page.hasMore ? page.nextCursor : null;
} while (cursor);
```

Python:

```python
import os, requests

headers = {"Authorization": f"Bearer {os.environ['YAP_API_KEY']}"}
cursor = None
while True:
    params = {"limit": 50, **({"cursor": cursor} if cursor else {})}
    page = requests.get("https://yapfactory.com/api/v1/deals", headers=headers, params=params).json()
    for deal in page["data"]:
        print(deal["id"])
    if not page["hasMore"]:
        break
    cursor = page["nextCursor"]
```

## Idempotency

Networks drop answers. An `Idempotency-Key` lets you retry without doing the thing twice.

- Send an `Idempotency-Key` header, 8 to 200 characters, on any `POST`, `PATCH` or `DELETE`. A UUID is ideal.
- It's **required** on `outbound` operations, the ones that tell other people (publishing, inviting, answering, messaging, scheduling a post). Without one they return `400`.
- A success is stored for 24 hours. The same key with the same body returns that stored response, with the header `Idempotent-Replayed: true`, and nothing runs again.
- A failure isn't stored. Send the same key again once whatever stopped it has changed, and it runs then.
- The same key with a different body returns `409 idempotency_conflict`.
- The same key while the first request is still running returns `409 conflict`. Wait a moment and send it again.
- Keys belong to the connection (the OAuth grant or the API key), so two apps can't collide.

```bash
curl -X POST "https://yapfactory.com/api/v1/campaigns/$CAMPAIGN_ID/publish" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: 4f1c2b0e-7d4a-4f43-9a51-0c6a1b9e2d7f"
```

## Rate limits

Limits are counted every minute, per connection and per person. The REST API and the MCP server share them.

| What | Each connection | All of a person's connections |
| --- | --- | --- |
| Reads | 120 a minute | 300 a minute |
| Changes (`write` and `outbound`) | 20 a minute | 40 a minute |
| `outbound` alone | 10 a minute | 15 a minute |

Every response from an operation carries these, counted for the connection:

| Header | Means |
| --- | --- |
| `RateLimit-Limit` | The limit for this kind of call. |
| `RateLimit-Remaining` | Calls left in this window. |
| `RateLimit-Reset` | Seconds until the window resets. |
| `Retry-After` | On a `429` only: seconds to wait before trying again. |

Some things have their own limits, the same as on the site, such as 8 hand-picked creators per campaign. Past one, the call returns `409 conflict` with a sentence that says so.

## Versions

- The version is in the path: `/api/v1`. Within v1 we only add: new operations, new optional inputs, new fields in a response, new webhook event types and new values for a status. Write code that ignores what it doesn't know.
- Anything that would break working code (removing or renaming a field, changing a type, tightening an input) waits for `/api/v2`. We'd run v1 beside it for at least 12 months and email everyone with a live key or connection.
- Every change is in the [changelog](https://yapfactory.com/developers/changelog.md).

## Keys belong on a server

Never put an API key in a web page or a mobile app: anyone can read it there. The API answers browsers (CORS is open) so that apps using OAuth can call it with a person's own token; keys are for your server and your scripts. If a key gets out, revoke it in **Settings → AI agents** and make a new one.

## Formats

- **Money** is `{ "minor": 1500, "currency": "USD", "formatted": "$15.00" }`. Integer minor units (pence or cents) everywhere, never decimals.
- **Times** are ISO 8601 strings in UTC.
- **Ids** are UUIDs.

---

HTML version: https://yapfactory.com/developers/pagination


---

<!-- https://yapfactory.com/developers/webhooks.md -->

# Webhooks

> Hear about asks, yeses, drafts, deals and posts the moment they happen, instead of polling. Every delivery is signed, so you know it came from us.

## Set up an endpoint

1. Open **Settings → Webhooks** on yapfactory.com.
2. Add an `https` URL and pick the events you want, or all of them (`*`).
3. Copy the signing secret. It starts with `whsec_` and is shown once.
4. Press **Send test event** to get a `ping` and check your code.

You can have up to 5 endpoints. An event goes to the endpoints of everyone on the deal or campaign it's about: the brand and the creator.

- The URL must be public `https`. Addresses on private networks are refused.
- We don't follow redirects: a `3xx` answer counts as a failed try. Give the final URL.
- Endpoints are set up in Settings for now; there's no API for them yet.

## Events

| Type | Sent to | When |
| --- | --- | --- |
| `deal.updated` | Both sides | Every deal status change (`status`, `previousStatus`) |
| `deal.invited` | Creator | A brand invited you |
| `invite.accepted` | Brand | A creator said yes |
| `invite.declined` | Brand | A creator said no |
| `invite.expired` | Both sides | An invite ran out |
| `deal.started` | Both sides | The brand started the deal and payment is secured |
| `draft.submitted` | Brand | A draft or a new version is ready to review |
| `revision.requested` | Creator | The brand sent the draft back |
| `draft.approved` | Both sides | Approved, or approved automatically when the review window ran out |
| `deal.completed` | Both sides | The deal is done |
| `deal.cancelled` | Both sides | The deal was cancelled |
| `ask.received` | Brand | A creator asked to join a campaign |
| `message.received` | The other side | A new message on a deal |
| `campaign.published` | Brand | A campaign went live |
| `post.published` | Brand | A scheduled post went live (`data.postId`, `data.postUrl`) |
| `post.failed` | Brand | A scheduled post stopped and needs the person (`data.postId`, `data.reason`) |
| `ping` | The endpoint | A test event from Settings |

## The payload

Payloads are thin. An event says what changed and carries ids; call the API for the details. A payload never contains a creator's handle or contact details.

```json
{
  "id": "evt_…",
  "type": "deal.updated",
  "createdAt": "2026-12-03T10:00:00.000Z",
  "livemode": true,
  "data": {
    "dealId": "…",
    "campaignId": "…",
    "status": "funded",
    "previousStatus": "accepted",
    "url": "https://yapfactory.com/deals/…"
  }
}
```

- `id` stays the same across retries and replays. Use it to dedupe.
- `livemode` is `false` for events from test sites.
- `data.url` is the page on yapfactory.com for the deal, campaign or post.

### What `data` carries

| Events | `data` |
| --- | --- |
| `deal.updated`, `invite.accepted`, `invite.declined`, `invite.expired`, `deal.started`, `revision.requested`, `draft.approved`, `deal.completed`, `deal.cancelled` | `dealId`, `campaignId`, `status`, `previousStatus`, `url` |
| `deal.invited` | `dealId`, `campaignId`, `status` (`invited`), `url` |
| `draft.submitted` | `dealId`, `campaignId`, `status` (`draft_submitted`), `version` (1 for the first draft), `url` |
| `message.received` | `dealId`, `campaignId`, `status`, `messageId`, `from` (`brand` or `creator`), `url`. The words aren't in the event: read them with [`get_deal`](https://yapfactory.com/developers/api/get_deal.md). |
| `ask.received` | `campaignId`, `status`, `creatorId`, `url` |
| `campaign.published` | `campaignId`, `status` (`live`), `url` |
| `post.published` | `postId`, `postUrl` (the post on TikTok or Instagram, or `null`), `url` |
| `post.failed` | `postId`, `reason` (a sentence for the person), `url` |
| `ping` | `endpointId`, `message` |

One change often sends two events: `deal.updated` for the status change, and the named one (`invite.accepted`, `deal.started`…) for what it means. Subscribe to `deal.updated` alone to follow every status, or to the named ones to act on moments. The statuses are in [Deals and statuses](https://yapfactory.com/developers/statuses.md). New fields and event types can be added at any time: ignore what you don't know.

## Headers

Each delivery is a `POST` with `Content-Type: application/json` and these headers:

| Header | Value |
| --- | --- |
| `Yap-Event-Id` | The event's `id`, such as `evt_…`. |
| `Yap-Event-Type` | The event's `type`, such as `draft.submitted`. |
| `Yap-Signature` | `t=<unix seconds>,v1=<hex HMAC-SHA256>` |

## Check the signature

1. Read `t` and `v1` from `Yap-Signature`.
2. Reject it if `t` is more than 5 minutes from now. That stops replays.
3. Compute HMAC-SHA256 of `"<t>.<raw body>"` with your secret, as hex.
4. Compare it with `v1` in constant time.

> Use the raw body, byte for byte. Parsing the JSON and writing it out again changes it, and the check fails.

Node:

```js
import crypto from "node:crypto";

const TOLERANCE_S = 5 * 60;

/** rawBody: the request body exactly as it arrived, before any JSON parsing. */
export function verifyYapSignature(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const t = Number(parts.t);
  if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > TOLERANCE_S) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  const given = Buffer.from(parts.v1 ?? "", "utf8");
  const want = Buffer.from(expected, "utf8");
  return given.length === want.length && crypto.timingSafeEqual(given, want);
}

// Express: keep the raw body for this route.
app.post("/webhooks/yap", express.raw({ type: "application/json" }), (req, res) => {
  const raw = req.body.toString("utf8");
  if (!verifyYapSignature(raw, req.get("Yap-Signature") ?? "", process.env.YAP_WEBHOOK_SECRET)) {
    return res.status(400).end();
  }
  const event = JSON.parse(raw);
  // Seen event.id before? Answer 200 and stop.
  res.status(200).end();
  queueWork(event); // do the slow part after answering
});
```

Python:

```python
import hashlib, hmac, json, os, time

TOLERANCE_S = 5 * 60

def verify_yap_signature(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
    try:
        t = int(parts.get("t", ""))
    except ValueError:
        return False
    if abs(time.time() - t) > TOLERANCE_S:
        return False
    signed = f"{t}.".encode() + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))

# Flask
@app.post("/webhooks/yap")
def yap_webhook():
    raw = request.get_data()  # the raw bytes, before parsing
    if not verify_yap_signature(raw, request.headers.get("Yap-Signature", ""), os.environ["YAP_WEBHOOK_SECRET"]):
        return "", 400
    event = json.loads(raw)
    # Seen event["id"] before? Answer 200 and stop.
    return "", 200
```

Go:

```go
package webhooks

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"math"
	"strconv"
	"strings"
	"time"
)

const tolerance = 5 * time.Minute

// VerifyYapSignature checks the Yap-Signature header against the raw request body.
func VerifyYapSignature(rawBody []byte, header, secret string) bool {
	var ts, sig string
	for _, part := range strings.Split(header, ",") {
		k, v, ok := strings.Cut(part, "=")
		if !ok {
			continue
		}
		switch k {
		case "t":
			ts = v
		case "v1":
			sig = v
		}
	}
	t, err := strconv.ParseInt(ts, 10, 64)
	if err != nil || math.Abs(float64(time.Now().Unix()-t)) > tolerance.Seconds() {
		return false
	}
	mac := hmac.New(sha256.New, []byte(secret))
	mac.Write([]byte(ts + "."))
	mac.Write(rawBody)
	expected := hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(sig))
}
```

## Answer fast

Any `2xx` within 10 seconds counts as delivered. Answer first, then do the slow work in the background. Anything else, or no answer, is a failed try.

## Retries

A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours: 7 tries in about 21 hours. After that it's marked `failed`.

After 20 deliveries fail in a row, we turn the endpoint off and email you.

Retries can arrive out of order, and the same event can arrive twice. Dedupe on `Yap-Event-Id`, and read the current state from the API when order matters.

## Delivery log, replay and test events

- **Settings → Webhooks** shows the last 50 deliveries for each endpoint: status, tries and the response code you sent.
- **Replay** any delivery. It's signed again with a fresh `t`, and keeps the same event id.
- **Send test event** sends a `ping`, to check your endpoint and your signature code.

---

HTML version: https://yapfactory.com/developers/webhooks


---

<!-- https://yapfactory.com/developers/changelog.md -->

# Changelog

> What changed in the API, the MCP server and webhooks. Newest first.

## 2 December 2026: API v1, webhooks and the MCP server

- **REST API v1** at `/api/v1`: the same operations as the MCP server, plus handoff links for starting a deal and approving a draft. See the [reference](https://yapfactory.com/developers/api.md).
- **One format** for every response: `{ data }`, lists with `nextCursor` and `hasMore`, and errors with a fixed status per `code` and a `requestId`.
- **Idempotency keys** on every change, required where other people are told. Only a success is stored and replayed.
- **Strict inputs**: a field we don't know returns `400` instead of being dropped.
- **Rate limits per minute**, per connection and per person, with `RateLimit-*` headers and `Retry-After`.
- **Live keys** start with `yf_live_`. Older `yf_` keys keep working. Test keys (`yf_test_`) are for the [sandbox](https://yapfactory.com/developers/sandbox.md), which is coming soon.
- **Scopes per resource**, such as `campaigns:write`, next to `read` and `write`.
- **Webhooks**: signed events for every deal step, asks, campaigns and scheduled posts, with retries for about 21 hours, a delivery log, replay and test events. See [Webhooks](https://yapfactory.com/developers/webhooks.md).
- **Scheduled posts**: brands can schedule videos and photos to their own TikTok and Instagram accounts from the API or an assistant.
- **Creator videos** come with a `watch` link that plays them on Yap Factory, a thumbnail and the view count. The first release returned a `url` on TikTok or Instagram; that field is gone.
- **MCP server** at `/mcp`, for ChatGPT, Claude, Cursor and other clients, and the Claude plugin. See [Connect an assistant](https://yapfactory.com/developers/mcp.md).
- **OpenAPI 3.1** spec at `/api/v1/openapi.json`, and every docs page as Markdown.

---

HTML version: https://yapfactory.com/developers/changelog


---

<!-- https://yapfactory.com/developers/api/get_account.md -->

# Your Yap Factory account

> Who is signed in: brand and/or creator, country and currency, what this connection is allowed to do, and the one next thing worth doing (gettingStarted). Shows which tools apply to this account.

```http
GET https://yapfactory.com/api/v1/me
```

|   |   |
| --- | --- |
| Who can use it | Everyone: brands and creators |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `account:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`get_account`](https://yapfactory.com/developers/tools.md#get_account) |

## Parameters

None.

## Example request

```bash
curl "https://yapfactory.com/api/v1/me" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "name": "Dana Lee",
    "email": "dana@sleepwell.app",
    "country": "US",
    "currency": "USD",
    "sides": [
      "brand"
    ],
    "brand": {
      "company": "Sleepwell",
      "country": "US",
      "paused": false,
      "home": "https://yapfactory.com/brand"
    },
    "creator": null,
    "canAct": true,
    "gettingStarted": {
      "step": "review_draft",
      "say": "Maya R.'s draft is ready to review.",
      "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
    },
    "environment": "live",
    "connection": {
      "app": "API key",
      "kind": "api_key",
      "scopes": [
        "read",
        "write"
      ],
      "manage": "https://yapfactory.com/brand/settings#agents"
    }
  }
}
```

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 `account:read` (or `read`). |
| `forbidden` | 403 | Not allowed for this account, for example while it's paused. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/get_account


---

<!-- https://yapfactory.com/developers/api/list_deals.md -->

# List deals

> Deals you're part of, newest activity first, with each one's status and what happens next. A deal is one creator making videos for one campaign.

```http
GET https://yapfactory.com/api/v1/deals
```

|   |   |
| --- | --- |
| Who can use it | Everyone: brands and creators |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `deals:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`list_deals`](https://yapfactory.com/developers/tools.md#list_deals) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `status` | query | `"open" \| "closed" \| "all"` | no | open: still in progress (default). closed: finished, declined or cancelled. Default `"open"`. |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/deals?status=open&limit=20" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `deals`, and `meta` carries the summary fields. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
      "side": "brand",
      "status": "draft_submitted",
      "open": true,
      "campaign": "Morning routine with Sleepwell",
      "with": "Maya R.",
      "brandPays": {
        "minor": 2750,
        "currency": "USD",
        "formatted": "$27.50"
      },
      "updatedAt": "2026-12-08T16:12:04.000Z",
      "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
    }
  ],
  "nextCursor": null,
  "hasMore": false,
  "meta": {
    "total": 3
  }
}
```

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 `deals:read` (or `read`). |
| `forbidden` | 403 | Not allowed for this account, for example while it's paused. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_deals


---

<!-- https://yapfactory.com/developers/api/get_deal.md -->

# Get a deal

> One deal in full: the offer, status, whose move it is, the latest draft's review state, recent messages and the link to the deal page. Paying, approving a draft and cancelling happen on that page.

```http
GET https://yapfactory.com/api/v1/deals/{dealId}
```

|   |   |
| --- | --- |
| Who can use it | Everyone: brands and creators |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `deals:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`get_deal`](https://yapfactory.com/developers/tools.md#get_deal) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |
| `messages` | query | `integer` | no | How many recent messages to include. 0 to 50. Default `10`. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "you": "brand",
    "status": "draft_submitted",
    "nextStep": "Review the draft by 11 Dec",
    "outcome": null,
    "campaign": {
      "id": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
      "title": "Morning routine with Sleepwell",
      "product": "Sleepwell"
    },
    "with": "Maya R.",
    "offer": {
      "brandPays": {
        "minor": 2750,
        "currency": "USD",
        "formatted": "$27.50"
      },
      "serviceFee": {
        "minor": 250,
        "currency": "USD",
        "formatted": "$2.50"
      },
      "creatorEarns": {
        "minor": 2500,
        "currency": "USD",
        "formatted": "$25.00"
      },
      "lines": [
        {
          "label": "1 × 30s video creation fee",
          "amount": {
            "minor": 2500,
            "currency": "USD",
            "formatted": "$25.00"
          }
        },
        {
          "label": "Licence: Brand's channels, no ads",
          "amount": {
            "minor": 0,
            "currency": "USD",
            "formatted": "$0.00"
          }
        }
      ],
      "adRights": "Brand's channels, no ads",
      "deadline": "2026-12-16T12:00:00.000Z",
      "accessBy": "2026-12-04T12:00:00.000Z",
      "lengthSeconds": 30,
      "revisionRoundsIncluded": 3,
      "revisionsUsed": 0
    },
    "dates": {
      "invited": "2026-12-02T09:39:13.000Z",
      "inviteExpires": "2026-12-05T09:39:13.000Z",
      "accepted": "2026-12-02T14:46:04.000Z",
      "paymentDue": null,
      "funded": "2026-12-03T10:02:10.000Z",
      "draftDue": "2026-12-10T10:02:10.000Z",
      "reviewDue": "2026-12-11T16:12:04.000Z",
      "closed": null
    },
    "paymentSecured": true,
    "latestDraft": {
      "version": 1,
      "submittedAt": "2026-12-08T16:12:04.000Z",
      "review": "pending",
      "notes": null,
      "creatorNote": "Went with the 2am hook.",
      "previewReady": true
    },
    "messages": [
      {
        "from": "Maya",
        "at": "2026-12-08T16:13:20.000Z",
        "text": "Draft is up. Happy to reshoot the opening if you'd like it brighter."
      }
    ],
    "canMessage": true,
    "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "onSiteOnly": "Starting the deal (charges the brand's card), approving a draft (pays the creator), uploading drafts, cancelling and disputes happen on the deal page."
  }
}
```

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 `deals:read` (or `read`). |
| `forbidden` | 403 | Not allowed for this account, for example while it's paused. |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/get_deal


---

<!-- https://yapfactory.com/developers/api/send_deal_message.md -->

# Message the other side of a deal

> Send a message in a deal's chat. The other side gets it in the app (and by email if they allow it). Contact details and off-platform payment talk are blocked. Feedback on a draft goes through request_revision, which gives the creator the notes to work from. For use once the person has agreed the words.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/messages
```

|   |   |
| --- | --- |
| Who can use it | Everyone: brands and creators |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`send_deal_message`](https://yapfactory.com/developers/tools.md#send_deal_message) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |
| `body` | body | `string` | yes | The message, in plain words. No contact details or payment talk. 1 to 2000 characters. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/messages" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Hi Maya, the login for the app is in the brief. Shout if anything is unclear."
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "sent": true,
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `deals:write` (or `write`). |
| `forbidden` | 403 | Not allowed for this account, for example while it's paused. |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/send_deal_message


---

<!-- https://yapfactory.com/developers/api/search_creators.md -->

# Search creators

> Browse UGC creators you can invite: niches, rating, delivery record, rate per video and sample videos (each with a link that plays it on Yap Factory). With campaignId, results are ranked by fit for that campaign. A live campaign's ranked shortlist is already in get_campaign; search finds more or different creators.

```http
GET https://yapfactory.com/api/v1/creators
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `creators:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`search_creators`](https://yapfactory.com/developers/tools.md#search_creators) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `query` | query | `string` | no | Words to match in names, summaries and niches. Up to 100 characters. |
| `niches` | query | `string[]` | no | Only creators in these niches, e.g. skincare, fitness, pets. Up to 10 items. Repeat the parameter, or separate values with commas. |
| `country` | query | `string` | no | ISO country code such as US or GB. Up to 10 characters. |
| `platform` | query | `"tiktok" \| "instagram" \| "youtube"` | no | Only creators with this platform linked. |
| `priceBand` | query | `"new" \| "intermediate" \| "specialist"` | no | Rate per video: new (lowest), intermediate (rising creators) or specialist (established creators). |
| `verifiedOnly` | query | `boolean` | no | Only creators who passed an ID check. |
| `minRating` | query | `number` | no | Only creators rated at least this, out of 5. 0 to 5. |
| `campaignId` | query | `uuid` | no | One of your live campaigns, to rank and show fit for it. |
| `sort` | query | `"relevance" \| "price" \| "rating"` | no | relevance: best fit first (default). price: lowest rate first. rating: best rated first. |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Watching a creator's videos

- **`watch`** opens the video in the Yap Factory player. It works for the signed-in brand; give it to the person, don't fetch it.
- **`thumbnail`** is a still you can show next to the link, and **`views`** is the video's view count.
- There is no TikTok or Instagram link, and no handle. Brands choose a creator by their work, then hire them on Yap Factory.

## Example request

```bash
curl "https://yapfactory.com/api/v1/creators?query=skincare&country=US&limit=10" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `creators`, and `meta` carries the summary fields. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d",
      "name": "Maya R.",
      "summary": "Sleep, wellness and slow mornings. I film in one take.",
      "niches": [
        "wellness",
        "lifestyle"
      ],
      "country": "US",
      "languages": [
        "en"
      ],
      "platforms": [
        "tiktok"
      ],
      "rate": {
        "minor": 2500,
        "currency": "USD",
        "formatted": "$25.00"
      },
      "rating": 4.9,
      "reviews": 12,
      "idVerified": true,
      "completedDeals": 14,
      "onTimeRate": 0.93,
      "brandVideos": 9,
      "medianViews": 23049,
      "reasons": [
        "9 prior brand videos averaging 23k views"
      ],
      "fit": "Makes wellness content",
      "videos": [
        {
          "id": "5d0c9a7e-2b41-4f6a-8c3d-1e9f7a6b5c42",
          "platform": "tiktok",
          "watch": "https://yapfactory.com/c/c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d?video=5d0c9a7e-2b41-4f6a-8c3d-1e9f7a6b5c42",
          "thumbnail": "https://yapfactory.com/api/uploads/social/…/cover.jpg",
          "views": 23049
        }
      ],
      "profile": "https://yapfactory.com/c/c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d"
    }
  ],
  "nextCursor": null,
  "hasMore": false,
  "meta": {
    "page": 1,
    "pages": 4,
    "matched": 85,
    "currency": "USD",
    "focusCampaign": {
      "id": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
      "title": "Morning routine with Sleepwell"
    },
    "note": "Rates are the creator's per video before the Yap Factory service fee. Inviting is free."
  }
}
```

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 `creators:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/search_creators


---

<!-- https://yapfactory.com/developers/api/get_creator.md -->

# Get a creator

> A creator's profile as brands see it: summary, niches, audience, rating, delivery record, rate and their videos per platform. Each video has a `watch` link that plays it on Yap Factory; social handles and links to the creator's own accounts are never included.

```http
GET https://yapfactory.com/api/v1/creators/{creatorId}
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `creators:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`get_creator`](https://yapfactory.com/developers/tools.md#get_creator) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `creatorId` | path | `uuid` | yes | The creator's id. |
| `campaignId` | query | `uuid` | no | One of your campaigns, to see how this creator fits it. |

## Watching a creator's videos

- **`watch`** opens the video in the Yap Factory player. It works for the signed-in brand; give it to the person, don't fetch it.
- **`thumbnail`** is a still you can show next to the link, and **`views`** is the video's view count.
- There is no TikTok or Instagram link, and no handle. Brands choose a creator by their work, then hire them on Yap Factory.

## Example request

```bash
curl "https://yapfactory.com/api/v1/creators/c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d",
    "name": "Maya R.",
    "summary": "Sleep, wellness and slow mornings. I film in one take.",
    "niches": [
      "wellness",
      "lifestyle"
    ],
    "country": "US",
    "audience": "71% US audience",
    "idVerified": true,
    "rating": 4.9,
    "reviews": 12,
    "onTimeRate": 0.93,
    "completedDeals": 14,
    "videosPerWeek": 3,
    "rate": {
      "minor": 2500,
      "currency": "USD",
      "formatted": "$25.00"
    },
    "platforms": [
      {
        "platform": "tiktok",
        "brandVideos": 9,
        "medianViews": 23049,
        "videos": [
          {
            "id": "5d0c9a7e-2b41-4f6a-8c3d-1e9f7a6b5c42",
            "watch": "https://yapfactory.com/c/c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d?video=5d0c9a7e-2b41-4f6a-8c3d-1e9f7a6b5c42",
            "thumbnail": "https://yapfactory.com/api/uploads/social/…/cover.jpg",
            "views": 23049,
            "brandWork": true
          }
        ]
      }
    ],
    "profile": "https://yapfactory.com/c/c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d"
  }
}
```

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 `creators:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such creator, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/get_creator


---

<!-- https://yapfactory.com/developers/api/list_products.md -->

# List your products

> The products (apps, sites or brands) on your account. Every campaign is for one of them.

```http
GET https://yapfactory.com/api/v1/products
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `campaigns:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`list_products`](https://yapfactory.com/developers/tools.md#list_products) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/products" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `products`. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "5d41402a-bc4b-4a76-b971-9e3f2c1d0a8b",
      "name": "Sleepwell",
      "platform": "ios",
      "url": "https://apps.apple.com/app/id0000000000",
      "category": "Health & Fitness",
      "campaigns": 2
    }
  ],
  "nextCursor": null,
  "hasMore": false
}
```

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:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_products


---

<!-- https://yapfactory.com/developers/api/list_campaigns.md -->

# List campaigns

> Your campaigns with status (draft, live, paused, closed), price per video and how many creators are invited, working or done.

```http
GET https://yapfactory.com/api/v1/campaigns
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `campaigns:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`list_campaigns`](https://yapfactory.com/developers/tools.md#list_campaigns) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `status` | query | `"draft" \| "live" \| "paused" \| "closed" \| "any"` | no | Only campaigns in this status. Default `"any"`. |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/campaigns?status=live" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `campaigns`. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
      "title": "Morning routine with Sleepwell",
      "status": "live",
      "product": "Sleepwell",
      "videosPerCreator": 1,
      "budgetPerVideo": {
        "minor": 3000,
        "currency": "USD",
        "formatted": "$30.00"
      },
      "deadline": "2026-12-16T12:00:00.000Z",
      "creators": {
        "shortlisted": 12,
        "invited": 3,
        "saidYes": 1,
        "working": 1,
        "done": 0
      },
      "url": "https://yapfactory.com/brand/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f"
    }
  ],
  "nextCursor": null,
  "hasMore": false
}
```

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:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_campaigns


---

<!-- https://yapfactory.com/developers/api/get_campaign.md -->

# Get a campaign

> One of your campaigns: the brief, the deal terms, the ranked shortlist of creators (with who asked to join) and every deal on it.

```http
GET https://yapfactory.com/api/v1/campaigns/{campaignId}
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `campaigns:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`get_campaign`](https://yapfactory.com/developers/tools.md#get_campaign) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "title": "Morning routine with Sleepwell",
    "status": "live",
    "product": {
      "id": "5d41402a-bc4b-4a76-b971-9e3f2c1d0a8b",
      "name": "Sleepwell",
      "url": "https://apps.apple.com/app/id0000000000"
    },
    "terms": {
      "videosPerCreator": 1,
      "openingsPerVideo": 1,
      "adRights": "Brand's channels, no ads",
      "budgetPerVideo": {
        "minor": 3000,
        "currency": "USD",
        "formatted": "$30.00"
      },
      "targetCountries": [
        "US"
      ],
      "deadline": "2026-12-16T12:00:00.000Z",
      "accessBy": "2026-12-04T12:00:00.000Z",
      "revisionRounds": 3,
      "autoInvite": true
    },
    "brief": {
      "keyMessage": "Sleepwell helps you fall asleep in 10 minutes without your phone.",
      "hooks": [
        "I used to scroll until 2am.",
        "My sleep score went from 52 to 81."
      ],
      "cta": "Try it free tonight.",
      "dos": [
        "Film on your phone, vertical, natural light",
        "Show the app on screen within the first 5 seconds"
      ],
      "donts": [
        "No health or medical claims"
      ],
      "creatorDecides": {},
      "exampleVideoUrl": null
    },
    "shortlist": [
      {
        "creatorId": "c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d",
        "name": "Maya R.",
        "score": 0.92,
        "reasons": [
          "Makes wellness content",
          "71% US audience"
        ],
        "rate": {
          "minor": 2500,
          "currency": "USD",
          "formatted": "$25.00"
        },
        "askedToJoin": false,
        "decision": "yes"
      }
    ],
    "deals": [
      {
        "id": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
        "creator": "Maya R.",
        "status": "draft_submitted",
        "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
      }
    ],
    "url": "https://yapfactory.com/brand/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f"
  }
}
```

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:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/get_campaign


---

<!-- https://yapfactory.com/developers/api/create_campaign_draft.md -->

# 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.

```http
POST https://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`](https://yapfactory.com/developers/tools.md#create_campaign_draft) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `productId` | body | `uuid` | no | From list_products. |
| `product` | body | `object` | no | A new product, when productId isn't given. |
| `product.name` | body | `string` | yes | The product's name. 1 to 80 characters. |
| `product.url` | body | `url` | no | App Store, Play Store or website link. Up to 500 characters. |
| `product.platform` | body | `"ios" \| "android" \| "web"` | yes | Where people use it. |
| `product.description` | body | `string` | no | What it is and who it's for. Up to 2000 characters. |
| `title` | body | `string` | yes | The campaign's name, as creators see it. 3 to 100 characters. |
| `template` | body | `"one_video" \| "test_openings" \| "ad_bundle"` | no | one_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"`. |
| `videos` | body | `integer` | no | Videos per creator (overrides the template). 1 to 20. |
| `adRights` | body | `"organic" \| "paid_3m" \| "paid_6m" \| "paid_12m" \| "paid_forever"` | no | organic = your own channels, no ads. paid_*: how long you can run it as an ad. |
| `targetCountries` | body | `("GB" \| "US" \| "IE" \| "CA" \| "AU")[]` | no | Where the creators' audiences should be. Left out: your own country. 1 to 5 items. |
| `lengthSeconds` | body | `15 \| 30 \| 60` | no | How long each video runs. Default `30`. |
| `deadline` | body | `date` | no | yyyy-mm-dd, at least 5 days away. Default: the template's (2-3 weeks). |
| `brief` | body | `object` | yes |  |
| `brief.keyMessage` | body | `string` | no | What the video must get across. Leave out to let the creator decide. Up to 600 characters. |
| `brief.hooks` | body | `string[]` | no | Opening lines to try. Leave out to let the creator decide. Up to 5 items. |
| `brief.cta` | body | `string` | no | Closing call to action. Leave out to let the creator decide. Up to 200 characters. |
| `brief.dos` | body | `string[]` | no | Things the video should do. Up to 8 items. |
| `brief.donts` | body | `string[]` | no | Things it must not do or say. Up to 8 items. |
| `brief.exampleVideoUrl` | body | `url` | no | A 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 /creators`](https://yapfactory.com/developers/api/search_creators.md) before 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 `review` link opens the page where the person can change them before publishing.

## Example request

```bash
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.

```json
{
  "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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/create_campaign_draft


---

<!-- https://yapfactory.com/developers/api/update_campaign_brief.md -->

# Edit a campaign brief

> Change the creative brief of a draft or paused campaign (title, message, openings, call to action, dos and don'ts). Only the fields sent change: a field sent replaces what was there, and fields left out keep their value. A live campaign has to be paused before its brief can change.

```http
PATCH https://yapfactory.com/api/v1/campaigns/{campaignId}/brief
```

|   |   |
| --- | --- |
| 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 | [`update_campaign_brief`](https://yapfactory.com/developers/tools.md#update_campaign_brief) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |
| `title` | body | `string` | no | The campaign's name, as creators see it. 3 to 100 characters. |
| `keyMessage` | body | `string` | no | The one thing the video should get across. Up to 600 characters. |
| `hooks` | body | `string[]` | no | Opening lines to use. Replaces the whole list. Up to 5 items. |
| `cta` | body | `string` | no | What the viewer should do at the end. Up to 200 characters. |
| `dos` | body | `string[]` | no | Things the video should do. Replaces the whole list. Up to 8 items. |
| `donts` | body | `string[]` | no | Things it must not do or say. Replaces the whole list. Up to 8 items. |

## Example request

```bash
curl -X PATCH "https://yapfactory.com/api/v1/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/brief" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "keyMessage": "Sleepwell helps you fall asleep without your phone.",
    "hooks": [
      "I used to scroll until 2am.",
      "My sleep score went from 52 to 81."
    ]
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "campaignId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "saved": true,
    "url": "https://yapfactory.com/brand/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/edit"
  }
}
```

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). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/update_campaign_brief


---

<!-- https://yapfactory.com/developers/api/publish_campaign.md -->

# Publish a campaign

> Make a draft campaign live: matching creators see the brief and can ask to join. Free; nothing is charged until you start a deal. For use once the person has agreed to go live.

```http
POST https://yapfactory.com/api/v1/campaigns/{campaignId}/publish
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `campaigns:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`publish_campaign`](https://yapfactory.com/developers/tools.md#publish_campaign) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/publish" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "campaignId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "status": "live",
    "url": "https://yapfactory.com/brand/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "next": "Matching creators are being ranked now. Use get_campaign for the shortlist, then invite_creators."
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `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). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/publish_campaign


---

<!-- https://yapfactory.com/developers/api/set_campaign_status.md -->

# Pause, resume or close a campaign

> Pause a live campaign (hidden from new creators), resume it, or close it (creators who asked are told it closed). Deals already running carry on. A draft goes live through publish_campaign. For use once the person has agreed.

```http
POST https://yapfactory.com/api/v1/campaigns/{campaignId}/status
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `campaigns:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`set_campaign_status`](https://yapfactory.com/developers/tools.md#set_campaign_status) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |
| `status` | body | `"live" \| "paused" \| "closed"` | yes | paused: hidden from new creators. live: resume a paused or closed campaign. closed: finished; creators who asked are told. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/status" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "paused"
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "campaignId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "status": "paused",
    "url": "https://yapfactory.com/brand/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f"
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `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). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/set_campaign_status


---

<!-- https://yapfactory.com/developers/api/invite_creators.md -->

# Invite creators

> Invite hand-picked creators to a live campaign: up to 8 per campaign in all. Invites are free; each creator gets the offer and has 2 days to say yes. You only pay when you start a deal with someone who said yes (on yapfactory.com). The result lists who was invited and who couldn't be, with why. For use once the person has agreed the list.

```http
POST https://yapfactory.com/api/v1/campaigns/{campaignId}/invites
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `campaigns:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`invite_creators`](https://yapfactory.com/developers/tools.md#invite_creators) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |
| `creatorIds` | body | `uuid[]` | yes | Creator ids from search_creators or get_campaign. 1 to 8 items. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/invites" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "creatorIds": [
      "c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d"
    ]
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "invited": [
      {
        "creatorId": "c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d",
        "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
        "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
      }
    ],
    "failed": [],
    "next": "Creators have 2 days to answer. When one says yes, start the deal on its page to secure payment."
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `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). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/invite_creators


---

<!-- https://yapfactory.com/developers/api/pass_on_creator.md -->

# Pass on a creator

> Say "Not this time" to a creator who said yes but you won't start a deal with. They're told politely, and it can't be taken back. Only for deals not yet started. For use once the person has agreed.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/pass
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`pass_on_creator`](https://yapfactory.com/developers/tools.md#pass_on_creator) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |
| `reason` | body | `string` | no | A short, kind reason. The creator sees it. Up to 500 characters. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/pass" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "We went with a creator closer to our audience this time."
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "passed": true
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `deals:write` (or `write`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/pass_on_creator


---

<!-- https://yapfactory.com/developers/api/request_revision.md -->

# Ask for changes to a draft

> Send a draft back with notes, once the person has agreed them. Uses one of the included revision rounds (get_deal says how many are left). Once they're used, another round is paid and can only be asked for on the deal page: this returns the link instead. Approving a draft pays the creator, so that happens on the deal page too.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/revisions
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`request_revision`](https://yapfactory.com/developers/tools.md#request_revision) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |
| `notes` | body | `string` | yes | What to change, specifically. 10 to 4000 characters. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/revisions" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "notes": "Open on the alarm going off, then show the app within the first 3 seconds."
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "sentBack": true,
    "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `deals:write` (or `write`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/request_revision


---

<!-- https://yapfactory.com/developers/api/browse_campaigns.md -->

# Browse campaigns

> Live campaigns you could work on, with what each pays you, its fit with your profile and the brand's rating.

```http
GET https://yapfactory.com/api/v1/marketplace/campaigns
```

|   |   |
| --- | --- |
| Who can use it | Creators |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `marketplace:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`browse_campaigns`](https://yapfactory.com/developers/tools.md#browse_campaigns) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `query` | query | `string` | no | Words to look for in the product or brief. Up to 100 characters. |
| `category` | query | `string` | no | Only this product category, e.g. Health & Fitness. Up to 60 characters. |
| `country` | query | `string` | no | Only campaigns for this audience country, e.g. US. Up to 10 characters. |
| `sort` | query | `"fit" \| "newest" \| "pay" \| "rating"` | no | fit: best match for your profile first. pay: what you'd earn, highest first. rating: best rated brands first. Default `"fit"`. |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/marketplace/campaigns?sort=newest&limit=10" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `campaigns`, and `meta` carries the summary fields. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
      "title": "Morning routine with Sleepwell",
      "product": "Sleepwell",
      "category": "Health & Fitness",
      "brand": "Sleepwell",
      "brandRating": {
        "average": 4.8,
        "count": 6,
        "completedDeals": 7,
        "onTimeReviewRate": 1,
        "medianReviewHours": 9.5,
        "medianHoursDraftToPayout": 14
      },
      "pays": {
        "minor": 2500,
        "currency": "USD",
        "formatted": "$25.00"
      },
      "videos": 1,
      "openingsPerVideo": 1,
      "lengthSeconds": 30,
      "adRights": "Brand's channels, no ads",
      "targetCountries": [
        "US"
      ],
      "deadline": "2026-12-16T12:00:00.000Z",
      "fit": "Great fit",
      "fitReasons": [
        "You make wellness videos",
        "71% of your audience is in the US"
      ],
      "asked": false,
      "url": "https://yapfactory.com/creator/browse/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f"
    }
  ],
  "nextCursor": null,
  "hasMore": false,
  "meta": {
    "page": 1,
    "pages": 8,
    "total": 192,
    "yourRate": {
      "minor": 2500,
      "currency": "USD",
      "formatted": "$25.00"
    },
    "hiddenBecauseAboveBudget": 0
  }
}
```

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 `marketplace:read` (or `read`). |
| `forbidden` | 403 | Only for creators, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/browse_campaigns


---

<!-- https://yapfactory.com/developers/api/view_campaign_brief.md -->

# Read a campaign brief

> A live campaign's full brief as a creator sees it: what to make, the deadline, the ad rights, what it pays you line by line, and whether you can ask to join.

```http
GET https://yapfactory.com/api/v1/marketplace/campaigns/{campaignId}
```

|   |   |
| --- | --- |
| Who can use it | Creators |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `marketplace:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`view_campaign_brief`](https://yapfactory.com/developers/tools.md#view_campaign_brief) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/marketplace/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "title": "Morning routine with Sleepwell",
    "product": {
      "name": "Sleepwell",
      "description": "A sleep app that winds you down without your phone.",
      "url": "https://apps.apple.com/app/id0000000000"
    },
    "brand": {
      "name": "Sleepwell",
      "country": "US",
      "website": "https://sleepwell.app",
      "rating": {
        "average": 4.8,
        "count": 6,
        "completedDeals": 7,
        "onTimeReviewRate": 1,
        "medianReviewHours": 9.5,
        "medianHoursDraftToPayout": 14
      }
    },
    "brief": {
      "keyMessage": "Sleepwell helps you fall asleep in 10 minutes without your phone.",
      "hooks": [
        "I used to scroll until 2am.",
        "My sleep score went from 52 to 81."
      ],
      "cta": "Try it free tonight.",
      "dos": [
        "Film on your phone, vertical, natural light",
        "Show the app on screen within the first 5 seconds"
      ],
      "donts": [
        "No health or medical claims"
      ],
      "leftToYou": {},
      "exampleVideoUrl": null
    },
    "lengthSeconds": 30,
    "adRights": "Brand's channels, no ads",
    "deadline": "2026-12-16T12:00:00.000Z",
    "pays": {
      "total": {
        "minor": 2500,
        "currency": "USD",
        "formatted": "$25.00"
      },
      "lines": [
        {
          "label": "1 × 30s video creation fee",
          "amount": {
            "minor": 2500,
            "currency": "USD",
            "formatted": "$25.00"
          }
        },
        {
          "label": "Licence: Brand's channels, no ads",
          "amount": {
            "minor": 0,
            "currency": "USD",
            "formatted": "$0.00"
          }
        }
      ],
      "approximate": false
    },
    "fit": "Great fit",
    "fitReasons": [
      "You make wellness videos",
      "71% of your audience is in the US"
    ],
    "canAsk": true,
    "alreadyAsked": false,
    "dealId": null,
    "whyNot": null,
    "url": "https://yapfactory.com/creator/browse/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f"
  }
}
```

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 `marketplace:read` (or `read`). |
| `forbidden` | 403 | Only for creators, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/view_campaign_brief


---

<!-- https://yapfactory.com/developers/api/ask_to_join.md -->

# Ask to join a campaign

> Tell the brand you'd like to make this campaign. You go on their shortlist; some brands invite straight away. Free, no limit. For use once the person has agreed.

```http
POST https://yapfactory.com/api/v1/marketplace/campaigns/{campaignId}/ask
```

|   |   |
| --- | --- |
| Who can use it | Creators |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `marketplace:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`ask_to_join`](https://yapfactory.com/developers/tools.md#ask_to_join) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `campaignId` | path | `uuid` | yes | The campaign's id. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/marketplace/campaigns/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/ask" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "campaignId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "asked": true,
    "invitedAlready": false,
    "dealId": null,
    "url": "https://yapfactory.com/creator/browse/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f"
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `marketplace:write` (or `write`). |
| `forbidden` | 403 | Only for creators, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such campaign, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/ask_to_join


---

<!-- https://yapfactory.com/developers/api/respond_to_invite.md -->

# Answer an invite

> Say yes ("I'm in") or no to a brand's invite. A yes commits you to the offer if the brand starts the deal within 3 days. For use once the person has agreed.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/answer
```

|   |   |
| --- | --- |
| Who can use it | Creators |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`respond_to_invite`](https://yapfactory.com/developers/tools.md#respond_to_invite) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |
| `accept` | body | `boolean` | yes | true: I'm in. false: not this time. |
| `reason` | body | `string` | no | When declining, a short reason for the brand. Up to 500 characters. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/answer" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "accept": true
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "answer": "yes",
    "next": "The brand has 3 days to start the deal. You'll hear when payment is secured; don't film before then.",
    "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `deals:write` (or `write`). |
| `forbidden` | 403 | Only for creators, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/respond_to_invite


---

<!-- https://yapfactory.com/developers/api/list_post_accounts.md -->

# List accounts you can post to

> The brand's own TikTok and Instagram accounts connected to Yap Factory that can take a scheduled post now, with what each allows (post directly, or send to TikTok drafts). Connect accounts on yapfactory.com under Accounts.

```http
GET https://yapfactory.com/api/v1/posts/accounts
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `posts:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`list_post_accounts`](https://yapfactory.com/developers/tools.md#list_post_accounts) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/posts/accounts" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `accounts`, and `meta` carries the summary fields. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "0cc175b9-c0f1-46a8-b1c3-99e2697726ae",
      "platform": "tiktok",
      "account": "@sleepwell",
      "canPostDirectly": true,
      "canSendToDrafts": true
    }
  ],
  "nextCursor": null,
  "hasMore": false,
  "meta": {
    "connect": "https://yapfactory.com/brand/accounts"
  }
}
```

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 `posts:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_post_accounts


---

<!-- https://yapfactory.com/developers/api/get_post_account.md -->

# Get posting options for an account

> Live posting options for one account, straight from TikTok or Instagram: its name, who a post can be shown to (TikTok audiences), whether comments, Duet and Stitch can be on, the longest video, and whether it can post right now. Scheduling to a TikTok account needs these options, and the audience is the person's choice.

```http
GET https://yapfactory.com/api/v1/posts/accounts/{accountId}
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `posts:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`get_post_account`](https://yapfactory.com/developers/tools.md#get_post_account) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `accountId` | path | `uuid` | yes | The account's id. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/posts/accounts/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "0cc175b9-c0f1-46a8-b1c3-99e2697726ae",
    "platform": "tiktok",
    "account": "@sleepwell",
    "nickname": "Sleepwell",
    "avatarUrl": null,
    "privacyOptions": [
      "PUBLIC_TO_EVERYONE",
      "MUTUAL_FOLLOW_FRIENDS",
      "SELF_ONLY"
    ],
    "commentDisabled": false,
    "duetDisabled": false,
    "stitchDisabled": false,
    "maxDurationS": 600,
    "canPost": true,
    "audiences": [
      "PUBLIC_TO_EVERYONE",
      "MUTUAL_FOLLOW_FRIENDS",
      "SELF_ONLY"
    ],
    "say": "Ask the person who should see it; don't choose for them."
  }
}
```

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 `posts:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such account, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/get_post_account


---

<!-- https://yapfactory.com/developers/api/list_postable_videos.md -->

# List videos you can post

> Finished videos the brand may post: approved videos from completed deals. An id from here is the video for schedule_post; prepare_post_upload is for posting your own file.

```http
GET https://yapfactory.com/api/v1/posts/videos
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `posts:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`list_postable_videos`](https://yapfactory.com/developers/tools.md#list_postable_videos) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/posts/videos" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `videos`. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "deliverableId": "4a8a08f0-9d37-4b73-9a5c-2f6a1e0d7c33",
      "filename": "sleepwell-maya-v2.mp4",
      "campaign": "Morning routine with Sleepwell",
      "creator": "Maya R.",
      "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19"
    }
  ],
  "nextCursor": null,
  "hasMore": false
}
```

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 `posts:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_postable_videos


---

<!-- https://yapfactory.com/developers/api/prepare_post_upload.md -->

# Upload your own video or photo to post

> Get a one-time upload link for a video (MP4 or MOV, up to 300 MB) or photo (JPG) to post on one of the brand's accounts. The file goes to uploadUrl with the given method and headers, and the returned upload object is what schedule_post takes. Only for clients that can send files.

```http
POST https://yapfactory.com/api/v1/posts/uploads
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `write`: Changes your own things only. Nobody else is told. |
| Scope | `posts:write`, or `write` |
| Idempotency-Key | Optional, and recommended |
| Rate limit | Writes: 20 a minute |
| MCP tool | [`prepare_post_upload`](https://yapfactory.com/developers/tools.md#prepare_post_upload) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `accountId` | body | `uuid` | yes | The account the file is for. |
| `filename` | body | `string` | yes | The file's name, with its extension. 1 to 200 characters. |
| `contentType` | body | `string` | yes | video/mp4, video/quicktime or image/jpeg. |
| `sizeBytes` | body | `integer` | yes | The file's size in bytes. Up to 9007199254740991. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/posts/uploads" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
    "filename": "launch.mp4",
    "contentType": "video/mp4",
    "sizeBytes": 18400000
  }'
```

## Response

`201` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "uploadUrl": "https://uploads.yapfactory.com/posts/…?X-Amz-Signature=…",
    "method": "PUT",
    "headers": {
      "Content-Type": "video/mp4"
    },
    "upload": {
      "key": "posts/…/launch.mp4",
      "url": "https://uploads.yapfactory.com/posts/…/launch.mp4",
      "filename": "launch.mp4",
      "sizeBytes": 18400000
    },
    "next": "Send the file to uploadUrl, then pass `upload` in schedule_post's media."
  }
}
```

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 `posts: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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/prepare_post_upload


---

<!-- https://yapfactory.com/developers/api/schedule_post.md -->

# Schedule a post

> Schedule a video or photos to go out on one or more of the brand's own TikTok and Instagram accounts at a set time (at least 10 minutes and at most 60 days ahead). It posts publicly at that time, so it is for use once the person has seen the account, video, caption, time and (TikTok) audience and agreed. For TikTok the audience is the person's own choice from get_post_account. Not for creators' accounts.

```http
POST https://yapfactory.com/api/v1/posts
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `outbound`: Reaches other people: an email, a notification or a public post. |
| Scope | `posts:write`, or `write` |
| Idempotency-Key | **Required** |
| Rate limit | Writes: 20 a minute, of which outbound: 10 a minute |
| MCP tool | [`schedule_post`](https://yapfactory.com/developers/tools.md#schedule_post) |

> This reaches other people or the public. If an agent makes the call, it should confirm the details with the person first.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `accounts` | body | `object[]` | yes | The accounts to post to, from list_post_accounts. 1 to 10 items. |
| `accounts[].accountId` | body | `uuid` | yes | The account's id. |
| `accounts[].mode` | body | `"direct" \| "drafts"` | no | direct posts it; drafts sends it to the TikTok app's drafts for the person to finish (TikTok only). Default `"direct"`. |
| `media` | body | `({ deliverableId } \| { upload })[]` | yes | One video, one photo, or several photos (a carousel), in order. 1 to 35 items. |
| `caption` | body | `string` | no | The words under the post, hashtags included. Up to 2200 characters. Default `""`. |
| `publishAt` | body | `datetime` | yes | When it goes out, ISO 8601 with a time zone, e.g. 2026-12-10T18:00:00Z. |
| `timeZone` | body | `string` | no | The person's IANA time zone, for how times are shown to them, e.g. Europe/London. Up to 60 characters. Default `"UTC"`. |
| `tiktok` | body | `object` | no | Needed when posting directly to a TikTok account. |
| `tiktok.privacy` | body | `"PUBLIC_TO_EVERYONE" \| "MUTUAL_FOLLOW_FRIENDS" \| "FOLLOWER_OF_CREATOR" \| "SELF_ONLY"` | yes | Who can see it: the person's choice, from get_post_account. |
| `tiktok.allowComments` | body | `boolean` | no | Let people comment, if get_post_account says the account allows it. Default `false`. |
| `tiktok.allowDuet` | body | `boolean` | no | Let people Duet it (videos only). Default `false`. |
| `tiktok.allowStitch` | body | `boolean` | no | Let people Stitch it (videos only). Default `false`. |
| `tiktok.disclose` | body | `boolean` | no | Disclose commercial content. Default `false`. |
| `tiktok.yourBrand` | body | `boolean` | no | Promotional content for your own brand. Default `false`. |
| `tiktok.brandedContent` | body | `boolean` | no | A paid partnership for another brand (can't be Only me). Default `false`. |
| `instagram` | body | `object` | no |  |
| `instagram.shareToFeed` | body | `boolean` | no | Reels also show in the main feed. Default `true`. |

## Posting your own file

1. Ask for an upload link with [`POST /posts/uploads`](https://yapfactory.com/developers/api/prepare_post_upload.md). It returns `uploadUrl`, `method`, `headers` and an `upload` object.
2. Send the file's bytes to `uploadUrl` with that method and those headers. The link works once and for that size only.
3. Schedule it: pass the `upload` object, unchanged, as an item in `media`.

```bash
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: video/mp4" \
  --data-binary @launch.mp4
```

media, with an uploaded file:

```json
{
  "media": [
    {
      "upload": {
        "key": "posts/…/launch.mp4",
        "url": "https://…/launch.mp4",
        "filename": "launch.mp4",
        "sizeBytes": 18400000
      }
    }
  ]
}
```

## TikTok's rules

- `tiktok.privacy` is required for a TikTok account in `direct` mode, and must be one of `privacyOptions` from [`GET /posts/accounts/{accountId}`](https://yapfactory.com/developers/api/get_post_account.md). The person chooses it; there's no default.
- Comments, Duet and Stitch start off. Turn one on only if the same call says the account allows it.
- `mode: "drafts"` sends the video to the TikTok app's drafts instead, for the person to finish there.

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/posts" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "accounts": [
      {
        "accountId": "8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f",
        "mode": "direct"
      }
    ],
    "media": [
      {
        "deliverableId": "c9f0f895-fb98-4ab3-8e3c-1d2f3a4b5c6d"
      }
    ],
    "caption": "Fell asleep before the alarm app even loaded.",
    "publishAt": "2026-12-10T18:00:00Z",
    "timeZone": "Europe/London",
    "tiktok": {
      "privacy": "PUBLIC_TO_EVERYONE",
      "allowComments": true,
      "disclose": true,
      "yourBrand": true
    }
  }'
```

## Response

`201` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "posts": [
      {
        "id": "92eb5ffe-e6ae-4fec-8ad7-1c4c4e2f8a55",
        "accountId": "0cc175b9-c0f1-46a8-b1c3-99e2697726ae",
        "status": "scheduled",
        "publishAt": "2026-12-10T18:00:00.000Z",
        "url": "https://yapfactory.com/brand/accounts?tab=calendar&post=92eb5ffe-e6ae-4fec-8ad7-1c4c4e2f8a55"
      }
    ]
  }
}
```

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`), an unknown query parameter, or no `Idempotency-Key`. |
| `unauthorized` | 401 | No token, or it's wrong, expired, revoked or from the other environment. |
| `insufficient_scope` | 403 | The token doesn't have `posts: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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/schedule_post


---

<!-- https://yapfactory.com/developers/api/list_posts.md -->

# List scheduled posts

> The brand's posts across its accounts: what's coming up, what went live (with its link) and anything that needs the person (a failed post says why). Defaults to the last 7 days and everything ahead.

```http
GET https://yapfactory.com/api/v1/posts
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `read`: Reads. Changes nothing. |
| Scope | `posts:read`, or `read` |
| Idempotency-Key | Not used |
| Rate limit | Reads: 120 a minute |
| MCP tool | [`list_posts`](https://yapfactory.com/developers/tools.md#list_posts) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `status` | query | `"upcoming" \| "live" \| "needs_action" \| "all"` | no | upcoming: not out yet. live: posted. needs_action: stopped and needs the person. Default `"all"`. |
| `from` | query | `datetime` | no | Start of the range (default: 7 days ago). |
| `to` | query | `datetime` | no | End of the range (default: 60 days ahead). |
| `limit` | query | `integer` | no | How many to return. 1 to 50. Default `20`. |
| `cursor` | query | `string` | no | The `nextCursor` from the previous page. Leave out for the first page. |

## Example request

```bash
curl "https://yapfactory.com/api/v1/posts?status=upcoming" \
  -H "Authorization: Bearer $YAP_API_KEY"
```

## Response

`200` with a list. Each item in `data` is what the MCP tool returns in `posts`. Pass `nextCursor` back as `cursor` until `hasMore` is false. [How paging works](https://yapfactory.com/developers/pagination.md).

```json
{
  "data": [
    {
      "id": "92eb5ffe-e6ae-4fec-8ad7-1c4c4e2f8a55",
      "accountId": "0cc175b9-c0f1-46a8-b1c3-99e2697726ae",
      "platform": "tiktok",
      "account": "@sleepwell",
      "status": "scheduled",
      "publishAt": "2026-12-10T18:00:00.000Z",
      "mode": "direct",
      "mediaType": "video",
      "items": 1,
      "caption": "Fell asleep before the alarm app even loaded.",
      "postUrl": null,
      "problem": null,
      "url": "https://yapfactory.com/brand/accounts?tab=calendar&post=92eb5ffe-e6ae-4fec-8ad7-1c4c4e2f8a55"
    }
  ],
  "nextCursor": null,
  "hasMore": false
}
```

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 `posts:read` (or `read`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/list_posts


---

<!-- https://yapfactory.com/developers/api/update_post.md -->

# Change a scheduled post

> Change the caption or time of a post that hasn't gone out. For use once the person has agreed the change.

```http
PATCH https://yapfactory.com/api/v1/posts/{postId}
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `write`: Changes your own things only. Nobody else is told. |
| Scope | `posts:write`, or `write` |
| Idempotency-Key | Optional, and recommended |
| Rate limit | Writes: 20 a minute |
| MCP tool | [`update_post`](https://yapfactory.com/developers/tools.md#update_post) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `postId` | path | `uuid` | yes | The post's id. |
| `caption` | body | `string` | no | The new caption. Up to 2200 characters. |
| `publishAt` | body | `datetime` | no | The new time, ISO 8601 with a time zone, 10 minutes to 60 days ahead. |

## Example request

```bash
curl -X PATCH "https://yapfactory.com/api/v1/posts/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "publishAt": "2026-12-11T18:00:00Z"
  }'
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "92eb5ffe-e6ae-4fec-8ad7-1c4c4e2f8a55",
    "status": "scheduled",
    "publishAt": "2026-12-11T18:00:00.000Z",
    "caption": "Fell asleep before the alarm app even loaded."
  }
}
```

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 `posts:write` (or `write`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such post, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/update_post


---

<!-- https://yapfactory.com/developers/api/cancel_post.md -->

# Cancel a scheduled post

> Cancel a post that hasn't gone out, so it never posts. It can't be undone, though the post can be scheduled again. A post that's already live has to be deleted in TikTok or Instagram.

```http
POST https://yapfactory.com/api/v1/posts/{postId}/cancel
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `write`: Changes your own things only. Nobody else is told. |
| Scope | `posts:write`, or `write` |
| Idempotency-Key | Optional, and recommended |
| Rate limit | Writes: 20 a minute |
| MCP tool | [`cancel_post`](https://yapfactory.com/developers/tools.md#cancel_post) |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `postId` | path | `uuid` | yes | The post's id. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/posts/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/cancel" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

## Response

`200` with the result in `data`: the same object the MCP tool returns.

```json
{
  "data": {
    "id": "92eb5ffe-e6ae-4fec-8ad7-1c4c4e2f8a55",
    "status": "cancelled"
  }
}
```

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 `posts:write` (or `write`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such post, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/cancel_post


---

<!-- https://yapfactory.com/developers/api/start_deal.md -->

# Start a deal (payment link)

> Starting a deal charges the brand's card, so it can't happen through the API. Returns the link where the brand starts it on yapfactory.com, and whether it can be started now.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/start
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `money`: Charges or pays, so it never runs here. You get a link to finish it on yapfactory.com. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | Optional, and recommended |
| Rate limit | Writes: 20 a minute |
| MCP tool | None. This one is REST only. |

## Payment stays on yapfactory.com

This call never charges or pays anyone. It returns a **handoff**: the link to the deal page, where the brand finishes the step themselves. Show them the link, or open it for them.

The payment is held by Yap Factory until the brand approves the draft. Then the creator is paid in full.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/start" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

## Response

`200` with the handoff in `data`. `handoff.url` is the page to open, `handoff.say` is a sentence to show the person, and `canStartNow` says whether the step can happen yet.

```json
{
  "data": {
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "status": "accepted",
    "canStartNow": true,
    "handoff": {
      "action": "start_deal",
      "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
      "say": "Start the deal on this page: your card is charged and payment is held until you approve the video."
    }
  }
}
```

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 `deals:write` (or `write`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/start_deal


---

<!-- https://yapfactory.com/developers/api/approve_draft.md -->

# Approve a draft (review link)

> Approving a draft pays the creator, so it can't happen through the API. Returns the link where the brand watches the draft and approves it on yapfactory.com.

```http
POST https://yapfactory.com/api/v1/deals/{dealId}/approve
```

|   |   |
| --- | --- |
| Who can use it | Brands |
| Tier | `money`: Charges or pays, so it never runs here. You get a link to finish it on yapfactory.com. |
| Scope | `deals:write`, or `write` |
| Idempotency-Key | Optional, and recommended |
| Rate limit | Writes: 20 a minute |
| MCP tool | None. This one is REST only. |

## Payment stays on yapfactory.com

This call never charges or pays anyone. It returns a **handoff**: the link to the deal page, where the brand finishes the step themselves. Show them the link, or open it for them.

The payment is held by Yap Factory until the brand approves the draft. Then the creator is paid in full.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `dealId` | path | `uuid` | yes | The deal's id. |

## Example request

```bash
curl -X POST "https://yapfactory.com/api/v1/deals/8f14e45f-ceea-4e7a-9b1d-2c3b4a5d6e7f/approve" \
  -H "Authorization: Bearer $YAP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

## Response

`200` with the handoff in `data`. `handoff.url` is the page to open, `handoff.say` is a sentence to show the person, and `canApproveNow` says whether the step can happen yet.

```json
{
  "data": {
    "dealId": "3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
    "status": "draft_submitted",
    "canApproveNow": true,
    "handoff": {
      "action": "approve_draft",
      "url": "https://yapfactory.com/deals/3b2f6c1e-7a54-4d0b-9f1a-6e5d4c3b2a19",
      "say": "Watch the draft on this page and approve it there: approving pays the creator."
    }
  }
}
```

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 `deals:write` (or `write`). |
| `forbidden` | 403 | Only for brands, or the account can't do this yet (email not confirmed, paused). |
| `not_found` | 404 | No such deal, or it isn't yours. |
| `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](https://yapfactory.com/developers/errors.md) for what to do about each one.

---

HTML version: https://yapfactory.com/developers/api/approve_draft
