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

# Create a new voucher

> This endpoint allows you to create a voucher(s).

A Voucher belongs to a Voucher Group and is uniquely identified by a code.
It can be linked to multiple tokens (idtags) and appUsers.

When a driver starts a session at a location, the system checks:

If the driver’s token is linked to a voucher, or

If the driver’s appUser (linked to that token) is linked to a voucher.

If either is true and the voucher’s group is associated with the location, the voucher is applied — potentially affecting pricing or granting access.



## OpenAPI

````yaml /openapi/integration-api-v2/openapi.yaml post /v2/vouchers
openapi: 3.0.0
info:
  title: Spirii API
  description: Spirii API
  version: 2.10.0
  contact: {}
servers:
  - url: https://api.spirii.com
security: []
tags: []
paths:
  /v2/vouchers:
    post:
      tags:
        - Vouchers
      summary: Create a new voucher
      description: >-
        This endpoint allows you to create a voucher(s).


        A Voucher belongs to a Voucher Group and is uniquely identified by a
        code.

        It can be linked to multiple tokens (idtags) and appUsers.


        When a driver starts a session at a location, the system checks:


        If the driver’s token is linked to a voucher, or


        If the driver’s appUser (linked to that token) is linked to a voucher.


        If either is true and the voucher’s group is associated with the
        location, the voucher is applied — potentially affecting pricing or
        granting access.
      operationId: create
      parameters: []
      requestBody:
        required: true
        description: The voucher to be created.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVoucherDto'
      responses:
        '201':
          description: The voucher has been successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoucherResponseDto'
        '404':
          description: The voucher group ID associated with the voucher was not found.
components:
  schemas:
    CreateVoucherDto:
      type: object
      properties:
        code:
          type: string
          format: string
          description: Unique code used to redeem the voucher.
          example: TT-67890
        voucherGroupId:
          type: number
          format: integer
          description: Id belonging to a voucher group this voucher is associated with.
          example: 67890
        maxUsers:
          type: number
          nullable: true
          maximum: 65535
          format: integer
          description: Maximum number of users allowed to redeem this voucher.
          example: 100
        expiresAt:
          format: date-time
          type: string
          nullable: true
          description: Date after which the voucher is unusable.
          example: '2025-06-03T12:00:00.000Z'
      required:
        - code
        - voucherGroupId
    VoucherResponseDto:
      type: object
      properties:
        id:
          type: number
          format: integer
          description: Used to identify the voucher throughout the Spirii system.
          example: 67890
        code:
          type: string
          format: string
          description: Unique code used to redeem the voucher.
          example: TT-67890
        voucherGroupId:
          type: number
          format: integer
          description: Id belonging to a voucher group this voucher is associated with.
          example: 67890
        maxUsers:
          type: number
          nullable: true
          maximum: 65535
          format: integer
          description: Maximum number of users allowed to redeem this voucher.
          example: 100
        expiresAt:
          format: date-time
          type: string
          nullable: true
          description: Date after which the voucher is unusable.
          example: '2025-06-03T12:00:00.000Z'
        createdAt:
          format: date-time
          type: string
          description: The date and time when the voucher was created.
          example: '2025-06-03T12:00:00.000Z'
        updatedAt:
          format: date-time
          type: string
          description: The date and time when the voucher was last updated.
          example: '2025-06-03T12:00:00.000Z'
        deletedAt:
          format: date-time
          type: string
          nullable: true
          description: The date and time when the voucher was deleted.
          example: '2025-06-03T12:00:00.000Z'
      required:
        - id
        - code
        - voucherGroupId
        - maxUsers
        - expiresAt
        - createdAt
        - updatedAt
        - deletedAt

````