Request an ad
Returns an ad for the ad unit tag (tagid) and the request payload.
Selects the most suitable ad using line item, creative, and bidding strategy data, and returns the final ad decided through DSP responses and internal mediation.
Choose a starting request
Required: the ad unit ID (UUID) in the path as tagid, Content-Type: application/json, and a JSON object as the body. All body fields are optional. No access token or request version is required.
For service integration, start with the example for your environment. Use the values you have and leave unknown or unused fields out.
Web: start with site.domain and site.page.
App: start with app.bundle.
These are recommended starting examples, not required field sets. Send site for web or app for an app; there is no need to send both. The other fields inside these objects can be omitted.
Add fields only when needed
Add these fields to your starting request according to the features you use:
| Your integration needs | Add to the body |
|---|---|
| Per-user frequency caps | user.id: send the same stable ID for the same user. |
| Your server calls A2 on behalf of a user | device.ip and device.ua: send the actual user’s IP and User-Agent. When omitted, A2 derives them from the HTTP request, which may describe your server. |
| Ads with custom targeting | targeting: send key/value codes that match the conditions configured in Ad Manager. |
| A limit on acceptable creative sizes | ad_size: e.g., [[300, 250], [320, 50]], in [width, height] pixel pairs. Applies to A2-managed creatives. |
| The request user echoed in the response | ext.echo_user: true. Omit to keep the default false. |
You can leave all other fields shown in the schema out unless your integration needs them. Do not fill unused fields with empty objects or null.
Minimum test request
For an initial connectivity test, send {}. The JSON body itself is required, so do not leave the HTTP body empty. An ad must be configured and eligible for the request; an accepted request can still return no ad.
If both site and app are sent, app takes precedence. If neither is provided, A2 uses configured User-Agent rules to infer an app environment, falling back to web when no rule matches.
Response
The response includes ext.ad_log for event tracking. When no ad is available, the server returns HTTP 204 without a response body, or HTTP 200 with the ad unit’s passback if one is configured (see the 200 response).
Path Parameters
Body
Allowed ad sizes, given as [width, height] in pixels. For example, [[300, 250], [320, 50]] allows either size. A2-managed creatives must match one of these sizes. Omit to allow any size; an empty array ([]) selects no A2-managed creatives.
2 elementsThe user's IP address (ip) and User-Agent (ua). For ad requests, direct browser requests can omit this object; when your server requests ads on behalf of a user, send that user's values. Add geo if location information is available. Recommendation requests currently ignore it. This object and all its fields are optional.
Optional in the request format, but must match the configured conditions to select ads with custom targeting. Use key/value codes configured in Ad Manager, not display names. Send a JSON object with strings or arrays of strings as values, e.g., {"section": "sports", "interests": ["music", "travel"]}. Other value types are ignored when matching custom targeting.
Response
Returned ad, or the ad unit's passback when no ad is available and a passback tag is configured. A passback response has errorcode: "204", ext.passback, and no ad. An A/B assignment appears only when applicable; the example illustrates an assigned request.
