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

# Delete Chat

> Delete one chat. Set unsync so a later incoming message does not recreate it.



## OpenAPI

````yaml delete /chats/{chat_id}
openapi: 3.0.3
info:
  title: Timelines Public API
  description: >
    # Timelines Public API


    _Some API calls may utilize message sending quota or be subject to message
    sending rate limits as described below._


    ### Credit Utilization 
      - Sending a message via API consumes 1 credit from message sending quota.
      - Sending a message with non-empty text and attachment consumes 2 credits from message sending quota.
      - If a message cannot be sent (invalid or not connected to WhatsApp number, WhatsApp server error), message sending quota will be restored (usually within a couple of hours).
    ### Message sending rate
      - Messages will be sent with random delay of about 2 seconds between each two messages (to avoid WhatsApp spam detection mechanisms). Contact support@timelines.ai if you want to modify delay for your workspace (available on Business plan only).
      - If you exceed message sending frequency, messages be queued and sent out with delay. Each queued message will consume a message sending credit, so the number of queued messages cannot exceed the available quota.
      
    ### Authorization:
      - Copy API token from [Public API page](https://app.timelines.ai/integrations/api/) in your TimelinesAI account.
      - Put the token in *Authorization* header of request as follows:
      ```
      Authorization: Bearer 4d2d0239-e28c-4f4a-8a4d-3a3ca40056b8
      ```
            
    ### Message formatting:
      - use "\n" for line breaks

    ### Input strings:
      - String fields must not contain the NUL character (U+0000).
  version: 1.3.0
servers:
  - url: https://app.timelines.ai/integrations/api
    description: Public API root URL
security:
  - bearerAuth: []
paths:
  /chats/{chat_id}:
    delete:
      summary: Delete a chat.
      description: >-
        Deletes one chat. `unsync` defaults to `false`. A workspace token may
        delete any chat in the workspace. A user token may delete a chat only
        when that member could delete it in the product. A teammate or team
        supervisor can delete a chat they own. An admin or the owner can delete
        any chat. An agent or collaborator cannot delete a chat. Assignment to
        the chat does not allow deleting it.
      parameters:
        - $ref: '#/components/parameters/chat_id'
        - in: query
          name: unsync
          required: false
          schema:
            type: boolean
            default: false
          description: >-
            Defaults to `false`. `false`: the chat is deleted and will reappear
            when a new message is received. `true`: the chat is deleted and will
            not reappear in the system. New messages will not be processed. This
            does not prevent starting the chat again by sending an outbound
            message.
          example: false
      responses:
        '200':
          description: Success. The chat is deleted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleOKResponse'
              example:
                status: ok
                message: Chat deleted
        '400':
          description: '`unsync` is not `true` or `false`'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: unsync must be true or false
                error_code: validation_error
                errors:
                  - fields:
                      - unsync
                    msg: unsync must be true or false
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          description: The caller's role does not allow deleting this chat.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: You do not have permission to delete this chat.
                error_code: permission_denied
        '404':
          description: No such chat in this workspace, or the token cannot open it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: Chat not found.
                error_code: not_found
        '405':
          description: The chat is a WABA chat.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                status: error
                message: This is a WABA chat.
                error_code: not_supported
components:
  parameters:
    chat_id:
      in: path
      name: chat_id
      schema:
        type: integer
      required: true
      description: >-
        an id of the chat as appears in TimelinesAI (can be found in the URL of
        the chat page, or in the payload of outbound webhook). _Supports sending
        messages to a group._
  schemas:
    SimpleOKResponse:
      required:
        - message
        - status
      type: object
      properties:
        message:
          type: string
          description: Human-readable confirmation of the completed action
          example: Invitation revoked successfully
        status:
          type: string
          description: Result status
          example: ok
          enum:
            - ok
            - error
    ErrorResponse:
      required:
        - message
        - status
      type: object
      properties:
        message:
          type: string
        status:
          type: string
          example: error
          enum:
            - ok
            - error
        error_code:
          type: string
          description: >-
            Stable, machine-readable error code. Use this for branching in
            client integrations.
          example: validation_error
          enum:
            - missing_credentials
            - invalid_token
            - member_not_found
            - permission_denied
            - insufficient_scope
            - plan_feature_unavailable
            - quota_exceeded
            - rate_limit_exceeded
            - validation_error
            - not_found
            - account_inactive
            - template_not_approved
            - template_wrong_waba
            - template_variables_mismatch
            - service_window_closed
            - not_supported
            - internal_error
            - account_already_connected
            - member_has_connected_account
            - member_has_phone_link_in_progress
            - number_pairing_in_progress
            - member_has_qr_connection_in_progress
            - connected_accounts_limit_reached
            - user_id_required
            - number_not_allowed
        errors:
          type: array
          description: >-
            Per-field validation diagnostics for request-schema (body/params)
            validation failures. Present only when the request failed schema
            validation; absent on business-rule `validation_error` rejections
            (which carry `message` and `error_code` only) and on
            auth/authorization/quota errors.
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      type: object
      required:
        - fields
        - msg
      properties:
        fields:
          type: array
          items:
            type: string
          description: >-
            Path of the offending field, as a list of keys/indexes from the
            request root.
          example:
            - url
        msg:
          type: string
          description: Validator message for that field.
          example: must be a valid http(s) URL
  responses:
    UnauthorizedError:
      description: Access token is missing or invalid
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.