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

# Get a coupon

> One coupon with usage.

**Permission:** `coupons.show`



## OpenAPI

````yaml /docs/catalog-api.yaml get /coupons/{coupon}
openapi: 3.1.0
info:
  title: Spartan Catalog API
  version: '2026.11'
  description: >-
    Read only access to products, categories and coupons.


    All requests need an API key from **Admin, API** in the `Authorization:
    Bearer <key>` header. Replace `{domain}` with the domain of your Spartan
    installation. Successful responses use the envelope `{"data": ..., "meta":
    {"request_id": ...}}`; errors use `{"error": {"code", "message", "details"},
    "request_id"}`.
servers:
  - url: https://{domain}/api/application
    description: Your Spartan installation
    variables:
      domain:
        default: billing.example.com
        description: Domain of your Spartan installation, without https://
security:
  - bearerAuth: []
tags:
  - name: Products
  - name: Categories
  - name: Coupons
paths:
  /coupons/{coupon}:
    get:
      tags:
        - Coupons
      summary: Get a coupon
      description: |-
        One coupon with usage.

        **Permission:** `coupons.show`
      operationId: getCoupon
      parameters:
        - name: coupon
          in: path
          required: true
          description: Coupon id.
          schema:
            type: integer
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CouponDetail'
                  meta:
                    $ref: '#/components/schemas/Meta'
                required:
                  - data
                  - meta
              example:
                data:
                  id: 26
                  code: GIFT-8WR65RUF
                  name: Creator giveaway December
                  description: null
                  type: percentage
                  applies_to: all
                  value: 15
                  usage_limit: 1
                  used_count: 0
                  one_time_use: false
                  new_users_only: false
                  new_users_scope: any
                  target_product_ids: []
                  target_category_ids: []
                  allowed_billing_cycles: []
                  is_lifetime: false
                  status: active
                  is_currently_valid: true
                  expires_at: null
                  created_at: '2026-11-13T16:02:44.000000Z'
                  updated_at: '2026-11-13T16:02:44.000000Z'
                  usage_count: 0
                  recent_uses: []
                meta:
                  request_id: 29a5adf8-0665-4091-88e8-3a1cff183d4a
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    CouponDetail:
      allOf:
        - $ref: '#/components/schemas/Coupon'
        - type: object
          properties:
            usage_count:
              type: integer
              description: Number of times the coupon was used.
            recent_uses:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: integer
                  user:
                    oneOf:
                      - $ref: '#/components/schemas/UserReference'
                      - type: 'null'
                  created_at:
                    type: string
                    format: date-time
              description: Up to 100 most recent uses.
    Meta:
      type: object
      properties:
        request_id:
          type: string
          format: uuid
          description: Request id, also sent in the `X-Request-ID` response header.
      required:
        - request_id
    Coupon:
      type: object
      properties:
        id:
          type: integer
          description: Coupon id.
        code:
          type: string
        name:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
        type:
          type: string
          enum:
            - percentage
            - fixed
        applies_to:
          type: string
          description: >-
            What the discount applies to, for example `all`, `products`,
            `categories`.
        value:
          type: number
          description: Percentage or fixed amount.
        usage_limit:
          type:
            - integer
            - 'null'
        used_count:
          type: integer
        one_time_use:
          type: boolean
          description: One use per customer.
        new_users_only:
          type: boolean
        new_users_scope:
          type: string
        target_product_ids:
          type: array
          items:
            type: integer
        target_category_ids:
          type: array
          items:
            type: integer
        allowed_billing_cycles:
          type: array
          items:
            type: string
        is_lifetime:
          type: boolean
          description: Discount applies to every renewal.
        status:
          type: string
          enum:
            - active
            - inactive
        is_currently_valid:
          type: boolean
          description: Active, not expired and under its usage limit.
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    UserReference:
      type: object
      properties:
        id:
          type: integer
          description: User id.
        name:
          type: string
          description: Display name.
        email:
          type: string
          format: email
          description: Email address.
        avatar:
          type:
            - string
            - 'null'
          description: Avatar path or URL.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Machine readable error code, for example `unauthorized`,
                `forbidden`, `not_found`, `invalid_service_state`.
            message:
              type: string
              description: Human readable explanation.
            details:
              type: object
              properties: {}
              description: Extra context. An empty object for most errors.
              additionalProperties: true
          required:
            - code
            - message
            - details
        request_id:
          type: string
          format: uuid
          description: >-
            Request id. Also returned in the `X-Request-ID` header. Send your
            own with `X-Request-ID` to correlate logs.
      description: Error envelope returned by every failed request.
      required:
        - error
        - request_id
  responses:
    Unauthorized:
      description: Missing, invalid or inactive API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing:
              summary: No Authorization header
              value:
                error:
                  code: unauthorized
                  message: Bearer token required.
                  details: {}
                request_id: 9aca26ca-e06f-4725-8e4b-4385d6c03422
            invalid:
              summary: Unknown or inactive key
              value:
                error:
                  code: unauthorized
                  message: Invalid or inactive token.
                  details: {}
                request_id: 8802a669-6f06-453e-a1d8-0b81621167c3
    Forbidden:
      description: >-
        The key lacks the permission for this endpoint, or the request IP is not
        in the key allow list.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              summary: Missing permission
              value:
                error:
                  code: forbidden
                  message: Insufficient permissions for this action.
                  details: {}
                request_id: 191c51e1-03a3-448e-8df7-3c584be888b0
            ip_not_allowed:
              summary: IP not allowed
              value:
                error:
                  code: ip_not_allowed
                  message: Access denied from this IP address.
                  details: {}
                request_id: 3f6c2a1e-8b4d-4f7a-9c2e-5d1b7a9e0c42
    NotFound:
      description: The resource in the path does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: The requested resource was not found.
              details: {}
            request_id: cccbc627-4fd4-4727-889e-fa727c48792c
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key created in Admin, API. Send it as `Authorization: Bearer <key>`.
        Each key has its own permissions and optional IP allow list.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.