# 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
