Skip to main content

Base URL

https://api.attentium.ai/v1

Create Campaign

Initialize a verification request. Returns an invoice (402) or campaign keys (200).
duration
integer
required
Length of attention needed in seconds (10, 30, 60).
quantity
integer
required
Number of human verifiers needed.
bid_per_second
float
required
USDC amount per second offered.
callback_url
string
Webhook URL to receive results.

Required Headers (with payment)

X-Solana-Tx-Signature
string
required
The Solana transaction signature proving payment.
X-Campaign-Id
string
required
UUID linking the payment to this request. Must match the memo in your Solana transaction.
Critical Security Requirement Your Solana transaction MUST include a memo instruction containing the X-Campaign-Id value. This prevents payment replay attacks.

Memo Program Integration

To bind your payment to a specific campaign request, your Solana transaction must include a memo instruction.

Solana Memo Program

PropertyValue
Program IDMemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
DataYour X-Campaign-Id (UTF-8 encoded UUID)
AccountsNone required

Transaction Structure

Your transaction should contain two instructions:
  1. SPL Token Transfer - USDC to treasury
  2. Memo Instruction - Campaign UUID as data

Python Example

from solders.instruction import Instruction
from solders.pubkey import Pubkey
import uuid

MEMO_PROGRAM = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"

# Generate campaign ID
campaign_id = str(uuid.uuid4())

# Create memo instruction
memo_ix = Instruction(
    program_id=Pubkey.from_string(MEMO_PROGRAM),
    accounts=[],
    data=campaign_id.encode('utf-8')
)

# Add to your transaction: [transfer_ix, memo_ix]

Error Codes

ErrorDescription
missing_campaign_idX-Campaign-Id header not provided
missing_memoTransaction has no memo instruction
memo_mismatchMemo content doesn’t match header

Example Request (with Payment)

# Step 1: Get invoice (no headers needed)
curl -X POST https://api.attentium.ai/v1/verify \
  -H "Content-Type: application/json" \
  -d '{
    "duration": 30,
    "quantity": 5,
    "bid_per_second": 0.05,
    "validation_question": "Is this a cat?",
    "content_url": "https://example.com/image.png"
  }'
# Returns 402 with invoice

# Step 2: Pay with memo, then submit with headers
curl -X POST https://api.attentium.ai/v1/verify \
  -H "Content-Type: application/json" \
  -H "X-Solana-Tx-Signature: YOUR_TX_SIGNATURE" \
  -H "X-Campaign-Id: YOUR_UUID_FROM_MEMO" \
  -d '{
    "duration": 30,
    "quantity": 5,
    "bid_per_second": 0.05,
    "validation_question": "Is this a cat?",
    "content_url": "https://example.com/image.png"
  }'
# Returns 200 with campaign keys

Fetch Results

Poll for campaign completion status.
key
string
required
The read_key returned during creation.

Example Request

curl "https://api.attentium.ai/v1/campaigns/0x123abc/results?key=YOUR_READ_KEY"