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

# Get a Campaign

> Returns a single campaign based on the ID supplied

## Get a Campaign

Returns a single campaign by operation ID. Requires scope `campaigns:read`.

The `{id}` path parameter is the MongoDB **Operation** `_id`, not the offer document id.

### HTTP Request

```http theme={null}
GET https://api-beta.lomadee.com.br/affiliate/campaigns/{campaignId}
```

### Campaign Status Field

| Status      | Description                                       |
| ----------- | ------------------------------------------------- |
| `onTime`    | Active campaign within period                     |
| `expired`   | Campaign expired (`period.endAt` passed)          |
| `scheduled` | Campaign scheduled (`period.startAt` not reached) |

### Response

```json theme={null}
{
  "data": {
    "id": "operation-id",
    "name": "Campaign name",
    "type": "Offer",
    "status": "onTime"
  }
}
```

### Example

```bash theme={null}
curl -X GET "https://api-beta.lomadee.com.br/affiliate/campaigns/507f1f77bcf86cd799439011" \
  -H "x-api-key: your-api-key"
```


## OpenAPI

````yaml GET /affiliate/campaigns/{id}
openapi: 3.1.0
info:
  title: Lomadee Public API
  description: >-
    REST API for affiliate brands, channels, campaigns, orders, products, and
    link shortener. Authenticate with x-api-key. Rate limit: 60 req/60s per key
    and IP.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.lomadee.com.br/
    description: Production — target URL for all integrations
  - url: https://api-beta.lomadee.com.br/
    description: Beta (legacy) — available during transition; will be retired soon
security:
  - x-api-key: []
paths:
  /affiliate/campaigns/{id}:
    get:
      description: Returns a single campaign based on the ID supplied
      parameters:
        - name: id
          in: path
          description: ID of campaign to return
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Campaign response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AffiliateCampaign'
          headers:
            X-RateLimit-Limit:
              description: Max requests per window
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Remaining requests in window
              schema:
                type: integer
            X-RateLimit-Reset:
              description: Unix timestamp when window resets
              schema:
                type: integer
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Campaign not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 404
                message: Campaign with ID {campaignId} not found or not available
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    AffiliateCampaign:
      required: []
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              description: The id of the campaign
              type: string
            name:
              description: The name of the campaign
              type: string
            period:
              description: >-
                The period of the campaign. If this field is null, the campaign
                is a permanent campaign.
              type: object
              properties:
                startAt:
                  type: string
                  description: The start date of the campaign
                endAt:
                  type: string
                  description: The end date of the campaign
            type:
              description: >-
                The type of the campaign. Possible values: `PersonalCoupon`,
                `GenericCoupon`, `Offer`
              type: string
            offerType:
              description: >-
                Type of offer (when type is Offer). Possible values:
                `Spreadsheet`, `Url`
              type: string
              enum:
                - Spreadsheet
                - Url
            categories:
              description: The categories of the campaign
              type: array
              items:
                type: string
            description:
              description: The description of the campaign
              type: string
            code:
              description: The coupon code of the campaign
              type: string
            url:
              description: The URL of the campaign
              type: string
            organizationId:
              description: The id of the brand that the campaign belongs to
              type: string
            isHighlight:
              description: If this campaign is a highlight campaign
              type: boolean
            status:
              description: >-
                The status of the campaign, calculated automatically based on
                the period. Possible values: `onTime` (active campaign within
                period), `expired` (campaign expired - period.endAt has passed),
                `scheduled` (campaign scheduled - period.startAt has not arrived
                yet)
              type: string
              enum:
                - onTime
                - expired
                - scheduled
            createdAt:
              description: The date and time the campaign was created
              type: string
            channels:
              $ref: '#/components/schemas/Channels'
            mediaKit:
              $ref: '#/components/schemas/MediaKit'
        meta:
          $ref: '#/components/schemas/Meta'
    Error:
      required:
        - message
        - error
        - statusCode
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        error:
          type: string
          description: Error type/category
        statusCode:
          type: integer
          format: int32
          description: HTTP status code
    Channels:
      description: >-
        List of all your channels. Each channel generates a URL with its
        specific parameters. If a channel has any brand restrictions, the link
        will not be generated and the message field will be filled with the
        restriction type.
      type: array
      items:
        type: object
        properties:
          id:
            type: string
            description: Channel identifier
          name:
            type: string
            description: Channel name
          availableChannel:
            type: object
            properties:
              id:
                type: string
                description: Available channel identifier
              name:
                type: string
                description: Available channel name
          shortUrls:
            type: array
            items:
              type: string
              description: Shortened URLs for the channel
          message:
            type: string
            description: >-
              If the channel has any brand restrictions, the link will not be
              generated and this field will contain the restriction type.
              Possible values: 

               `This channel is not allowed by the organization.` 
               
               `Organization approval is required to generate links.`
    MediaKit:
      type: object
      nullable: true
      properties:
        banners:
          type: array
          items:
            type: string
          nullable: true
          description: Array of banner URLs available for marketing
        emailMarketing:
          nullable: true
          description: Email marketing materials (when available)
      description: >-
        Marketing materials available for affiliates. Returns null when not
        available.
    Meta:
      type: object
      properties:
        total:
          type: integer
        page:
          type: integer
        limit:
          type: integer
        totalPages:
          type: integer
  responses:
    Unauthorized:
      description: API key missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
    Forbidden:
      description: Valid key without required scope
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
    TooManyRequests:
      description: Rate limit exceeded (60 req/60s per key + IP)
      headers:
        X-RateLimit-Limit:
          description: Max requests per window
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Remaining requests in window
          schema:
            type: integer
        X-RateLimit-Reset:
          description: Unix timestamp when window resets
          schema:
            type: integer
        Retry-After:
          description: Seconds until retry
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              message:
                type: string
              code:
                type: string
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key

````