> 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/es/api-publica-de-exoclick/api-manual-postman-examples.md).

# Ejemplos de Postman

## Resumen

Esta guía proporciona instrucciones paso a paso para autenticarse y crear campañas mediante la API de ExoClick usando Postman. Todos los ejemplos especifican el tipo de solicitud, los encabezados y el formato del cuerpo requeridos para cada endpoint.

## Autenticación (Inicio de sesión)

Puedes autenticarte usando las credenciales de tu cuenta o un Token de API permanente. Ambos devuelven un Bearer Token temporal utilizado para todas las solicitudes posteriores.

{% tabs %}
{% tab title="Inicio de sesión con nombre de usuario y contraseña" %}
**Tipo de solicitud:** `POST`\
**URL:** `https://api.exoclick.com/v2/login`

**Encabezados:**

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

**Cuerpo (JSON sin procesar):**

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

{% endtab %}

{% tab title="Inicio de sesión con token de API" %}
Usa esto si generaste un token en tu panel de ExoClick (Perfil > Tokens de API).

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

**Encabezados:**

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

**Cuerpo (JSON sin procesar):**

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

{% endtab %}
{% endtabs %}

## Flujo de creación de campaña banner 300x250

Sigue estos pasos en el orden exacto. Ten en cuenta la transición de JSON a Form-Data en los pasos finales.

{% stepper %}
{% step %}

### Crear URL de página de destino (Biblioteca)

Registra tu URL de destino. Los banners estándar requieren un `id_library_url`.

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

**Encabezados:**

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

**Cuerpo (JSON sin procesar):**

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

**Resultado:** Guarda el `"id"` (por ejemplo, `6512406`).
{% endstep %}

{% step %}

### Subir imagen (Biblioteca)

Registra tu recurso creativo. La imagen debe ser exactamente 300x250.

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

**Encabezados:**

```
Authorization: Bearer YOUR_TOKEN
```

**Cuerpo (form-data):**

| Clave  | Tipo    | Valor                                     |
| ------ | ------- | ----------------------------------------- |
| `file` | Archivo | Selecciona tu archivo de imagen (300x250) |
| `type` | Texto   | `image`                                   |

**Resultado:** Guarda el `"id"` (por ejemplo, `6884966`).
{% endstep %}

{% step %}

### Crear estructura de campaña

Configura la segmentación, el presupuesto y la `img_banner` plantilla.

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

**Encabezados:**

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

**Cuerpo (JSON sin procesar):**

```json
{
  "name": "Banner 300x250 de producción",
  "status": 0,
  "advertiser_ad_type": 0,
  "media_storage_template": "img_banner",
  "size": "300x250",
  "categories": {
    "type": "targeted",
    "elements": [97, 98, 99]
  },
  "countries": {
    "type": "targeted",
    "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:** Guarda el `"id"` (por ejemplo, `8140060`).
{% endstep %}

{% step %}

### Añadir la variante

Vincula la URL (Paso 1) y la imagen (Paso 2) con la campaña (Paso 3).

**Tipo de solicitud:** `POST`\
**URL:** `https://api.exoclick.com/v2/campaigns/8140060/variation`\
\&#xNAN;*(Reemplaza `8140060` con el ID real de tu campaña del Paso 3)*

**Encabezados:**

```
Authorization: Bearer YOUR_TOKEN
```

**Cuerpo (form-data):**

| Clave             | Tipo  | Valor                    |
| ----------------- | ----- | ------------------------ |
| `id_library_url`  | Texto | `6512406` *(del Paso 1)* |
| `id_library_file` | Texto | `6884966` *(del Paso 2)* |
| `active`          | Texto | `1`                      |

Todos los IDs devueltos en cada paso deben guardarse y usarse en solicitudes posteriores. Recuerda reemplazar `YOUR_TOKEN`, las rutas de archivo y los IDs con tus valores reales.
{% 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 dynamically by asking a question.

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

```
GET https://docs.exoclick.com/api/es/api-publica-de-exoclick/api-manual-postman-examples.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
