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

# Create an auto-assigning appointment

> Creates a scheduled appointment that will be automatically assigned to an available user based on their availability.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/appointments/auto-assign
openapi: 3.1.0
info:
  title: Qminder API
  version: '1.0'
  description: >-
    The Qminder API allows you to integrate queue management into your own
    applications.
servers:
  - url: https://api.qminder.com
security:
  - sec0: []
tags:
  - name: Locations
    description: Manage physical service locations
  - name: Lines
    description: Manage virtual queues within locations
  - name: Input Fields
    description: Manage custom data fields for locations
  - name: Tickets
    description: Manage visitor queue entries
  - name: Appointments
    description: Manage scheduled appointments
  - name: Users
    description: Manage user accounts and permissions
  - name: Webhooks
    description: Manage webhook subscriptions
paths:
  /v1/appointments/auto-assign:
    post:
      tags:
        - Appointments
      summary: Create an auto-assigning appointment
      description: >-
        Creates a scheduled appointment that will be automatically assigned to
        an available user based on their availability.
      operationId: create-auto-assign-appointment
      parameters:
        - name: X-Qminder-API-Version
          in: header
          description: API version. Must be set to `2020-09-01`.
          required: true
          schema:
            type: string
            enum:
              - '2020-09-01'
            default: '2020-09-01'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - lineId
                - firstName
                - startTime
                - endTime
              properties:
                lineId:
                  type: integer
                  description: ID of the line to create the appointment in.
                firstName:
                  type: string
                  minLength: 2
                  maxLength: 50
                  description: Visitor's first name (2-50 characters).
                lastName:
                  type: string
                  maxLength: 50
                  description: Visitor's last name (max 50 characters).
                phoneNumber:
                  type: string
                  pattern: ^(\+)?([0-9]){5,20}$
                  description: Phone number with optional + prefix (5-20 digits).
                email:
                  type: string
                  format: email
                  maxLength: 100
                  description: Visitor's email address.
                languageCode:
                  type: string
                  minLength: 2
                  maxLength: 5
                  default: en
                  description: 'Language code for the visitor (default: en).'
                startTime:
                  type: string
                  format: date-time
                  description: Appointment start time in ISO 8601 format.
                endTime:
                  type: string
                  format: date-time
                  description: Appointment end time in ISO 8601 format.
                fields:
                  type: array
                  description: >-
                    Custom input fields for the appointment. See [Input Fields
                    query](/reference/queries/input-fields) to discover
                    available IDs.
                  items:
                    type: object
                    required:
                      - inputFieldId
                    properties:
                      inputFieldId:
                        type: string
                        format: uuid
                        description: UUID of the input field.
                      value:
                        type: string
                        maxLength: 500
                        description: Value for text input fields.
                      optionIds:
                        type: array
                        items:
                          type: string
                          format: uuid
                labels:
                  type: array
                  description: Labels to attach to the appointment.
                  items:
                    type: object
                    required:
                      - value
                    properties:
                      value:
                        type: string
            example:
              lineId: 12345
              firstName: John
              lastName: Doe
              startTime: '2024-12-15T10:00:00Z'
              endTime: '2024-12-15T10:30:00Z'
      responses:
        '201':
          description: Appointment created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  publicId:
                    type: string
              example:
                id: '226859'
                publicId: A-42
        '400':
          description: Validation error - invalid input data
        '404':
          description: Line or input fields not found
        '409':
          description: Line is disabled or archived
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: X-Qminder-REST-API-Key
      x-default: yourbusinessapikey

````