AgentaOS Discount Codes API

The Discount Codes API from AgentaOS — 3 operation(s) for discount codes.

Operations 4

POST /gateway/discount-codes Create a discount code #
GET /gateway/discount-codes List discount codes #
GET /gateway/discount-codes/{id} Get one discount code #
POST /gateway/discount-codes/{id}/archive Stop a discount code #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/agentaos-ai:agentaos-ai-discount-codes-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

agentaos-ai-discount-codes-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Agentaos Ai Discount Codes API
  version: 1.0.0
  contact:
    name: AgentaOS
    url: https://agentaos.ai
  license:
    name: Proprietary
    url: https://agentaos.ai
  description: 'Operations tagged Discount Codes across 2 of this provider''s published API definitions: agentaos-ai-openapi.json, openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.agentaos.ai/api/v1
  description: Production
security:
- ApiKeyAuth: []
tags:
- name: Discount Codes
paths:
  /gateway/discount-codes:
    post:
      tags:
      - Discount Codes
      operationId: createDiscountCode
      summary: Create a discount code
      description: 'Set at most one of `percentOff` and `amountOffMinor`. Set neither and the code carries no discount at all: the buyer pays full price and you still see who it brought in. A code with no discount cannot carry a `name`, because the code itself is its name. Terms are fixed once created: to change them, archive this code and create another.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDiscountCodeRequest'
            example:
              code: LAUNCH20
              name: Launch week
              percentOff: 20
      responses:
        '201':
          description: Discount code created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCode'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
    get:
      tags:
      - Discount Codes
      operationId: listDiscountCodes
      summary: List discount codes
      description: Paginated, archived codes included. What each code takes off, and how many people used it, is on the single-code route.
      parameters:
      - $ref: '#/components/parameters/Limit100'
      - $ref: '#/components/parameters/Offset'
      responses:
        '200':
          description: A page of discount codes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCodeListResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
    servers:
    - url: https://api.agentaos.ai/api/v1
      description: Production
  /gateway/discount-codes/{id}:
    get:
      tags:
      - Discount Codes
      operationId: getDiscountCode
      summary: Get one discount code
      description: The only route that reports what a code takes off and how many subscribers used it.
      parameters:
      - $ref: '#/components/parameters/DiscountCodeId'
      responses:
        '200':
          description: The discount code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCodeDetail'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    servers:
    - url: https://api.agentaos.ai/api/v1
      description: Production
  /gateway/discount-codes/{id}/archive:
    post:
      tags:
      - Discount Codes
      operationId: archiveDiscountCode
      summary: Stop a discount code
      description: The code stops working immediately. Subscribers who already redeemed it keep the discount they were given.
      parameters:
      - $ref: '#/components/parameters/DiscountCodeId'
      responses:
        '200':
          description: The archived discount code.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCode'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    servers:
    - url: https://api.agentaos.ai/api/v1
      description: Production
