> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adgentek.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# REST API

> Direct API integration for custom architectures. CPC and CPA by default; certification unlocks impression-priced demand.

<Warning>
  **Performance demand by default.** Uncertified API integrations serve CPC (filtered) and CPA demand only. If you render ads in a real client and implement the impression pixel correctly, you can certify for Direct and Programmatic CPM demand. The rules are below and in [Choosing your integration path](/publishers/choosing-your-integration-path).
</Warning>

The REST API is for architectures where an SDK cannot run: server-rendered stacks, proprietary clients, enterprise deployments. You call the serve endpoint, receive an ad payload, and render it yourself. That last part is where integrations succeed or fail, so read the tracking obligations before writing any code.

## Authentication

```
Authorization: Bearer YOUR_PUBLISHER_TOKEN
```

## Serve an ad

```bash theme={null}
curl -X POST https://api.adgentek.ai/v1/serve \
  -H "Authorization: Bearer YOUR_PUBLISHER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "placement_id": "your-placement",
    "context": {
      "query": "best mattress for back pain under 1500",
      "response": "For back pain, medium-firm hybrid mattresses..."
    }
  }'
```

## Response

```json theme={null}
{
  "ad": {
    "format": "contextual_card",
    "render": { "...": "format-specific render payload" },
    "tracking": {
      "impression_url": "https://t.adgentek.ai/i/...",
      "click_url": "https://t.adgentek.ai/c/..."
    }
  }
}
```

## Rendering and tracking obligations

These three rules determine whether your impressions are billable. They are not optional.

**1. Fire the impression pixel client-side, as an image request.**

```javascript theme={null}
// Correct: fires from the user's browser when the ad enters the viewport
new Image().src = ad.tracking.impression_url;
```

**2. Never fire it via fetch.**

```javascript theme={null}
// Wrong: CORS blocks this silently in many contexts. The event never arrives.
fetch(ad.tracking.impression_url);
```

**3. Never fire it from your backend.**

```javascript theme={null}
// Wrong: any server-side request to the impression URL originates from
// datacenter IP space and is classified as GIVT by verification vendors.
// The impression is discarded and unbilled.
```

Clicks must use `click_url` from the payload. It routes through the Adgentek redirect layer where click-quality filtering runs. Linking users directly to advertiser destinations breaks CPC billing and fails integration review.

## Certification for impression-priced demand

Once your client-side impression implementation is live:

1. Confirm in your own DevTools that the pixel fires from the browser on render.
2. Email [hello@adgentek.ai](mailto:hello@adgentek.ai) with your placement IDs to request an integration review.
3. On approval, Direct and Programmatic demand become eligible for your placements. Certification is per placement and revocable if server-side impression traffic appears.

## Full endpoint reference
