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

# Get campaign

> Fetch a campaign, its performance stats, and app link

## Overview

Returns the campaign, its performance stats, and an `href` to the campaign in the Targeter app. Requires a valid Bearer token from [`POST /auth/token`](/api-reference/endpoint/auth).

Use the `campaign_id` returned from [`POST /campaign`](/api-reference/endpoint/campaign/create) as the query parameter.

## Request

### Headers

* `Authorization: Bearer {jwt_token}` (required — obtained using your issued partner credentials)

### Query Parameters

<ParamField query="id" type="string" required>
  Campaign id returned from `POST /campaign`
</ParamField>

### Example Request

```bash theme={null}
curl "https://app.targeter.tech/api/campaign?id=AbC123xyz" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

## Response

### Success (200)

<ResponseField name="campaign" type="object">
  Campaign details including `id`, `name`, `reference_id`, `destination_url`, and `status` (`draft`, `setup`,
  `setup_failed`, `ready`, `scheduled`, `active`, `paused`, or `completed`)
</ResponseField>

<ResponseField name="stats" type="object">
  Performance metrics including `impressions`, `clicks`, `cpm`, `cpc`, `ctr`, `reach`, `frequency`, `conversion`,
  `cost_per_conversion`, `video_views`, `from_date`, and `to_date`
</ResponseField>

<ResponseField name="href" type="string (uri)">
  URL to the campaign in the Targeter app
</ResponseField>

```json theme={null}
{
    "campaign": {
        "id": "AbC123xyz",
        "name": "Majorstuenveien 14",
        "reference_id": "CLIENT-PROP-123456",
        "destination_url": "https://client-website.no/property/123",
        "status": "active"
    },
    "stats": {
        "impressions": 12500,
        "clicks": 340,
        "cpm": 120.0,
        "cpc": 4.41,
        "ctr": 0.0272,
        "reach": 8200,
        "frequency": 1.52,
        "conversion": 28,
        "cost_per_conversion": 53.57,
        "video_views": {
            "p25": 5469,
            "p50": 4031,
            "p75": 2472,
            "p100": 1031
        },
        "from_date": "2025-01-01",
        "to_date": "2025-01-31"
    },
    "href": "https://app.targeter.tech/campaigns/AbC123xyz"
}
```

## Error Responses

### 401 - Unauthorized

Missing `Authorization` header, or invalid or expired token.

```json theme={null}
{
    "error": "Missing or invalid Authorization header"
}
```

```json theme={null}
{
    "error": "Invalid or expired token"
}
```

### 404 - Campaign not found

```json theme={null}
{
    "error": "Campaign not found"
}
```

### 500 - Server Error

```json theme={null}
{
    "error": "Unexpected server error. Please try again later."
}
```


## OpenAPI

````yaml GET /campaign
openapi: 3.1.0
info:
  title: Targeter REST API
  description: >-
    Partner-facing HTTP API for Targeter: obtain a JWT and create or resolve
    campaigns from external systems.
  version: 1.2.0
  contact:
    name: Targeter API Support
servers:
  - url: https://app.targeter.tech/api
    description: >-
      Targeter platform instance (your base URL is provided with your
      credentials)
security:
  - BearerAuth: []
paths:
  /campaign:
    get:
      tags:
        - Campaigns
      summary: Get campaign and stats
      description: >-
        Returns the campaign, its performance stats, and an `href` to the
        campaign in the Targeter app. Requires a valid Bearer token from
        `/auth/token`.
      parameters:
        - name: id
          in: query
          required: true
          description: Campaign id returned from `POST /campaign`
          schema:
            type: string
          example: AbC123xyz
      responses:
        '200':
          description: Campaign found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignGetResponse'
        '401':
          description: Missing Authorization header, or invalid or expired token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Campaign not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CampaignGetResponse:
      type: object
      required:
        - campaign
        - stats
        - href
      properties:
        campaign:
          $ref: '#/components/schemas/Campaign'
        stats:
          $ref: '#/components/schemas/CampaignStats'
        href:
          type: string
          format: uri
          description: URL to the campaign in the Targeter app
          example: https://app.targeter.tech/campaigns/AbC123xyz
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Missing required field
        details:
          type: array
          description: Validation issues (Zod), when returned by the server
          items:
            type: object
            properties:
              path:
                type: array
                items:
                  type: string
                example:
                  - source
                  - reference_id
              message:
                type: string
                example: Reference ID is required
            required:
              - message
      required:
        - error
    Campaign:
      type: object
      required:
        - id
        - name
        - reference_id
        - destination_url
      properties:
        id:
          type: string
          description: Campaign id
          example: AbC123xyz
        name:
          type: string
          description: Campaign display name
          example: Majorstuenveien 14
        reference_id:
          type: string
          description: External reference id from the partner system
          example: CLIENT-PROP-123456
        destination_url:
          type: string
          format: uri
          description: Landing page URL
          example: https://client-website.no/property/123
        status:
          type: string
          description: Campaign status
          enum:
            - draft
            - setup
            - setup_failed
            - ready
            - scheduled
            - active
            - paused
            - completed
          example: active
    CampaignStats:
      type: object
      properties:
        impressions:
          type: integer
          description: Total ad impressions
          example: 12500
        clicks:
          type: integer
          description: Total ad clicks
          example: 340
        cpm:
          type: number
          description: Cost per mille (cost per 1,000 impressions)
          example: 120
        cpc:
          type: number
          description: Cost per click
          example: 4.41
        ctr:
          type: number
          description: Click-through rate (clicks / impressions)
          example: 0.0272
        reach:
          type: integer
          description: Unique people reached
          example: 8200
        frequency:
          type: number
          description: Average impressions per person reached
          example: 1.52
        conversion:
          type: integer
          description: Total conversions
          example: 28
        cost_per_conversion:
          type: number
          description: Average cost per conversion
          example: 53.57
        video_views:
          $ref: '#/components/schemas/VideoViewQuartiles'
        from_date:
          type: string
          format: date
          description: Start date of the stats period (inclusive)
          example: '2025-01-01'
        to_date:
          type: string
          format: date
          description: End date of the stats period (inclusive)
          example: '2025-01-31'
    VideoViewQuartiles:
      type: object
      properties:
        p25:
          type: integer
          description: Video views at 25% completion
          example: 5469
        p50:
          type: integer
          description: Video views at 50% completion
          example: 4031
        p75:
          type: integer
          description: Video views at 75% completion
          example: 2472
        p100:
          type: integer
          description: Video views at 100% completion
          example: 1031
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Use `Authorization: Bearer <token>`. Obtain the token from `POST
        /auth/token`.

````