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

# Patch threads labels



## OpenAPI

````yaml /openapi.json patch /threads/{threadId}/labels
openapi: 3.1.1
info:
  title: Anima API
  version: 0.1.0
  description: >-
    The Anima API provides programmatic access to unified infrastructure for AI
    agents: create and manage agents; send and receive email; place phone calls
    and send/receive SMS and voice; store and retrieve vault credentials; manage
    agent identity; and configure webhooks for real-time events. Authenticate
    using a Bearer token or an API key passed via the X-API-Key header.
  contact:
    name: Anima Labs
    url: https://useanima.sh
    email: support@useanima.sh
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.useanima.sh/v1
    description: Production
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /threads/{threadId}/labels:
    patch:
      operationId: thread.updateLabels
      parameters:
        - name: threadId
          in: path
          required: true
          schema:
            type: string
            description: Conversation to relabel — every message in it is updated
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                addLabels:
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 64
                  maxItems: 50
                  description: >-
                    Labels to add to every message in the thread. Adding `read`
                    removes `unread` and vice versa, per message, exactly as the
                    single-message route does.
                removeLabels:
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 64
                  maxItems: 50
                  description: Labels to remove from every message in the thread.
              required: []
              description: >-
                Add and/or remove labels across a whole conversation in one
                atomic write. Supply at least one of addLabels/removeLabels. Use
                this rather than looping over PATCH /messages/{id}/labels: a
                loop that fails partway leaves the thread in two folders at
                once.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  threadId:
                    type: string
                    description: The conversation that was relabelled
                  updatedCount:
                    type: integer
                    description: >-
                      How many messages were written. Zero means the thread does
                      not exist or is not yours — it is never a silent success.
                required:
                  - threadId
                  - updatedCount
                description: Result of relabelling a conversation
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Bearer token obtained from authentication. Pass as: Authorization:
        Bearer <token>
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'API key for programmatic access. Pass as: X-API-Key: <your-key>'

````