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

# Get Coupon

> Retrieve details for a specific coupon

Retrieve a single coupon by ID with optional expanded fields.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the coupon to retrieve.
</ParamField>

## Query Parameters

<ParamField query="expand" type="string">
  Comma-separated list of related data to include in the response. Valid values: `affiliate`.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Always `true` for successful responses
</ResponseField>

<ResponseField name="data" type="object">
  The coupon object.

  <Expandable title="Data Object Properties">
    <ResponseField name="id" type="string">
      Unique identifier for the coupon
    </ResponseField>

    <ResponseField name="code" type="string">
      The coupon code (always uppercase)
    </ResponseField>

    <ResponseField name="affiliate_id" type="string">
      The ID of the affiliate who owns this coupon
    </ResponseField>

    <ResponseField name="program_id" type="string">
      The ID of the affiliate program this coupon belongs to
    </ResponseField>

    <ResponseField name="discount_type" type="string">
      Type of discount: `percentage` or `fixed`
    </ResponseField>

    <ResponseField name="discount_value" type="number">
      The discount amount. For percentage: 0-100. For fixed: amount in the specified currency.
    </ResponseField>

    <ResponseField name="duration" type="string">
      How long the discount applies: `forever`, `once`, or `repeating`
    </ResponseField>

    <ResponseField name="duration_in_months" type="integer | null">
      Number of months the discount repeats (only applicable when duration is `repeating`)
    </ResponseField>

    <ResponseField name="currency" type="string | null">
      Three-letter currency code (only applicable when discount\_type is `fixed`)
    </ResponseField>

    <ResponseField name="product_ids" type="array">
      Array of product IDs this coupon is restricted to. Empty array means all products.
    </ResponseField>

    <ResponseField name="provider" type="string | null">
      The primary payment provider for this coupon (e.g., `stripe`, `dodo`, `creem`).
    </ResponseField>

    <ResponseField name="provider_coupon_id" type="string | null">
      The coupon ID at the primary payment provider.
    </ResponseField>

    <ResponseField name="provider_promo_code_id" type="string | null">
      The promo code ID at the primary payment provider.
    </ResponseField>

    <ResponseField name="provider_records" type="array">
      Array of provider-specific coupon records. Each record contains:

      * `provider` (string): The payment provider name
      * `provider_coupon_id` (string): The coupon ID at this provider
      * `provider_promo_code_id` (string): The promo code ID at this provider
      * `created_at` (string): ISO 8601 timestamp of when the provider record was created
    </ResponseField>

    <ResponseField name="created_at" type="string">
      ISO 8601 timestamp of when the coupon was created
    </ResponseField>

    <ResponseField name="updated_at" type="string | null">
      ISO 8601 timestamp of when the coupon was last updated
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.affonso.io/v1/coupons/cpn_abc123" \
    -H "Authorization: Bearer sk_live_your_api_key"
  ```

  ```bash cURL with Expand theme={null}
  curl -X GET "https://api.affonso.io/v1/coupons/cpn_abc123?expand=affiliate" \
    -H "Authorization: Bearer sk_live_your_api_key"
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "id": "cpn_abc123",
      "code": "SAVE25",
      "affiliate_id": "aff_123",
      "program_id": "prg_789ghi",
      "discount_type": "percentage",
      "discount_value": 25,
      "duration": "forever",
      "duration_in_months": null,
      "currency": null,
      "product_ids": [],
      "provider": "stripe",
      "provider_coupon_id": "promo_abc123",
      "provider_promo_code_id": "pc_abc123",
      "provider_records": [
        {
          "provider": "stripe",
          "provider_coupon_id": "promo_abc123",
          "provider_promo_code_id": "pc_abc123",
          "created_at": "2024-01-15T10:30:00Z"
        }
      ],
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": null
    }
  }
  ```

  ```json Response with Expand theme={null}
  {
    "success": true,
    "data": {
      "id": "cpn_abc123",
      "code": "SAVE25",
      "affiliate_id": "aff_123",
      "program_id": "prg_789ghi",
      "discount_type": "percentage",
      "discount_value": 25,
      "duration": "forever",
      "duration_in_months": null,
      "currency": null,
      "product_ids": [],
      "provider": "stripe",
      "provider_coupon_id": "promo_abc123",
      "provider_promo_code_id": "pc_abc123",
      "provider_records": [
        {
          "provider": "stripe",
          "provider_coupon_id": "promo_abc123",
          "provider_promo_code_id": "pc_abc123",
          "created_at": "2024-01-15T10:30:00Z"
        }
      ],
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": null,
      "affiliate": {
        "id": "aff_123",
        "name": "John Doe",
        "email": "john@example.com",
        "tracking_id": "PARTNER123",
        "source": "api",
        "onboarding_completed": true,
        "program_id": "prg_789ghi",
        "group_id": null,
        "created_at": "2024-01-15T10:30:00Z"
      }
    }
  }
  ```
</ResponseExample>
