> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hakumedia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pedir un anuncio

> El pedido en JSON para cualquier zona.

<CodeGroup>
  ```bash GET theme={"dark"}
  curl "https://ads.hakumedia.ai/adserve/;ID=11111;setID=123456;type=json;size=300x250"
  ```

  ```bash POST theme={"dark"}
  curl -X POST "https://ads.hakumedia.ai/adserve" \
    -H "Content-Type: application/json" \
    -d '{
      "ID": 11111,
      "setID": 123456,
      "type": "json",
      "size": "300x250"
    }'
  ```
</CodeGroup>

En el GET los parámetros se separan con punto y coma.

## Parámetros

| Parámetro              | Obligatorio | Descripción                                                                           |
| ---------------------- | ----------- | ------------------------------------------------------------------------------------- |
| `ID`                   | Sí          | La cuenta                                                                             |
| `setID`                | Sí          | La zona                                                                               |
| `type`                 | Sí          | `json` devuelve el mejor anuncio. `jsonr` devuelve todos los que califican, ordenados |
| `size`                 | No          | Tamaño esperado, por ejemplo `300x250`                                                |
| `kw`                   | No          | Palabras clave                                                                        |
| `ip`, `ua`, `referrer` | No          | Datos del usuario final cuando el pedido sale del servidor                            |
| `pid`, `place`         | No          | Evitan repetir el mismo anuncio en una página                                         |

Los parámetros de targeting están en [Targeting](/ad-server/targeting).

## La respuesta

```json theme={"dark"}
{
  "status": "SUCCESS",
  "placements": {
    "placement_1": {
      "banner_id": 123456,
      "width": 300,
      "height": 250,
      "image_url": "https://ads.hakumedia.ai/getad.img/...",
      "redirect_url": "https://ads.hakumedia.ai/redirect.spark?...",
      "body": "",
      "target": "_blank",
      "accupixel_url": "https://ads.hakumedia.ai/adserve/...",
      "eligible_url": "https://ads.hakumedia.ai/adserve/...",
      "viewable_url": "https://ads.hakumedia.ai/adserve/...",
      "refresh_time": 10
    }
  }
}
```

| Campo                          | Descripción                                                   |
| ------------------------------ | ------------------------------------------------------------- |
| `image_url`                    | La imagen del anuncio                                         |
| `body`                         | El HTML, para anuncios nativos y HTML                         |
| `redirect_url`                 | El link del clic                                              |
| `accupixel_url`                | Registra la impresión. Si no se llama, la impresión no cuenta |
| `eligible_url`, `viewable_url` | Medición de visibilidad                                       |
| `refresh_time`                 | Segundos hasta pedir otro anuncio, en zonas con rotación      |
