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

# Replace the tags of a conversation



## OpenAPI

````yaml put /v1/conversations/{id}/tags
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/conversations/{id}/tags:
    put:
      tags:
        - Conversation
      summary: Replace the tags of a conversation
      operationId: conversation.updateTags
      parameters:
        - name: id
          in: path
          required: true
          description: The conversation identifier
          schema:
            type: integer
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConversationTagsUpdateRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/ConversationResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                    const: RESOURCE_NOT_FOUND
                  message:
                    type: string
                  errors:
                    type: 'null'
                  data:
                    type: 'null'
                required:
                  - success
                  - error_code
                  - message
                  - errors
                  - data
        '409':
          $ref: '#/components/responses/CustomerErasedException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    ConversationTagsUpdateRequest:
      type: object
      properties:
        tags:
          type: array
          description: >-
            Tag identifiers to attach to the conversation. The list replaces the
            current tags; send an empty array to clear them.
          items:
            type: integer
            description: A tag ID.
      required:
        - tags
      title: ConversationTagsUpdateRequest
    ConversationResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        display_name:
          type: string
        address:
          anyOf:
            - type: 'null'
            - type: string
        hidden_number:
          type: boolean
          description: >-
            WhatsApp shows this contact only by an anonymous id; the number
            appears once they write from it.
        visitor_id:
          type:
            - string
            - 'null'
        source:
          type:
            - string
            - 'null'
        customer:
          type: object
          properties:
            id:
              type: integer
            first_name:
              anyOf:
                - type: string
                - type: 'null'
            last_name:
              anyOf:
                - type: string
                - type: 'null'
            phone_number:
              anyOf:
                - type: string
                - type: 'null'
            avatar_url:
              type:
                - string
                - 'null'
            is_masked:
              type: string
              description: >-
                Whether the identity fields are masked because the viewer may
                not see this lead's patient.
            is_lead_stage:
              type: boolean
            lead_id:
              type:
                - integer
                - 'null'
            lead_stage:
              type:
                - object
                - 'null'
              properties:
                id:
                  type: integer
                name:
                  type: string
                next_stage_id:
                  type:
                    - integer
                    - 'null'
              required:
                - id
                - name
                - next_stage_id
            erased_at:
              type:
                - string
                - 'null'
              format: date-time
            open_tasks_count:
              type: integer
            notes_count:
              type: integer
          required:
            - id
            - first_name
            - last_name
            - phone_number
            - avatar_url
            - is_masked
            - is_lead_stage
            - lead_id
            - lead_stage
            - erased_at
        channel:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            type:
              type: string
            provider:
              type:
                - string
                - 'null'
            address:
              type: string
          required:
            - id
            - name
            - type
            - provider
            - address
        last_message_id:
          type:
            - integer
            - 'null'
        last_message:
          type:
            - string
            - 'null'
        last_message_at:
          type:
            - string
            - 'null'
          format: date-time
        last_message_type:
          type:
            - string
            - 'null'
        last_message_media_type:
          type:
            - string
            - 'null'
        last_message_is_customer:
          type:
            - boolean
            - 'null'
        last_message_is_deleted:
          type: boolean
        last_customer_message:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            message:
              type:
                - string
                - 'null'
            message_type:
              type:
                - string
                - 'null'
            media_type:
              type:
                - string
                - 'null'
            created_at:
              type:
                - string
                - 'null'
              format: date-time
            is_customer:
              type: boolean
            is_deleted:
              type: boolean
          required:
            - id
            - message
            - message_type
            - media_type
            - created_at
            - is_customer
            - is_deleted
        unread_count:
          anyOf:
            - type: string
            - type: integer
              enum:
                - 0
        agent_disabled:
          type: boolean
        agent_expires_at:
          type:
            - string
            - 'null'
          format: date-time
        agent_disabled_by_user_name:
          type:
            - string
            - 'null'
        is_archived:
          type: boolean
        archived_at:
          type:
            - string
            - 'null'
          format: date-time
        archived_by_user_name:
          type:
            - string
            - 'null'
        lines:
          type: array
          description: >-
            The contact's conversations on every WhatsApp line, newest first,
            this one included.

            More than one entry means the contact was reached on several lines.
          items:
            type: string
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagResource'
        blacklist:
          anyOf:
            - $ref: '#/components/schemas/ChannelBlacklistResource'
            - type: 'null'
      required:
        - id
        - record_state
        - display_name
        - address
        - hidden_number
        - visitor_id
        - source
        - last_message_id
        - last_message
        - last_message_at
        - last_message_type
        - last_message_media_type
        - last_message_is_customer
        - last_message_is_deleted
        - last_customer_message
        - unread_count
        - agent_disabled
        - agent_expires_at
        - agent_disabled_by_user_name
        - is_archived
        - archived_at
        - archived_by_user_name
      title: ConversationResource
    RecordStateResource:
      type: object
      properties:
        is_read_only:
          type: boolean
          description: >-
            True when every write on this record is refused; false does not
            imply the caller may write.
        reason_code:
          type:
            - string
            - 'null'
          description: >-
            Why the record is read-only (`CUSTOMER_ERASED`, or
            `LEAD_NOT_ASSIGNED` for a salesperson on another rep's lead), or
            null when it is not.
      required:
        - is_read_only
        - reason_code
      title: RecordStateResource
    TagResource:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        name:
          type: string
        color:
          type: string
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - tenant_id
        - name
        - color
        - created_at
        - updated_at
        - deleted_at
      title: TagResource
    ChannelBlacklistResource:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        reason:
          type: string
        reason_label:
          type: string
          enum:
            - Hız Limiti
            - LLM Spam
            - Manuel
            - Güvenlik Tehdidi
            - Hakaret/Küfür
        note:
          type:
            - string
            - 'null'
        blocked_at:
          type: string
          format: date-time
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
        is_active:
          type: boolean
        is_permanent:
          type: boolean
        is_expired:
          type: boolean
        remaining_time:
          type: string
        metadata:
          type:
            - array
            - 'null'
          items: {}
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
        channel:
          $ref: '#/components/schemas/RelatedChannelResource'
        customer:
          $ref: '#/components/schemas/RelatedCustomerResource'
      required:
        - id
        - tenant_id
        - reason
        - reason_label
        - note
        - blocked_at
        - expires_at
        - is_active
        - is_permanent
        - is_expired
        - remaining_time
        - metadata
        - created_at
        - updated_at
        - deleted_at
      title: ChannelBlacklistResource
    RelatedChannelResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type:
          $ref: '#/components/schemas/ChannelType'
        address:
          type: string
      required:
        - id
        - name
        - type
        - address
      title: RelatedChannelResource
    RelatedCustomerResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        first_name:
          anyOf:
            - type: string
            - type: 'null'
        last_name:
          anyOf:
            - type: string
            - type: 'null'
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
            - type: 'null'
        is_masked:
          type: boolean
          description: >-
            Whether the identity fields are masked because the viewer may not
            see this lead's patient.
        is_lead_stage:
          type: boolean
          description: >-
            Whether the person is still a lead (link to `/leads/{lead_id}`)
            rather than a patient (link to `/customers/{id}`).
        lead_id:
          type:
            - integer
            - 'null'
          description: >-
            The lead the person came from; kept after conversion, so check
            `is_lead_stage` before linking to it.
      required:
        - id
        - record_state
        - first_name
        - last_name
        - phone_number
        - email
        - is_masked
        - is_lead_stage
        - lead_id
      title: RelatedCustomerResource
    ChannelType:
      type: string
      enum:
        - whatsapp
        - instagram
        - website
        - telegram
      title: ChannelType
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    CustomerErasedException:
      description: The patient record has been erased and is read-only
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: Always false for an error.
                examples:
                  - false
              error_code:
                type: string
                description: Machine-readable error code.
                examples:
                  - CUSTOMER_ERASED
              message:
                type: string
                description: Localized error message.
            required:
              - success
              - error_code
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

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