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

# Track Impressions: POST /api/v1/campaigns/impression

> Record a campaign impression each time an ad is displayed to a user. Send campaignId, placement, location, and device in the JSON request body.

Call this endpoint each time you display a campaign to a user. An impression event tells the ENS Ads platform that a specific campaign was rendered in your application, which allows advertisers to measure reach and delivery. You should fire this request immediately after a campaign becomes visible to the user — not before rendering, and not after a click.

<Note>
  This endpoint must be called from your server. Your API key must never appear in client-side or user-facing code. Route impression events through your backend to keep your credentials secure.
</Note>

## Endpoint

```
POST https://ads.enslive.live/api/v1/campaigns/impression
```

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

## Request example

```bash theme={null}
curl -X POST "https://ads.enslive.live/api/v1/campaigns/impression" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": 1,
    "placement": "header_banner",
    "location": "US",
    "device": "mobile"
  }'
```

## Body parameters

<ParamField body="campaignId" type="integer" required>
  The unique ID of the campaign that was displayed. Use the `id` field returned by the [Fetch Campaigns](/api/fetch-campaigns) endpoint.
</ParamField>

<ParamField body="placement" type="string" required>
  The placement ID where the campaign was rendered (e.g., `header_banner`, `article_inline`). This must match the placement you used when fetching the campaign.
</ParamField>

<ParamField body="location" type="string">
  The ISO 3166-1 alpha-2 country code of the user's geographic location (e.g., `US`, `GB`, `FR`). Including this improves reporting accuracy for advertisers.
</ParamField>

<ParamField body="device" type="string">
  The device type of the user viewing the campaign. Accepted values: `mobile`, `desktop`, `tablet`.
</ParamField>

## Response

### 200 — Success

```json theme={null}
{
  "status": "success",
  "message": "Impression tracked successfully"
}
```

### 400 — Bad Request

Returned when a required field is missing from the request body.

```json theme={null}
{
  "status": "error",
  "message": "campaignId is required"
}
```

### 401 — Unauthorized

Returned when the `Authorization` header is missing or the API key is invalid.

```json theme={null}
{
  "status": "error",
  "message": "unauthorized"
}
```

<Warning>
  Call this endpoint exactly once per display event per user. Sending duplicate impression events for the same campaign view inflates delivery metrics and violates the platform's usage terms. Do not call it in polling loops, on re-renders, or more than once per page load for a given campaign.
</Warning>
