Hand your integration to an AI coding agent
Every campaign page has an AI playbook with that campaign’s IDs already filled in. Copy it, give it to the coding agent your developer uses and add the API key to your server yourself. The agent wires the code; you check the results and submit for approval.
See also: Setup without an SDK
On this page
Open the campaign, then Show developer setup
On the campaign page, under Connect your app (or Connect your website), choose Show developer setup. The panel AI docs for your developer holds the playbook. Docs in the sidebar has the same playbook without a campaign’s IDs, for a mobile app or a website.
Copy AI playbook or Download .md
Copy AI playbook copies the whole file. Download .md saves it as a Markdown file with the campaign’s ID in its name. Preview shows it first. It opens with the values the agent needs:
AFOS_API_BASE=https://affiliateos.xyz AFOS_APP_ID=<your product ID> AFOS_CAMPAIGN_ID=<your campaign ID> AFOS_PRODUCT_TYPE=mobile AFOS_ADVERTISER_API_KEY=<mint in portal - paste into server env only>Mint API key and add it to your server
Choose Mint API key on the campaign, or Mint new key under API keys. The key starts with
ak_and is shown once. Put it in your server’s environment yourself; the agent only needs the variable’s name.Give the agent the playbook and your event list
The playbook tells the agent to ask for anything missing rather than guess. Have these ready:
- Each event key, and the moment it fires in your app or site.
- Which events are purchases or deposits. Those need a
transactionId. - Whether you use an attribution tool such as AppsFlyer or Adjust.
Review what it built
- Events are sent from your server, never from the app or the browser.
- The key is not in the app, the browser code, logs or git.
- Each event has an
eventIdthat stays the same when it is retried. - Events go out as they happen. A
timestampmore than 48 hours from when we receive it isn’t paid. "test": truestays on until the event shows Verified.
Check it worked
Each required event shows Verified on the campaign, and Event logs shows its test rows as
approved. The agent can prepare a summary, but Submit for approval is yours to choose.
The playbook rules these out, so push back if the agent suggests them:
- An AffiliateOS SDK for your app. There isn’t one, and none is needed.
- Calls to our API from the app or the browser with your key.
- Withdrawals or refunds of your campaign balance.
| Status | Likely cause |
|---|---|
missing_attribution | The user has no stored afos_click_id, or it doesn’t match a real tap |
invalid_event | The eventKey or appId doesn’t match an event on your campaign |
outside_window | The timestamp is more than 48 hours off, or past the event’s attribution window |
duplicate | The same eventId or transactionId was sent before. Treat it as success. |
| HTTP 401 | The key is wrong or revoked |
Building with an assistant across several roles? The AI context files cover every API, and /ai/advertiser.md is the advertiser one.