> For the complete documentation index, see [llms.txt](https://docs.exads.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exads.com/api/ad-placement-api/ad-plac-request.md).

# Request

## Request Parameters

***

{% hint style="info" %}

* The request is made in JSON format using HTTP POST.
* It is possible to request many ad zones in a single request. Each zone will have a different ID, as you can see in the example below.
* You can add [keywords](https://docs-advanced.exads.com/docs/using-tags#method-2-tags-keywords-in-your-ad-zones) to your request that will manually match the ad zone to the type of advertising you want. If there are no keywords, the URL of the site will be used for matching.
  {% endhint %}

***

### User <a href="#user" id="user"></a>

Below are the parameters used in the request: The Ad Placement API can be called from either **client** side or **server** side:

* When using API on client side, the IP is not required, as it can be difficult to detect IP using frontend and Javascript. Instead, the API detects the IP from the connection when the request is made.
* Whether client or server is used, if an IP is passed, it will be prioritised over the one we detect.
* When called from the server side, pass the correct IP of the user explicitly as a parameter to ensure correct targeting. Otherwise, ads will be targeted for server location and this may cause impressions to be invalidated by an IP mismatch later.
* When using client-side implementation, the browser may perform a pre-flight request. To avoid this, use `Content-Type: text/plain` in the request header. This ensures that the browser qualifies the request as "simple" and therefore skips the pre-flight request.

&#x20;

<table data-header-hidden="false" data-header-sticky data-search="false"><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>The ID of the user</td></tr><tr><td>ip</td><td>The user IP address</td></tr><tr><td>ua</td><td>The User Agent: A string containing the user's browser/app and device/OS</td></tr><tr><td>language</td><td>Sets the language of the request using the <a href="https://www.andiamo.co.uk/resources/iso-language-codes/">standard two-character ISO code</a> plus an optional 2-character region code. e.g. <code>en-us</code> for United States English</td></tr><tr><td>referer</td><td>The address of the site where the ad will be shown</td></tr><tr><td>el</td><td>The Base64-encoded email of the user</td></tr><tr><td>gdpr</td><td>Privacy advised extensions (Optional)</td></tr><tr><td>buyeruids</td><td>List of buyer uids* (Optional)</td></tr></tbody></table>

\* `json_encoded` and then `base64_encoded` array

&#x20;

## Example <a href="#example" id="example"></a>

```json
{
    "platform1": "C9446DA7-BB76-44B9-B260-77E16530AA03",
    "platform2": "6372709574547581900",
    "platform3": "456621142600017315",
    "platform4": "3952063610783032691",
    "platform5": "KX3KMRTI-11-ZMP",
    "platform6": "402e4b19ff476fb23de2c97ebe62a47b",
    "platform7": "bu7zD7LkVT2huSwTSvou"
}
```

&#x20;

#### **user.gdpr**

| Parameter | Description                                                                                                        |
| --------- | ------------------------------------------------------------------------------------------------------------------ |
| gdpr      | This should be **0** if the caller believes that the user is not under GDPR, and **1** if the user is under GDPR . |
| consent   | This is the consent string required by the IAB Standards.                                                          |

&#x20;

### Zones <a href="#zones" id="zones"></a>

| Parameter         | Description                                                                                                                                                                                                           |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                | The ID of the ad zone                                                                                                                                                                                                 |
| sub               | The Sub ID of the ad zone (optional)                                                                                                                                                                                  |
| sub2              | Additional Sub ID (optional). See [Using Additional Sub IDs](/publishers/sites-and-zones/additional-subids.md).                                                                                                       |
| sub3              | Additional Sub ID (optional). See [Using Additional Sub IDs](/publishers/sites-and-zones/additional-subids.md).                                                                                                       |
| keywords          | You can insert [keywords](https://docs-advanced.exads.com/docs/using-tags#method-2-tags-keywords-in-your-ad-zones) into the code in your ad zone to manually match it to the type of advertising you want (optional). |
| block\_ad\_types  | Comma-separated list of ad types to block for this request (optional). See [Block Ad Types](/publishers/sites-and-zones/data-ad-block-types.md).                                                                      |
| custom\_targeting | If Custom Targeting is available, will filter campaigns based on the key/value structure provided. `{"custom_targeting": {"ex_car-brand": "mercedes", "ex_credit-score": "300"}}`                                     |

&#x20;

## Banner Request Example: JSON <a href="#banner-request-example-json" id="banner-request-example-json"></a>

```json
{
    "user": {
        "id": "abdef8u9",
        "ip": "10.42.0.1",
        "ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.63 Safari/537.36",
        "language": "en-US",
        "referer": "https://blabla.com",
        "gdpr" : {
                "gdpr" : 1,
                "consent": "CPAoZRHPArq3hBcADBENBJCgAAAAAAAAAAqIHKQAAOUgAAAA"
        },
        "buyeruids":"ewoJInBsYXRmb3JtMSI6ICJDOTQ0NkRBNy1CQjc2LTQ0QjktQjI2MC03N0UxNjUzMEFBMDMiLAoJInBsYXRmb3JtMiI6ICI2MzcyNzA5NTc0NTQ3NTgxOTAwIiwKCSJwbGF0Zm9ybTMiOiAiNDU2NjIxMTQyNjAwMDE3MzE1IiwKCSJwbGF0Zm9ybTQiOiAiMzk1MjA2MzYxMDc4MzAzMjY5MSIsCgkicGxhdGZvcm01IjogIktYM0tNUlRJLTExLVpNUCIsCgkicGxhdGZvcm02IjogIjQwMmU0YjE5ZmY0NzZmYjIzZGUyYzk3ZWJlNjJhNDdiIiwKCSJwbGF0Zm9ybTciOiAiYnU3ekQ3TGtWVDJodVN3VFN2b3UiCn0="  
    },
    "zones": [
        {
            "id": 1234567,
            "sub": 111,
            "sub2": 222,
            "sub3": 333,
            "keywords": "humour, general",
            "custom_targeting": {
              "ex_car-brand": "name",
              "ex_credit-score": "300"
            }
        },
        {
            "id": 1234576,
            "sub": 222,
            "custom_targeting": {
              "ex_car-brand": "name"
            }     
        },
        {
            "id": 1243567,
            "sub": 222             
        }
    ]
}
```

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.exads.com/api/ad-placement-api/ad-plac-request.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
