Product
Publishers
Advertisers
Networks
Help
Pause animations
Browse help topics
How-to Advertiser

Hand your integration to an AI coding agent

Updated

View as Markdown

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

Steps

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

  2. 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:

    Text
    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>
  3. 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.

  4. 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.
  5. 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 eventId that stays the same when it is retried.
    • Events go out as they happen. A timestamp more than 48 hours from when we receive it isn’t paid.
    • "test": true stays on until the event shows Verified.
  6. 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.

What the agent should not build

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.

When a live event comes back wrong

StatusLikely cause
missing_attributionThe user has no stored afos_click_id, or it doesn’t match a real tap
invalid_eventThe eventKey or appId doesn’t match an event on your campaign
outside_windowThe timestamp is more than 48 hours off, or past the event’s attribution window
duplicateThe same eventId or transactionId was sent before. Treat it as success.
HTTP 401The 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.

Support

Still stuck? Write to us.

One address for every question: hello@affiliateos.ai. Put the details from this list in your first message so we can find the click or conversion without asking you for them again.

Put these in your message

  1. 01The email you sign in with
  2. 02Your role: publisher, advertiser or network
  3. 03The offer ID
  4. 04The click ID or action_id
  5. 05The time it happened, with your time zone
  6. 06What you expected to happen

Looking for a reward in an app? Ask that app's support. It credits your reward, so only it can see your balance.

Search help