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

# Get next ticket id to work on



## OpenAPI

````yaml https://dev.enneo.dev/api/mind/docs/open-api post /ticket/getLatest
openapi: 3.0.0
info:
  version: '1'
  title: enneo.MIND API
  description: This describes the API of enneo Mind, the main ticketing backend
  contact:
    name: enneo GmbH
    email: richard@enneo.ai
  license:
    name: Proprietary software
    url: https://enneo.ai
servers:
  - url: https://demo.enneo.ai/api/mind
    description: Production server, demo client
  - url: https://main.enneo.dev/api/mind
    description: Development main branch
  - url: http://localhost:8005/api/mind
    description: Local development server
security:
  - bearerAuth:
      - api
  - cookieAuth:
      - api
paths:
  /ticket/getLatest:
    post:
      tags:
        - Ticket
      summary: Get next ticket id to work on
      operationId: getLatestTicket
      requestBody:
        description: Parameters for getting the next ticket
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                preferredDirection:
                  type: string
                  enum:
                    - earliest
                    - previous
                    - next
                  default: earliest
                  description: Direction to navigate in the ticket queue
                  example: earliest
                ticketId:
                  type: integer
                  nullable: true
                  description: >-
                    Current ticket ID (required when preferredDirection is
                    'previous' or 'next')
                  example: 123
                filters:
                  type: array
                  description: An array of objects containing filters
                  items:
                    $ref: '#/components/schemas/Filter'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  earliest:
                    type: integer
                    nullable: true
                    example: 2
                  previous:
                    type: integer
                    example: 1
                    nullable: true
                  next:
                    type: integer
                    nullable: true
                    example: 3
components:
  schemas:
    Filter:
      type: object
      properties:
        key:
          type: string
          enum:
            - t.id
            - t.channel
            - t.subchannelId
            - t.channelId
            - t.direction
            - t.status
            - t.priority
            - t.agentId
            - t.customerId
            - t.contractId
            - t.partnerId
            - t.isCustomerActive
            - t.aiSupportLevel
            - i.aiAgentId
            - t.createdAt
            - t.modifiedAt
            - t.firstResponseDueBy
            - t.dueBy
            - t.lastMessageAt
            - t.lastCustomerMessageAt
            - tt.tagId
            - t.sentiment
            - t.language
            - t.languageCode
            - t.modelRunAt
            - t.externalTicketId
            - t.from
            - t.spamStatus
            - w.id
            - q
          example: channel
        comparator:
          type: string
          description: >-
            Possible values: =, !=, >, >=, <, <=, in, not in, between, not
            between
          example: in
        values:
          type: array
          description: >-
            Used for "in" and "not in" comparators.


            Include the sentinel string `null` to match SQL NULL rows together
            with other values:

            - `in` + `["null", "a"]` → `(col IS NULL OR col IN ('a'))`
            (whitelist)

            - `not in` + `["null", "a"]` → `(col IS NULL OR col NOT IN ('a'))`
            (blacklist complement)

            - `["null"]` only → `col IS NULL` (`in`) or `col IS NOT NULL` (`not
            in`)


            Example: backlog not-spam filter uses `in` with `["null",
            "auto_clean", "manual_clean"]`; spam filter uses `in` with spam
            statuses only.
          items:
            type: string
            example: email
        value:
          type: string
          description: Used for "=", "!=", ">", ">=", "<", "<=" comparators
          example: 1609459200
        from:
          type: string
          description: Used for "between" and "not between" comparators
          example: 1609459200
        to:
          type: string
          description: Used for "between" and "not between" comparators
          example: 1612051200
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT-based authentication
      x-scopes:
        api: Full access to the API
    cookieAuth:
      type: apiKey
      in: cookie
      name: connect.sid
      description: Cookie-based authentication
      x-scopes:
        api: Full access to the API

````