Skip to main content

Authentication

All requests to the Adstract API must include a valid API key. The key is passed as a request header — there is no cookie-based or OAuth-based authentication flow.

X-Adstract-API-Key: your-api-key

Include this header on every request:

const response = await fetch("https://api.adstract.ai/api/ad-injection/start/", {
method: "POST",
headers: {
"X-Adstract-API-Key": "your-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({ ... }),
});

Key types

Adstract issues two types of API key, each for a different stage of your integration lifecycle.

Key typeWhen to useTraffic paid
SandboxDuring development and verificationNo
BillingAfter verification is approvedYes

You must complete the publisher verification process before a Billing key becomes available.

Getting a Sandbox key

  1. Sign up as a Publisher at adstract.ai.
  2. Create a platform and ensure it is active.
  3. Navigate to API Keys and create a Sandbox key.

See Sandbox Key for the full walkthrough.

Getting a Billing key

After your account is verified:

  1. Navigate to API Keys.
  2. Create a Billing key.
  3. Replace the X-Adstract-API-Key value in your requests.

See Billing Key for the full walkthrough.

Authentication failures

If authentication fails, the exact HTTP status code depends on the endpoint and the specific failure condition.

See:

Next steps