API, webhooks and MCP
Connect your own tools and AI assistants with API keys, the REST API, signed webhooks and the MCP server. Every call runs with the permissions of the person who made the key.
Last updated
On this page
The app has three ways in for your own code: a REST API, signed outbound webhooks and an MCP server for AI assistants. All three use the same API key. A key acts as the person who made it, with that person's current role, access policy, approval rules and money limits. This page explains how each part works. For every endpoint, field and method, see the API reference.
Before you begin#
- Brand keys and webhooks: you need the brand Admin role. If your role must use two-factor (Admin does by default), sign in with two-factor first. See Security, SSO, audit log and privacy.
- Creator keys: creators can make their own keys in the creator portal, under Developers. A creator key acts as that creator in one brand. It reads only their own videos, fixes and earnings. Creators cannot add webhooks. See Use the API.
Make an API key#
- In the brand app sidebar, click Settings.
- In the Settings menu, under Team and data, click Developers.
- Under API keys, type a Name, for example the tool that will use the key.
- Optional: type Expires after (days, optional), from 1 to 730.
- Under Scopes, select what the key can do. Click Read only for a read key, or Select all for every scope that you can use.
- Click Make a key.
- Copy the key, then click I have copied it.
The key starts with ts_ and is shown only once. The app stores a SHA-256 hash, not the key. To stop a key, click Revoke.
A key never has more access than its owner has now. If the owner's role or policy changes, the key changes with it. If the owner leaves the brand, the key stops working.
Scopes#
read reads the API collections. Each write scope covers one area of the app. The form lists only the scopes that your role can use.
| Scope | Covers |
|---|---|
read |
Read data from the collections |
submissions:write |
Videos and new versions, review checklists, review notes, extra clips a creator offers, the inbox of open work and who owns it |
evidence:write |
Evidence reviews, creative reviews, finding decisions, review-quality labels, review openings for reviewer time |
fixes:write |
Propose, send and answer fixes and suggested edits; pause, resume or chase with the video agent, and answer its proposed edit. A yes to the proposed edit also needs studio:write |
studio:write |
Edit drafts, renders, brief re-edits, captions, licensed music |
approvals:write |
Approve or reject exact files, record a confirmed action, reopen a decided review before launch, buy extra clips. A creator key records only the creator's own sends and consents |
rights:write |
Rights, rights requests for posts, rights imports, contracts and their withdrawal before signing, offers and counter-offers, updates to signed contracts, ad partnerships, where else a video went and clearing its launch hold. A brand key's counter-offer, acceptance or update keeps the pay: new pay for one creator stays in the app |
launch:write |
Launch drafts and launches, ad readback, ad settings |
programs:write |
Programs, briefs, a program's product in the catalog, guidelines, landing pages, discount codes, gift caps. A key sets pay only on a new program: pay and commission rates on a program that exists, and the pay in a creator's brief, stay in the app |
creators:write |
Find, invite, import, match and manage creators, upload links |
outreach:write |
Outreach messages and replies, email sequences from your own mailbox, the suppression list, Instagram replies |
chat:write |
Conversations, messages, read receipts |
samples:write |
Product samples, shipping addresses and sample deposit terms. Refunding a deposit stays in the app |
profile:write |
Creators' social accounts |
analytics:write |
Metric refresh, attribution, attribution tools (test, connect a stored key, sync, disconnect, counted source), learnings, reports, strategy notes |
experiments:write |
Creative tests |
engagements:write |
The pilot plan, its baseline, case-study links and time logs |
settings:write |
Integrations, brand profile, claims library, automations |
Call the REST API#
Send the key in the Authorization header as a bearer token. The x-api-key header also works.
curl -H "Authorization: Bearer ts_…" \
"https://<your app>/api/v1/submissions?status=awaiting_review&limit=50"
| Call | What it does |
|---|---|
GET /api/v1 |
Who the key acts as, its scopes, the collections it can read and the webhook events |
GET /api/v1/<collection> |
One page of rows, oldest first |
GET /api/v1/<collection>/<id> |
One row |
POST /api/v1/methods/<group.method> |
Runs the same method the app uses. The body is { "args": [...] }. |
GET /api/v1/openapi.json |
The OpenAPI description |
List calls take status, submissionId, creatorId, updatedSince and limit (up to 200). A page returns { data, next }. To get the next page, pass next back as after.
Brand keys read these collections: submissions, assets (versions), evidenceReviews, findingResponses, versionApprovals, fixes, rights, launches, creators, programs, metricSnapshots, editDrafts, audioTracks, experiments, rightsRequests, capturedPosts, sourceResults, uploadLinks, extras, offers, sequences, automations, automationRuns, pages (landing pages), sampleRequests, sales and videoAgents (the video agent of each submission). Creator keys read only the rows that the creator sees in the portal, plus their own payouts, extras, offers, sampleRequests, sales and videoAgents. They cannot read launches, experiments, rightsRequests, capturedPosts, sourceResults, uploadLinks, sequences, automations, automationRuns or pages.
A method call needs the key's scope for that method, and the owner's role must allow it. The method then runs every check that it runs in the app. For the methods and their arguments, see the API reference.
Some methods run a method of another area on the way. A call that gets there also needs that method's scope. Without it, the call returns 403 with the code scope, and nothing is saved. The API reference lists those methods in x-also-runs and the extra scopes in x-also-needs-scopes. For example, a yes to the video agent's proposed edit (videoAgent.answerProposal) runs studio.render, so it needs studio:write as well as fixes:write. A no needs only fixes:write.
A method call answers { data, simulated, dryRun, activity }. On a server with writes switched off, every call is a dry run: dryRun is true, only the activity row is saved, and nothing is charged.
Every method checks args against its schema before it runs. A wrong type, a missing argument or a value that is too long returns 400 with the code invalid, and the message names the argument. Every optional argument accepts null, which the method treats as left out. To leave out an optional argument that comes before one you send, put null in its place. Video links must use http or https.
Each change to the API, added methods included, and what to do about it is in the API changelog. The current version is info.version in GET /api/v1/openapi.json.
Approve an exact file#
approvals.decide takes the contentHash of the version you read. If the file changed after you read it, the call is refused and says so. Read the version first, then decide.
A brand approval also follows the review verdict for that version. When the evidence review blocks the file, or a person must still decide findings, approvals.decide and creative.setAssetApproval return 409 with the code blocker. The message names the first blockers. Send fixes, or decide the findings in the app. An Admin's key can pass override: { reason } in approvals.decide, or the fourth argument { reason } in creative.setAssetApproval. Any other role gets 403 with the code permission. The activity log records the reason. A creator's approval and a rejection are never refused this way.
Errors and limits#
Errors come back as { error, code }, with a plain-language message. The API reference lists the codes for each call.
| Status | Meaning |
|---|---|
| 400 | The body or an argument is not valid (code invalid). The message names the argument. |
| 401 | The key is missing, revoked or expired |
| 403 | The key's scopes or the owner's role do not allow this. A missing scope is code scope, also for a method that the call runs on the way. |
| 404 | No such collection, row or method |
| 409 | A business rule refused the call. The message says why. |
| 429 | Too many requests. Wait for the time in Retry-After. |
| 500 | A failure on our side (code server). Try again. When the answer has a ref, give it to support. |
The limit is 600 requests a minute per key, and 3,000 a minute per IP address.
Receive webhooks#
Webhooks send an HTTPS POST to your endpoint when something changes in the brand.
- On Developers, under Webhooks, type the Endpoint URL (https) and a Description.
- Under Events, select the events.
- Click Add endpoint.
- Copy the Signing secret, then click I have copied it. It is shown only once.
- Click Send test. The app sends a signed
pingand shows how your endpoint answered. If the endpoint did not answer with a 2xx status, open Delivery log to see the status and the error.
| Event | When |
|---|---|
submission.received |
A creator sent a video or a new version of it |
submission.status_changed |
A video moved to a new status |
review.completed |
The evidence review finished for a version, with its outcome |
version.ready |
A version's file is ready, with its fingerprint |
version.approved |
The creator or the brand approved one exact file |
version.rejected |
The creator or the brand rejected one exact file |
fix.updated |
A fix was sent, accepted, disputed, applied or resolved |
launch.updated |
A launch was created or its platform status changed |
rights.updated |
A usage right or ad permission was granted, changed, expired or revoked |
payout.updated |
A payout transfer changed status |
extra.purchased |
The brand bought an extra clip. A one-off payout waits for payment approval |
offer.updated |
An offer on an agreement was sent, countered, accepted or declined |
contract.updated |
An agreement was built, sent or signed, or an update to signed terms was sent, signed, declined or withdrawn |
rights_request.accepted |
A creator accepted a rights request for a post |
rights_request.declined |
A creator declined a rights request, with the reason |
automation.run |
An automation ran on a workflow event, with the result of each action |
video_agent.escalated |
The video agent chased one side the most times it may, nothing changed, and it escalated to the brand owner |
Each delivery is JSON: { id, type, brandId, createdAt, data }. It has these headers:
x-topspin-event: the event type.x-topspin-delivery: the event id. It is stable, so use it to ignore repeats.x-topspin-signature:t=<unix seconds>,v1=<hex>.v1is the HMAC-SHA256 of<t>.<raw body>, keyed with the signing secret.
Check the signature#
Check the signature on the raw body before you parse it. Reject signatures older than 5 minutes.
import crypto from "node:crypto";
function verify(header, rawBody, secret) {
const [t, v1] = header.split(",").map((part) => part.split("=")[1]);
const want = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
const fresh = Math.abs(Date.now() / 1000 - Number(t)) < 300;
return fresh && want.length === v1.length && crypto.timingSafeEqual(Buffer.from(want), Buffer.from(v1));
}
How delivery works#
- The app queues each event in the same transaction as the change. An event exists only when its change does.
- Delivery starts right after the change. This is the same when the change came from the app, an API call, the MCP server, an upload link, a rights link or Slack.
- Changes made by background work, such as a finished review or a payout, go out within 5 minutes. A scheduled job sends what is left every 5 minutes.
- Your endpoint must answer with a 2xx status within 10 seconds.
- A failed delivery is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours.
- After 25 failed deliveries in a row, the endpoint turns off, and each brand Admin gets an email with the last error. The email names the endpoint by its host and description only, because a webhook URL can hold a secret. The full address is on the Developers page. Deliveries that were queued wait while it is off. Events that happen while it is off are not queued. Click Turn on to start it again.
- URLs must be public
https, on any port. Local host names (localhost, a name with no dot, or one that ends in.local,.internal,.lan,.homeor.corp) and private, loopback, link-local and documentation addresses are refused when you add the endpoint, before each delivery and when the connection opens. Redirects are not followed.
See why a delivery failed#
Each endpoint on Developers has a Delivery log. It lists every delivery, newest first, with its status, the number of tries, the HTTP status your endpoint answered and what went wrong.
- Under Webhooks, open Delivery log for the endpoint.
- To see only the problems, select Failed.
- To see what was sent, open Body on a delivery. The id after Body is the
x-topspin-deliveryheader. - Fix your endpoint, then click Retry on the failed delivery. The app sends it at once and shows the result.
A retried delivery that fails again stays failed: it does not start the retry schedule over. To retry, the endpoint must be on.
Connect an AI assistant with MCP#
https://<your app>/api/mcp is a Streamable HTTP MCP server. It uses the same API key. Add it to an MCP client, such as Claude or Cursor:
{ "mcpServers": { "topspin": { "type": "http", "url": "https://<your app>/api/mcp", "headers": { "Authorization": "Bearer ts_…" } } } }
The server shows only the tools that the key's scopes allow. A read-only key sees only the read tools.
| Tool | Key | What it does |
|---|---|---|
review_queue |
Brand | Videos waiting on the brand, oldest first |
open_work |
Brand | Everything open in the brand, late first, with who owns each next step: the same list as Home and the Queue, without money or contract terms. Needs submissions:write |
get_video |
Both | Transcript, versions with fingerprints and approvals, findings, open fixes |
approve_version, reject_version |
Both | Decide on an exact file. Needs its contentHash. |
propose_fixes, send_fixes |
Brand | Turn findings into fixes and send them as one revision round |
get_edit_context |
Brand | Timed words, findings, the agreed edit scope, licensed music, the latest draft |
plan_video_edit |
Both | Plan an edit from plain words, with the agreement check |
save_edit_draft, render_edit |
Both | Save an edit draft, or render a new version |
launch_readiness |
Brand | Launch checks for a version: approvals, rights, evidence, specs, copy |
list_rights |
Brand | Rights and permissions, such as those that end soon |
ad_results |
Brand | Spend, clicks, purchases and ROAS per creative |
my_videos, my_earnings |
Creator | The creator's own videos and earnings |
respond_to_fix, respond_to_finding |
Creator | Accept or dispute a fix, or answer a finding |
list_records |
Both | Any API collection, page by page |
call_method |
Both | Any app method that the key may call, with the same checks |
Writes run as the key's owner, with their permissions and limits. An assistant cannot approve a file that it has not read, because the approve tools need the contentHash from get_video.
Troubleshooting#
The API answers 401 with "This API key has expired." Make a new key in Developers, then revoke the old one.
A method call answers 403 with "Money, access and security changes need a person signed in with two-factor." Keys cannot call these methods. Do the action in the app.
A method call answers 403 and names a missing scope. The key does not have the scope for that method. Make a key with the scope.
A method call answers 400 with the code invalid.
An argument does not match the method's schema. The message gives the argument's position and the rule, for example 0.url must be an http or https link. Check the method in the API reference, then call again.
commission.save answers 403 with the code mfa_required.
Commission rates change creator pay, so keys cannot change them. Change them in the app. See the API changelog.
briefs.saveCreatorBrief, briefs.removeCreatorBrief, offers.respond or contractUpdates.send answers 403 with the code mfa_required.
The call changes one creator's pay, and keys cannot do that. Send the pay as it is to make the other changes, or change the pay in the app with two-factor. See the API changelog.
programs.save answers 403 with the code permission.
The call changes the pay of a program that exists, and programs.save never does that. Send the saved payRule to change the other fields, or change pay in the app with two-factor.
Managing keys fails with "Only a brand Admin can manage API keys and webhooks." Ask a brand Admin to make the key or add the webhook.
An endpoint shows "Turned off after 25 failed deliveries in a row." Fix the endpoint so it answers 2xx within 10 seconds, then click Turn on. Open the Delivery log to see the last errors, and click Retry on the deliveries that failed for good.
Retry answers "Only a failed delivery can be retried." The delivery is pending, so it is already queued, or it was delivered. Open the log again to see its status.