> For the complete documentation index, see [llms.txt](https://docs.exoclick.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.exoclick.com/api/pt/api-publica-exoclick/api-manual-postman-examples.md).

# Exemplos no Postman

## Visão geral

Este guia fornece instruções passo a passo para autenticar e criar campanhas através da API ExoClick usando o Postman. Todos os exemplos especificam o tipo de pedido, os cabeçalhos e o formato do corpo necessários para cada endpoint.

## Autenticação (Login)

Pode autenticar-se usando as credenciais da sua conta ou um API Token permanente. Ambos devolvem um Bearer Token temporário usado em todos os pedidos subsequentes.

{% tabs %}
{% tab title="Login com Nome de Utilizador e Palavra-passe" %}
**Tipo de pedido:** `POST`\
**URL:** `https://api.exoclick.com/v2/login`

**Cabeçalhos:**

```
Content-Type: application/json
```

**Corpo (JSON bruto):**

```json
{
  "username": "YOUR_USERNAME",
  "password": "YOUR_PASSWORD"
}
```

{% endtab %}

{% tab title="Login com API Token" %}
Use isto se gerou um token no seu ExoClick Dashboard (Perfil > API Tokens).

**Tipo de pedido:** `POST`\
**URL:** `https://api.exoclick.com/v2/login`

**Cabeçalhos:**

```
Content-Type: application/json
```

**Corpo (JSON bruto):**

```json
{
  "api_token": "YOUR_API_TOKEN"
}
```

{% endtab %}
{% endtabs %}

## Fluxo de criação da campanha de banner 300x250

Siga estes passos pela ordem exata. Note a transição de JSON para Form-Data nos passos finais.

{% stepper %}
{% step %}

### Criar URL da página de destino (Biblioteca)

Regista a sua URL de destino. Os banners padrão requerem um `id_library_url`.

**Tipo de pedido:** `POST`\
**URL:** `https://api.exoclick.com/v2/library/url`

**Cabeçalhos:**

```
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
```

**Corpo (JSON bruto):**

```json
{
  "url": "https://your-landing-page.com"
}
```

**Resultado:** Guarde o valor devolvido `"id"` (por exemplo, `6512406`).
{% endstep %}

{% step %}

### Carregar imagem (Biblioteca)

Regista o seu criativo. A imagem tem de ter exatamente 300x250.

**Tipo de pedido:** `POST`\
**URL:** `https://api.exoclick.com/v2/library/file`

**Cabeçalhos:**

```
Authorization: Bearer YOUR_TOKEN
```

**Corpo (form-data):**

| Chave  | Tipo     | Valor                                        |
| ------ | -------- | -------------------------------------------- |
| `file` | Ficheiro | Selecione o seu ficheiro de imagem (300x250) |
| `type` | Texto    | `image`                                      |

**Resultado:** Guarde o valor devolvido `"id"` (por exemplo, `6884966`).
{% endstep %}

{% step %}

### Criar estrutura da campanha

Define a segmentação, o orçamento e o `img_banner` modelo.

**Tipo de pedido:** `POST`\
**URL:** `https://api.exoclick.com/v2/campaigns`

**Cabeçalhos:**

```
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
```

**Corpo (JSON bruto):**

```json
{
  "name": "Banner 300x250 Produção",
  "status": 0,
  "advertiser_ad_type": 0,
  "media_storage_template": "img_banner",
  "size": "300x250",
  "categories": {
    "type": "direcionado",
    "elements": [97, 98, 99]
  },
  "countries": {
    "type": "direcionado",
    "elements": [
      {
        "country": "USA",
        "regions": [0]
      }
    ]
  },
  "pricing": {
    "model": 4,
    "price": 300
  },
  "start_date": "2026-03-02",
  "daily_limit_type": 1,
  "max_daily_budget": 2000,
  "budget_delivery_mode": 1,
  "run_on_responsive_zones": 1
}
```

**Resultado:** Guarde o valor devolvido `"id"` (por exemplo, `8140060`).
{% endstep %}

{% step %}

### Adicionar a variação

Liga a URL (Passo 1) e a imagem (Passo 2) à campanha (Passo 3).

**Tipo de pedido:** `POST`\
**URL:** `https://api.exoclick.com/v2/campaigns/8140060/variation`\
*(Substitua `8140060` pelo ID real da sua campanha do Passo 3)*

**Cabeçalhos:**

```
Authorization: Bearer YOUR_TOKEN
```

**Corpo (form-data):**

| Chave             | Tipo  | Valor                    |
| ----------------- | ----- | ------------------------ |
| `id_library_url`  | Texto | `6512406` *(do Passo 1)* |
| `id_library_file` | Texto | `6884966` *(do Passo 2)* |
| `ativo`           | Texto | `1`                      |

Todos os IDs devolvidos em cada passo devem ser guardados e utilizados nos pedidos subsequentes. Lembre-se de substituir `YOUR_TOKEN`, os caminhos dos ficheiros e os IDs pelos seus valores reais.
{% endstep %}
{% endstepper %}


---

# 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.exoclick.com/api/pt/api-publica-exoclick/api-manual-postman-examples.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.
