Skip to main content
This walkthrough creates a live campaign with curl. Everything here is also available in the console; the API just makes each step explicit.
A campaign commits its entire budget the moment you create it. Top up your balance first — see Deposits — and use a small budget while you are finding your feet.

Before you start

1

Get an API key

In the console, open Settings → API keys and create one. The full key is shown once, at creation. It looks like sk-af-v1- followed by 32 hex characters. See API keys.
2

Export it

Every request below sends the key as a bearer token:
A project needs a logo. Uploads are two calls: reserve a slot, then send the bytes.
sizeBytes and contentType are checked against the actual bytes you send, so they have to be right. Limits are in Media.

2. Create a project

Let Aflux read your site first — it drafts the name, description and brand colours for you.
Then generate the AI context — the business description every later step reasons from — and create the project:
See Projects for what the context is used for and how to revise it.

3. Write and validate the ad copy

Validation answers with every problem at once, each positioned so an editor can underline it. Campaign creation applies exactly the same rules, so a text that validates is a text that creates. See Ad copy.

4. Find channels

Keep the matchToken. Campaign creation consumes exactly one token and buys exactly the channels cached under it. A channel that is not in that search cannot be bought.
filters shows how your sentence was read — 20K+ subscribers comes back as minSubscribers: 20000. If it read you wrong, correct the prompt and search again. See Finding channels.

5. Ask for a budget spread

Each day comes back with an amount and a recommendation of AI_BEST, NORMAL or LOW_TRAFFIC.

6. Create the campaign

Two things worth noticing:
  • {channel} and {campaign} in destinationUrl are substituted per placement, so your own analytics can tell channels apart. See Campaigns.
  • idempotencyKey makes a retried request safe. Reuse the same UUID when you retry; use a fresh one for a genuinely new campaign.

7. Approve the deals

The agent now contacts channel owners. Poll the placements:
When one reaches PENDING_APPROVAL, read what was agreed and approve it:
Approval is what commits money to that channel. See Placements for the full status list and what each one means.

8. Read the results

Views and reactions arrive after publication and settle roughly 48 hours later; clicks are measured on our own redirect. Analytics explains what each figure does and does not include.

Next

Concepts

The vocabulary — projects, campaigns, placements, balance.

MCP server

Do all of the above from your own AI agent instead.