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

# List the tenant's discount applications and pending assignments

> data, links and meta describe paginated applied history. pending_assignments lists
outstanding assignments with independent pending_meta and pending_links pagination.
An automatic reusable assignment can remain
pending for future invoices while also having entries in applied history.



## OpenAPI

````yaml get /v1/billing/discount-codes
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/billing/discount-codes:
    get:
      tags:
        - Billing
        - DiscountCode
      summary: List the tenant's discount applications and pending assignments
      description: >-
        data, links and meta describe paginated applied history.
        pending_assignments lists

        outstanding assignments with independent pending_meta and pending_links
        pagination.

        An automatic reusable assignment can remain

        pending for future invoices while also having entries in applied
        history.
      operationId: discountCode.index
      parameters:
        - name: page
          in: query
          description: Page number for applied discount history.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
        - name: per_page
          in: query
          description: Applied discount history rows per page (maximum 100).
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
            maximum: 100
        - name: pending_page
          in: query
          description: >-
            Page number for pending discount assignments, independent of applied
            history.
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
        - name: pending_per_page
          in: query
          description: Pending discount assignments per page (maximum 100).
          schema:
            type:
              - integer
              - 'null'
            minimum: 1
            maximum: 100
        - name: assigned_at_from
          in: query
          description: Include pending assignments at or after this timestamp.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: assigned_at_to
          in: query
          description: >-
            Include pending assignments through this timestamp or the end of
            this date.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: applied_at_from
          in: query
          description: Include applications at or after this timestamp.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: applied_at_to
          in: query
          description: Include applications through this timestamp or the end of this date.
          schema:
            type:
              - string
              - 'null'
            format: date-time
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      responses:
        '200':
          description: Paginated set of `BillingDiscountApplicationResource`
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/BillingDiscountApplicationResource'
                  links:
                    type: object
                    properties:
                      first:
                        type:
                          - string
                          - 'null'
                      last:
                        type:
                          - string
                          - 'null'
                      prev:
                        type:
                          - string
                          - 'null'
                      next:
                        type:
                          - string
                          - 'null'
                    required:
                      - first
                      - last
                      - prev
                      - next
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        minimum: 1
                      from:
                        type:
                          - integer
                          - 'null'
                        minimum: 1
                      last_page:
                        type: integer
                        minimum: 1
                      links:
                        type: array
                        description: Generated paginator links.
                        items:
                          type: object
                          properties:
                            url:
                              type:
                                - string
                                - 'null'
                            label:
                              type: string
                            active:
                              type: boolean
                          required:
                            - url
                            - label
                            - active
                      path:
                        type:
                          - string
                          - 'null'
                        description: Base path for paginator generated URLs.
                      per_page:
                        type: integer
                        description: Number of items shown per page.
                        minimum: 0
                      to:
                        type:
                          - integer
                          - 'null'
                        description: Number of the last item in the slice.
                        minimum: 1
                      total:
                        type: integer
                        description: Total number of items being paginated.
                        minimum: 0
                    required:
                      - current_page
                      - from
                      - last_page
                      - links
                      - path
                      - per_page
                      - to
                      - total
                  pending_assignments:
                    type: array
                    items:
                      $ref: '#/components/schemas/TenantDiscountAssignmentResource'
                  pending_meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                      last_page:
                        type: integer
                      per_page:
                        type: integer
                      total:
                        type: integer
                    required:
                      - current_page
                      - last_page
                      - per_page
                      - total
                  pending_links:
                    type: object
                    properties:
                      first:
                        type: string
                      last:
                        type: string
                      prev:
                        type:
                          - string
                          - 'null'
                      next:
                        type:
                          - string
                          - 'null'
                    required:
                      - first
                      - last
                      - prev
                      - next
                required:
                  - data
                  - links
                  - meta
                  - pending_assignments
                  - pending_meta
                  - pending_links
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    BillingDiscountApplicationResource:
      type: object
      properties:
        status:
          type: string
          description: An actual recorded discount application, not merely an assignment.
          const: applied
        proforma_invoice_number:
          type: string
        currency:
          type: string
        id:
          type: integer
        proforma_invoice_id:
          type: integer
        usage_type:
          type: string
        usage_type_label:
          type:
            - string
            - 'null'
        applied_amount:
          type: string
        applied_at:
          type:
            - string
            - 'null'
          format: date-time
        discount:
          $ref: '#/components/schemas/RelatedBillingDiscountResource'
      required:
        - status
        - id
        - proforma_invoice_id
        - usage_type
        - usage_type_label
        - applied_amount
        - applied_at
      title: BillingDiscountApplicationResource
    TenantDiscountAssignmentResource:
      type: object
      properties:
        status:
          type: string
          description: Assignment awaiting application; auto_apply assignments may recur.
          const: pending
        id:
          type: integer
        tenant_id:
          type: integer
        auto_apply:
          type: boolean
        assigned_at:
          type:
            - string
            - 'null'
          format: date-time
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        discount:
          $ref: '#/components/schemas/RelatedBillingDiscountResource'
      required:
        - status
        - id
        - tenant_id
        - auto_apply
        - assigned_at
        - created_at
      title: TenantDiscountAssignmentResource
    RelatedBillingDiscountResource:
      type: object
      properties:
        id:
          type: integer
        code:
          type:
            - string
            - 'null'
        application_mode:
          type: string
        name:
          type: string
        discount_type:
          type: string
        discount_type_label:
          type:
            - string
            - 'null'
        value:
          type: string
      required:
        - id
        - code
        - application_mode
        - name
        - discount_type
        - discount_type_label
        - value
      title: RelatedBillingDiscountResource
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

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