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

# List your discount codes

> Lists the discount codes on your account, with the services they're applied to. With `teamID`, this needs the `billing.manage` permission.



## OpenAPI

````yaml /spec/platform-billing.yaml get /v1/discount-codes
openapi: 3.0.1
info:
  title: Billing & Subscription
  version: 1.0.0
  description: |
    Check your balance and costs, add credit, download invoices and receipts,
    manage your subscription plan, and apply discount codes.

    All amounts are in Toman (IRT).

    With `teamID`, these endpoints work on the team's billing. Most of them
    need the `billing.manage` permission in the team; the description of each
    endpoint says which permission it needs.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: Balance & Usage
    description: Balance, current costs and service counts.
  - name: Payments
    description: Add credit and list past payments.
  - name: Invoices & Receipts
    description: Monthly billing invoices and payment receipts.
  - name: Subscription
    description: View and change the account's subscription plan.
  - name: Discount Codes
    description: Check and apply discount codes.
paths:
  /v1/discount-codes:
    get:
      tags:
        - Discount Codes
      summary: List your discount codes
      description: >-
        Lists the discount codes on your account, with the services they're
        applied to. With `teamID`, this needs the `billing.manage` permission.
      operationId: listDiscountCodes
      parameters:
        - $ref: '#/components/parameters/TeamID'
        - $ref: '#/components/parameters/Page'
        - $ref: '#/components/parameters/Count'
        - name: serviceType
          in: query
          required: false
          description: Only list codes applied to this kind of service.
          schema:
            $ref: '#/components/schemas/DiscountServiceType'
      responses:
        '200':
          description: Your discount codes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  totalDiscountCodes:
                    type: integer
                  discountCodes:
                    type: array
                    items:
                      $ref: '#/components/schemas/DiscountCode'
              example:
                totalDiscountCodes: 1
                discountCodes:
                  - _id: '000000000000000000000090'
                    code: <discount-code>
                    discountPercentage: 20
                    maxUsageAmount: 500000
                    currentUsageAmount: 0
                    validUntil: '2026-06-01T00:00:00.000Z'
                    expiresAt: '2026-02-01T08:00:00.000Z'
                    timespan: 30
                    serviceType: project
                    projects:
                      - _id: '000000000000000000000050'
                        project_id: my-app
                    databases: []
                    mailServers: []
                    buckets: []
                    vms: []
                    ais: []
                    createdAt: '2026-01-01T08:00:00.000Z'
                    updatedAt: '2026-01-02T08:00:00.000Z'
        '400':
          $ref: '#/components/responses/ValidationOrTeamIDError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/TeamForbidden'
components:
  parameters:
    TeamID:
      name: teamID
      in: query
      required: false
      description: >-
        Run the request in the context of a team you belong to, instead of your
        personal account.
      schema:
        $ref: '#/components/schemas/ObjectID'
      example: '000000000000000000000002'
    Page:
      name: page
      in: query
      required: false
      description: Page number, starting at 1.
      schema:
        type: integer
        minimum: 1
        default: 1
    Count:
      name: count
      in: query
      required: false
      description: Items per page.
      schema:
        type: integer
        minimum: 1
        default: 10
  schemas:
    DiscountServiceType:
      type: string
      enum:
        - project
        - database
        - mailServer
        - bucket
        - vm
        - ai
    DiscountCode:
      type: object
      description: >-
        Exactly one of `projects`, `databases`, `mailServers`, `buckets`, `vms`
        or `ais` lists a service once the code is applied.
      properties:
        _id:
          type: string
        code:
          type: string
        discountPercentage:
          type: number
        maxUsageAmount:
          type: number
          description: The most the code can discount in total.
        currentUsageAmount:
          type: number
          description: How much the code has discounted so far.
        validUntil:
          type: string
          format: date-time
          description: Last moment the code can be applied.
        expiresAt:
          type: string
          format: date-time
          description: When the discount ends, once applied.
        timespan:
          type: integer
          description: How many days the discount lasts once applied.
        serviceType:
          type: string
        applicability:
          type: string
          description: '`new` if the code only applies to services created after it.'
          enum:
            - new
            - current
            - all
        projects:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
              project_id:
                type: string
        databases:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
              hostname:
                type: string
        mailServers:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
              domain:
                type: string
        buckets:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
              name:
                type: string
        vms:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
              name:
                type: string
        ais:
          type: array
          items:
            type: object
            properties:
              _id:
                type: string
              name:
                type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ObjectID:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: 24-character hexadecimal ID.
    Error:
      type: object
      description: Standard error body.
      properties:
        statusCode:
          type: integer
        error:
          type: string
          description: HTTP status text.
        message:
          type: string
          description: What went wrong.
        data:
          type: object
          nullable: true
          description: >-
            Extra details. When present, `code` is a stable, machine-readable
            error code.
          properties:
            code:
              type: string
    AuthError:
      type: object
      description: Error body returned when the API token is rejected.
      properties:
        error:
          type: string
  responses:
    ValidationOrTeamIDError:
      description: >-
        A parameter or the body is invalid (`message` says which), or `teamID`
        isn't a valid ID.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            validation:
              summary: Invalid parameter
              value:
                statusCode: 400
                error: Bad Request
                message: '"count" must be greater than or equal to 1'
            invalidTeamID:
              summary: Invalid team ID
              value:
                statusCode: 400
                error: Bad Request
                message: Invalid team ID.
                data: null
    Unauthorized:
      description: The API token is missing, invalid or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            error: Unauthorized.
    TeamForbidden:
      description: >-
        With `teamID`: you aren't a member of the team (`team_not_found`), or
        your role doesn't have the required permission (`no_permission`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            teamNotFound:
              summary: Not a team member
              value:
                statusCode: 403
                error: Forbidden
                message: Team not found
                data:
                  code: team_not_found
            noPermission:
              summary: Missing permission
              value:
                statusCode: 403
                error: Forbidden
                message: You do not have permission to access this resource.
                data:
                  code: no_permission
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Send your API token as `Authorization: Bearer <api-token>`.'

````

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