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

# Close the ticket

> Mark the ticket as closed



## OpenAPI

````yaml /openapi.yaml patch /tickets/{ticketId}
openapi: 3.1.1
info:
  title: MijnKlantportaal API
  version: v1
servers:
  - url: https://api.mijnklantportaal.nl/v1
security:
  - APIKey: []
tags:
  - name: Agreements API
  - name: Appointments API
  - name: Customers API
  - name: Customer Groups API
  - name: Customer Invoices API
  - name: Customer Offers API
  - name: Customer Subscriptions API
  - name: Customer Subscription Packages API
  - name: Files API
  - name: File Request API
  - name: File Share API
  - name: Invoices API
  - name: Payment Links API
  - name: Punch Cards API
  - name: Tickets API
  - name: Webhooks API
paths:
  /tickets/{ticketId}:
    patch:
      tags:
        - Tickets API
      summary: Close the ticket
      description: Mark the ticket as closed
      operationId: close-ticket
      parameters:
        - name: ticketId
          in: path
          description: ID of the ticket record to close
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The ticket is closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TicketWithMessage'
        '404':
          description: No Ticket record can be found for the given ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error_ApiError'
        '422':
          description: The ticket is already closed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error_ApiError'
        '426':
          description: The ticketing system is not available in the current license
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error_ApiError'
components:
  schemas:
    TicketWithMessage:
      type: object
      description: Ticket record with the messages
      properties:
        id:
          type: string
          example: tic_abc12345def678
          description: ID of the Webhook record, always starting with `tic_`.
        customerId:
          type: string
          nullable: true
          example: cst_abc12354678
          description: ID of the Customer this ticket belongs to
        title:
          type: string
          example: Invoice issue
          description: Title of the ticket, mostly describing the ticket
        source:
          type: string
          example: portal
          description: Source of the ticket. Can be `portal`, `email` or `chat`.
        status:
          type: string
          example: open
          description: Current status of the ticket. Can be `open` or `closed`.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/TicketMessage'
          description: An array with the messages in this ticket
        createdAt:
          type: string
          example: '2024-04-29T21:00:00+02:00'
          description: Date and time when the ticket was created, written in ATOM format.
    Error_ApiError:
      type: object
      properties:
        message:
          type: string
          description: Explanation what went wrong
    TicketMessage:
      type: object
      description: Ticket message
      properties:
        id:
          type: string
          example: tim_abc12345def678
          description: ID of the Ticket Message, always starting with `tim_`.
        postedBy:
          type: string
          example: John Appleseed
          description: Full name of the person which posted the message.
        isPostedByCustomer:
          type: boolean
          example: true
          description: Indicates if the message was sent by a customer
        message:
          type: string
          example: <p>Hello, help me with my invoice please</p>
          description: The message in HTML format which was posted
        postedAt:
          type: string
          example: '2024-04-29T21:00:00+02:00'
          description: >-
            Date and time when the message was posted and added to the ticket,
            written in ATOM format.
        attachments:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/TicketMessageAttachment'
          description: An array with the attachment(s) for this ticket
    TicketMessageAttachment:
      type: object
      description: Attachment of a Ticket message
      properties:
        id:
          type: string
          example: tma_abc12345def678
          description: ID of the Attachment record, always starting with `tma_`.
        name:
          type: string
          example: Screenshot.png
          description: Name of the file
        size:
          type: integer
          example: 1256
          description: Size of the file in bytes
        mime:
          type: string
          example: image/png
          description: MIME-type of the file
  securitySchemes:
    APIKey:
      type: http
      scheme: bearer

````