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

# Change ticket status

> Changes the current ticket status.

Required API key scope: `read-write`.

When activating a `new` ticket, `assigneeId` is required and must reference an active employee with access to the ticket channel. `assigneeId` is not allowed when setting status to `inactive`.



## OpenAPI

````yaml /openapi/public-api-v1.json patch /v1/tickets/{ticketId}/status
openapi: 3.1.0
info:
  title: YoLead Public API
  version: 1.0.0
  description: >-
    Public REST API for YoLead integrations. Only endpoints mounted under /v1
    are included. Management endpoints used by the YoLead UI, including
    /integrations/*, are intentionally excluded.
servers:
  - url: https://api.yo-lead.com
    description: Production
security:
  - YoLeadPublicKey: []
    YoLeadTimestamp: []
    YoLeadSignature: []
tags:
  - name: Employees
    description: Employee data available to integrations.
  - name: Embed
    description: Iframe session creation for embedding YoLead UI.
  - name: Tickets
    description: Ticket history and status operations.
paths:
  /v1/tickets/{ticketId}/status:
    patch:
      tags:
        - Tickets
      summary: Change ticket status
      description: >-
        Changes the current ticket status.


        Required API key scope: `read-write`.


        When activating a `new` ticket, `assigneeId` is required and must
        reference an active employee with access to the ticket channel.
        `assigneeId` is not allowed when setting status to `inactive`.
      operationId: changeTicketStatus
      parameters:
        - $ref: '#/components/parameters/TicketId'
      requestBody:
        description: Ticket status transition.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChangeTicketStatusRequest'
            examples:
              activate:
                summary: Activate a new ticket
                value:
                  status: active
                  assigneeId: 64f000000000000000000001
              deactivate:
                summary: Deactivate a ticket
                value:
                  status: inactive
      responses:
        '200':
          description: Ticket status changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeTicketStatusResponse'
              example:
                data:
                  ticketId: 64f000000000000000000003
                  chatId: 64f000000000000000000002
                  oldStatus: new
                  newStatus: active
                  assigneeId: 64f000000000000000000001
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    TicketId:
      name: ticketId
      in: path
      required: true
      description: Ticket id.
      schema:
        $ref: '#/components/schemas/ObjectId'
      example: 64f000000000000000000003
  schemas:
    ChangeTicketStatusRequest:
      type: object
      additionalProperties: false
      required:
        - status
      properties:
        status:
          $ref: '#/components/schemas/TicketStatusInput'
        assigneeId:
          $ref: '#/components/schemas/ObjectId'
    ChangeTicketStatusResponse:
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          $ref: '#/components/schemas/TicketStatusChange'
    ObjectId:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: MongoDB ObjectId represented as a 24-character hexadecimal string.
      example: 64f000000000000000000001
    TicketStatusInput:
      type: string
      enum:
        - active
        - inactive
    TicketStatusChange:
      type: object
      additionalProperties: false
      required:
        - ticketId
        - chatId
        - oldStatus
        - newStatus
      properties:
        ticketId:
          $ref: '#/components/schemas/ObjectId'
        chatId:
          $ref: '#/components/schemas/ObjectId'
        oldStatus:
          $ref: '#/components/schemas/TicketStatus'
        newStatus:
          $ref: '#/components/schemas/TicketStatusInput'
        assigneeId:
          $ref: '#/components/schemas/ObjectId'
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - code
        - message
      properties:
        code:
          type: integer
          example: 40001
        message:
          type: string
          example: Validation error
    TicketStatus:
      type: string
      enum:
        - new
        - active
        - inactive
  responses:
    ValidationError:
      description: Validation error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 40001
            message: Validation error
    Unauthorized:
      description: Invalid API credentials, stale timestamp, or invalid request signature.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 40121
            message: Invalid API credentials
    Forbidden:
      description: API key scope is not sufficient for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 40361
            message: API key scope is not sufficient
    NotFound:
      description: Requested entity was not found or is not accessible for this company.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 40471
            message: Ticket not found
    InternalServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 50001
            message: Internal server error
  securitySchemes:
    YoLeadPublicKey:
      type: apiKey
      in: header
      name: X-YoLead-Key
      description: Public API key generated in the YoLead UI.
    YoLeadTimestamp:
      type: apiKey
      in: header
      name: X-YoLead-Timestamp
      description: >-
        Unix timestamp in milliseconds. Requests must be signed within a
        5-minute window.
    YoLeadSignature:
      type: apiKey
      in: header
      name: X-YoLead-Signature
      description: >-
        Hex HMAC-SHA256 signature over `<timestamp>.<raw_body>` using the API
        secret.

````