> ## Documentation Index
> Fetch the complete documentation index at: https://omniflow-vpn.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Post v1panelcodesbatches

> Requires catalog.write. Generates a batch and returns its codes.
This is the only response in the API that carries redeemable codes, and it carries every code in the batch. It cannot be replayed: asking again generates a different batch rather than returning this one, because nothing is stored that could return it. An operator who loses the list has to issue a new batch, which the screen says before they generate one.
The batch row and every code commit together. A partial batch would leave somebody holding a list whose halves behave differently with no way to tell which is which.



## OpenAPI

````yaml https://raw.githubusercontent.com/kewldan/omniflow/main/api/openapi.yaml post /v1/panel/codes/batches
openapi: 3.0.3
info:
  title: Omniflow API
  version: 1.0.0
  description: >-
    Customer, commerce, payment, wallet, fulfillment, and operations API for
    Omniflow.
servers: []
security: []
paths:
  /v1/panel/codes/batches:
    post:
      tags:
        - panel
      description: >-
        Requires catalog.write. Generates a batch and returns its codes.

        This is the only response in the API that carries redeemable codes, and
        it carries every code in the batch. It cannot be replayed: asking again
        generates a different batch rather than returning this one, because
        nothing is stored that could return it. An operator who loses the list
        has to issue a new batch, which the screen says before they generate
        one.

        The batch row and every code commit together. A partial batch would
        leave somebody holding a list whose halves behave differently with no
        way to tell which is which.
      operationId: createPanelCodeBatch
      parameters:
        - $ref: '#/components/parameters/CSRFToken'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PanelCodeBatch'
      responses:
        '201':
          description: Generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PanelGeneratedBatch'
        '403':
          $ref: '#/components/responses/Problem'
        '409':
          $ref: '#/components/responses/Problem'
        '422':
          $ref: '#/components/responses/Problem'
components:
  parameters:
    CSRFToken:
      in: header
      name: X-CSRF-Token
      required: true
      description: >-
        Echoes the token from the current session. Required on every unsafe
        method.
      schema:
        type: string
  schemas:
    PanelCodeBatch:
      type: object
      required:
        - reference
        - planVersionId
        - quantity
        - unitPriceMinor
        - currency
      properties:
        id:
          type: string
          format: uuid
        reference:
          type: string
          description: What the operator calls the batch. Unique, and what they search for.
        planCode:
          type: string
        planVersionId:
          type: string
          format: uuid
          description: >-
            A version rather than a plan: publishing a new version must not
            change what people already hold a code for.
        planVersion:
          type: integer
        billingPeriod:
          type: string
        quantity:
          type: integer
          minimum: 1
          maximum: 10000
        unitPriceMinor:
          type: integer
          format: int64
          description: >-
            The agreed wholesale price, recorded and never charged. The money
            changed hands outside Omniflow.
        currency:
          type: string
        note:
          type: string
        issued:
          type: integer
          format: int64
          description: Codes nobody has redeemed, and therefore what revoking would kill.
        redeemed:
          type: integer
          format: int64
        revoked:
          type: integer
          format: int64
        expiresAt:
          type: string
          format: date-time
          description: Absent means the codes never expire.
        revokedAt:
          type: string
          format: date-time
        revokeReason:
          type: string
        createdAt:
          type: string
          format: date-time
        createdBy:
          type: string
          format: uuid
    PanelGeneratedBatch:
      type: object
      required:
        - batch
        - codes
      properties:
        batch:
          $ref: '#/components/schemas/PanelCodeBatch'
        codes:
          type: array
          items:
            type: string
          description: >-
            Returned once and never again. Only the SHA-256 of each is stored,
            so no other endpoint can produce them.
    Problem:
      type: object
      required:
        - type
        - title
        - status
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        request_id:
          type: string
  responses:
    Problem:
      description: Request failed
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'

````

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