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

# Banner Ads

> Learn how to request banner ads using the REST API.

Banner ads are returned in HTML format, allowing direct rendering in web projects. For other platforms, you can use WebView for rendering.

## Request Parameters

### Headers

<ParamField header="Authorization" type="string" required>
  App Key (found in adrop\_service.json)
</ParamField>

### Query Parameters

<ParamField query="unit" type="string" required>
  Ad unit ID
</ParamField>

<ParamField query="uid" type="string">
  User unique identifier. Used for frequency capping and targeting.
</ParamField>

<ParamField query="pf" type="string">
  Platform. One of `android`, `ios`, `web`
</ParamField>

<ParamField query="lcl" type="string">
  Locale. e.g., `en_US`, `ko_KR`
</ParamField>

<ParamField query="theme" type="string">
  Theme mode. `light` or `dark`
</ParamField>

<ParamField query="contextId" type="string">
  Context targeting ID (required for targeted ads)
</ParamField>

<ParamField query="adId" type="string">
  Advertising identifier (required for device preview)
</ParamField>

## Response

<ResponseField name="code" type="integer" required>
  Response code. `0` indicates success.
</ResponseField>

<ResponseField name="msg" type="string" required>
  Response message
</ResponseField>

<ResponseField name="result" type="object">
  Ad data

  <Expandable title="result properties">
    <ResponseField name="id" type="string">
      Ad ID
    </ResponseField>

    <ResponseField name="format" type="string">
      Ad format. `banner`
    </ResponseField>

    <ResponseField name="type" type="string">
      Ad type. `display` or `video`
    </ResponseField>

    <ResponseField name="unit" type="string">
      Ad unit ID
    </ResponseField>

    <ResponseField name="w" type="integer">
      Ad width (px)
    </ResponseField>

    <ResponseField name="h" type="integer">
      Ad height (px)
    </ResponseField>

    <ResponseField name="ad" type="string">
      HTML ad content
    </ResponseField>

    <ResponseField name="target" type="string">
      Browser target. `external` or `internal`
    </ResponseField>

    <ResponseField name="carouselActivated" type="boolean">
      Carousel activation status
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
      "code": 0,
      "msg": "OK",
      "result": {
          "id": "ad_123456",
          "format": "banner",
          "type": "display",
          "unit": "YOUR_UNIT_ID",
          "w": 320,
          "h": 100,
          "ad": "<div>...</div>",
          "target": "external",
          "carouselActivated": false
      }
  }
  ```
</ResponseExample>

***

## Rendering

### Web Rendering

```html theme={null}
<div id="ad-container"></div>

<script>
fetch('https://api-v2.adrop.io/request?unit=YOUR_UNIT_ID&uid=USER_ID&pf=web', {
    headers: { 'Authorization': 'YOUR_APP_KEY' }
})
.then(res => res.json())
.then(data => {
    if (data.code === 0) {
        document.getElementById('ad-container').innerHTML = data.result.ad;
    }
});
</script>
```

### Carousel Banners

When using carousel banners, add the following script:

```html theme={null}
<script src="https://storage.adrop.io/js/adrop-carousel-1.0.1.min.js"></script>
```

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Native Ads" icon="puzzle-piece" href="/sdk/rest-api/native">
    Implement ads with custom UI
  </Card>

  <Card title="Error Codes" icon="triangle-exclamation" href="/sdk/rest-api/errors">
    Error handling guide
  </Card>
</CardGroup>