components:
  schemas:
    CreateDiscountCodeRequest:
      type: object
      properties:
        code:
          type: string
          pattern: ^[A-Za-z0-9_-]{1,64}$
          description: What the buyer types. Letters, numbers, dashes and underscores.
        name:
          type: string
          maxLength: 120
          description: Your own label for the code, shown back to you on the single-code route. Not allowed on a code that carries no discount.
        percentOff:
          type: number
          minimum: 0.01
          maximum: 99
          description: Percentage off the first invoice. A code cannot take the whole price off — set up a free trial for that.
        amountOffMinor:
          type: integer
          minimum: 1
          description: Integer minor units. The currency is the plan's, or your settlement currency when the code is not tied to a plan. It comes off the total the buyer pays, VAT included.
        maxRedemptions:
          type: integer
          minimum: 1
        expiresAt:
          type: string
          format: date-time
          description: Must be in the future.
        linkId:
          type: string
          format: uuid
          description: Restrict the code to one subscription plan.
      required:
      - code
    DiscountCodeListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/DiscountCode'
        total:
          type: integer
        hasMore:
          type: boolean
      required:
      - items
      - total
      - hasMore
    DiscountCodeDetail:
      allOf:
      - $ref: '#/components/schemas/DiscountCode'
      - type: object
        properties:
          termsLabel:
            type: string
            description: 'What the code takes off, ready to print: "20% off", "€5.00 off", or "No discount — tracking only".'
          timesRedeemed:
            type: integer
            description: How many subscribers redeemed this code.
          maxRedemptions:
            type:
            - integer
            - 'null'
            description: The cap you set, or null for none.
        required:
        - termsLabel
        - timesRedeemed
        - maxRedemptions
    Error:
      type: object
      description: Every non-2xx response is JSON in this shape. Every response (success or error) also carries an `x-request-id` response header; send that header on your request to have your own id echoed back, otherwise the server mints one. On errors the same id is repeated in the `requestId` body field.
      properties:
        statusCode:
          type: integer
          description: Same as the HTTP status code.
        code:
          type: string
          description: 'Present on some refusals: a stable machine-readable reason, e.g. `live_key_required`.'
        message:
          description: Human-readable. A validation failure (400) returns an array of per-field messages instead of one string.
          anyOf:
          - type: string
          - type: array
            items:
              type: string
        errors:
          type: array
          description: 'Present on 400 validation failures: one entry per invalid field. The flat human-readable strings stay in `message` for back-compat; this is the machine-readable, per-field view.'
          items:
            type: object
            properties:
              field:
                type: string
                description: Name of the invalid field, dot-notated for nested properties (e.g. `checkoutFields.0.type`).
              message:
                type: string
                description: Validation messages for that field, joined with `, `.
            required:
            - field
            - message
        requestId:
          type: string
          description: Correlation id, identical to the `x-request-id` response header. Include it when contacting support. On success it is available on the header only, not the body.
        timestamp:
          type: string
          format: date-time
      required:
      - statusCode
      - message
      - timestamp
    DiscountCode:
      type: object
      description: Fully camelCase on the wire.
      properties:
        id:
          type: string
          format: uuid
        code:
          type: string
          description: As you typed it. Buyers may type it in any case.
        kind:
          type: string
          enum:
          - discount
          - tracking
          description: '`discount` changes the price. `tracking` changes nothing and only records who used it.'
        planLinkId:
          type:
          - string
          - 'null'
          format: uuid
          description: The one plan this code works on; null means every subscription plan you own.
        planName:
          type:
          - string
          - 'null'
        archivedAt:
          type:
          - string
          - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
        active:
          type: boolean
          description: 'Usable as far as this list can tell: not archived, and fully created. Whether the code has since been used up is answered by the single-code route.'
      required:
      - id
      - code
      - kind
      - planLinkId
      - planName
      - archivedAt
      - createdAt
      - active
  responses:
    NotFound:
      description: Resource not found (or not visible to your key; the two are not distinguished).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 404
            message: Payment link not found
            timestamp: '2026-08-06T12:00:00.000Z'
    Unauthorized:
      description: Missing or invalid `x-api-key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Invalid API key
            timestamp: '2026-08-06T12:00:00.000Z'
    BadRequest:
      description: A required field is missing, out of range, or the wrong type. `ValidationPipe` also rejects any field not in the documented schema.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            message: amount is required when creating a session without a link
            timestamp: '2026-08-06T12:00:00.000Z'
  parameters:
    Limit100:
      name: limit
      in: query
      required: false
      description: Items per page. Capped server-side at 100.
      schema:
        type: integer
        default: 20
        minimum: 1
        maximum: 100
    DiscountCodeId:
      name: id
      in: path
      required: true
      description: Discount code UUID (the `id` field from create or list).
      schema:
        type: string
        format: uuid
    Offset:
      name: offset
      in: query
      required: false
      description: Number of items to skip, for the next page.
      schema:
        type: integer
        default: 0
        minimum: 0
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Your secret key, from app.agentaos.ai -> Settings -> Developers -> API Keys. The key''s prefix is both its identity and its environment: `sk_test_...` (sandbox, free, no verification) or `sk_live_...` (real money, requires business verification). A missing or invalid key returns 401.'
x-refined-from:
- agentaos-ai-openapi.json
- openapi.json