# Overview

## Authentication

The Adrapid API uses authentication tokens to authenticate requests. You can view and rotate your token in your [account details](<https://app.adrapid.com/account >) in the API section. This token is used in the **Headers** section of your HTTP requests:

```
curl -H "Authorization: Bearer [YOUR_TOKEN]"
```

## Documentation

The full API docs are presented in swagger format and be accessed [here](https://user-api-docs.adrapid.com/).

### Create a banner using the API

Before you create a banner you need to select the template you want to use a base for your banner. There is a list of pre-made templates ready to be used, you can access to them by navigating to library->templates.

When you have decided what template you want to use you need to copy its template id, it can be find in the top part of the sidebar.

<div align="left"><img src="/files/-MTLlzcPrs-9aHfTuq4Z" alt="Template id"></div>

Once you have your template id you are ready to create your first banner!&#x20;

```
curl -H "Authorization: Bearer [YOUR_TOKEN]" -d '{"templateId": "[YOUR_TEMPLATE_ID]", "modes":{"png":true}}' -H "Content-Type: application/json" -X POST https://api.adrapid.com/banners
```

Response will be a banner object with no files.

```
{
    "id": "[BANNER_ID]",
    "status": "exporting",
    "files": null,
    ...
}
```

#### Getting the resulting banner file

Creation of a banner is an async operation, so you need to do polling to the banner endpoint until its status is ready, this can take between some milliseconds up to a few seconds depending on the amount of banners created in the petition and the current load of the system.

```
curl -H "Authorization: Bearer [YOUR_TOKEN]" https://api.adrapid.com/banners/[YOUR_BANNER_ID]
```

When the banner is ready the field files will be populated with all the formats requested. The direct url to download or preview the resulting banner file will be under url field inside files.

```
{
    "id": "[BANNER_ID]",
    "status": "ready",
    "files": [
        {
            "id": "[BANNER_FILE_ID]",
            "url": "https://banners.adrapid.com/57fa1ddf-67ca-4959-935d-d0a2ef961e4c/banners/ebd63334-64a6-4858-9ec6-82e146f0456b/base.png",
            "status": "ready",
            ...
        }
    ],
    ...
}
```

### &#x20;Overrides

We have created a banner in the format that we need, but that banner have the same content than the original template. In order to change the template content in the resulting banner we need to use the parameter **overrides** when we create the banner. With overrides we can change texts, images and and a lot of properties that can be set using css.

```
{
    ...
    "overrides": {
        "Text_item_1": {
            "text":"Hello world!",
            "css": {
              "color":"red"
            }
        },
        "logo": {
            "url": "[IMAGE_URL]"
        }
    }
    ...
}
```

#### Item name

To override an element we need the item name, the item name can be found in the editor->sidebar->item item names can be edited.

<div align="left"><img src="/files/-MTdzQs7_8pGlz0ZLwf0" alt=""></div>

### Modes

Banners can be created in different formats through the modes parameter, you can set multiple modes in one banner creation and you will get a different file for each mode.

#### html5

Will create an html5 banner with animations and optimised to be used on most ad servers out of the box.

**png, webp, jpeg**

Image formats supported.

**video**

Video format, video format support some extra properties to set the quality of the video. fps sets the fps of the resulting video and crf (Constant Rate Factor) sets the quality.

```
{
    ...
    "modes": {
        "video": {
            "fps":  15,
            "crf": 28
        }
    ...    
}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adrapid.com/api/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
