Skip to main content
POST
Request an ad

Path Parameters

tagid
string<uuid>
required

Required ad unit ID (UUID). Copy the ID of the ad unit serving this placement from Ad Manager's Inventory > Ad Units.

Body

application/json
ad_size
integer<int32>[][] | null

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.

Required array length: 2 elements
app
object | null

Optional application context. Ad requests use this object to identify the app environment; site is unnecessary. If both are sent, app takes precedence. Recommendation requests currently ignore it. All fields inside this object are optional.

device
object | null

The 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.

Example:
ext
object | null

Optional ad serving options. Set echo_user to true to include user in a successful ad response.

site
object | null

Optional website context. For ad requests from the web, send the page and domain when available; app is unnecessary. Providing this object without app identifies a web ad request. Recommendation requests currently ignore it. All fields inside this object are optional.

targeting
any

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.

user
object | null

Optional user context. Send the same stable user.id for the same user.

Example:

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.

version
string
required

Version of the SDK API.

ad
object | null

Served ad. Absent in passback and error responses.

errorcode
string | null

Error code if the request failed.

ext
object | null

Tracking, experiment assignment, or passback details, depending on the response.

user
object | null

Echoed User object from the ad request.