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

# Update a contact tag

> Rename one reusable contact tag on an Instagram account. The change propagates to every contact currently assigned that tag, in a single call.

Rename the tag identified by `tagId`. levios also updates that tag name on its
current contact assignments.

Your API key needs the `contacts:write` scope. The tag and `account_id` must
belong to an Instagram account that the key can access.

## Request body

Send exactly these fields:

* `account_id`: the UUID of the Instagram account.
* `name`: the new tag name.

levios trims `name` and collapses consecutive whitespace to one space. The
normalized name must contain 1 through 50 characters. The raw input can
contain at most 200 characters, and the normalized result cannot contain
control characters.

```bash theme={null}
curl --request PATCH \
  --url "https://levios.app/api/v1/contact-tags/${LEVIOS_TAG_ID}" \
  --header "Authorization: Bearer ${LEVIOS_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data @- <<JSON
{
  "account_id": "${LEVIOS_ACCOUNT_ID}",
  "name": "Qualified Lead"
}
JSON
```

## Rename restrictions

The API returns `api_contact_tag_conflict` when another tag already uses the
normalized name. It returns `api_contact_tag_in_use` when an automation
configuration references the current name. Update those automation
configurations before renaming the tag.

Sending the tag's current normalized name leaves it unchanged and returns the
current tag. The operation is idempotent.

<Warning>
  If the API returns `api_contact_tag_response_unavailable` with
  `committed: true` and `retryable: false`, the tag changed but the response
  could not be verified. Do not retry automatically. Read the current tag
  catalog before deciding whether to send another request.
</Warning>


## OpenAPI

````yaml openapi/v1.json PATCH /api/v1/contact-tags/{tagId}
openapi: 3.1.0
info:
  title: levios public API
  version: '1'
servers:
  - url: https://levios.app
security:
  - bearerAuth: []
paths:
  /api/v1/contact-tags/{tagId}:
    patch:
      tags:
        - contact_tag
      summary: Update a contact tag
      description: Renames a reusable contact tag.
      operationId: contact_tags.update
      parameters:
        - name: tagId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                account_id:
                  type: string
                  format: uuid
                name:
                  $ref: '#/components/schemas/PublicContactTagNameInput'
              required:
                - account_id
                - name
              additionalProperties: false
      responses:
        '200':
          description: Successful response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicContactTagMutationResult'
        '400':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_invalid_content_length
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - Invalid Content-Length.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_invalid_json
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The request body is not valid JSON.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_invalid_request_url
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The request URL is invalid.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_invalid_utf8
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The request body is not valid UTF-8.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
        '401':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
            WWW-Authenticate:
              description: API key Bearer challenge.
              schema:
                type: string
                enum:
                  - Bearer
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - api_unauthorized
                      correlation_id:
                        type: string
                      message:
                        type: string
                        enum:
                          - Authentication required.
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '403':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_account_not_granted
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - >-
                                This credential is not authorized for the
                                request.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_forbidden
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - >-
                                This credential is not authorized for the
                                request.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_scope_denied
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - >-
                                This credential is not authorized for the
                                request.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
        '404':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - api_contact_tag_not_found
                      correlation_id:
                        type: string
                      message:
                        type: string
                        enum:
                          - The requested contact tag was not found.
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '409':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_contact_tag_conflict
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - A contact tag with that name already exists.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_contact_tag_in_use
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The contact tag is referenced by an automation.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
        '413':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_body_too_large
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The JSON request body exceeds 1 MiB.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_json_too_deep
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The JSON request body exceeds maximum depth.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
        '415':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - api_unsupported_media_type
                      correlation_id:
                        type: string
                      message:
                        type: string
                        enum:
                          - Content-Type must be application/json.
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '422':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_contact_tag_invalid
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The contact tag is invalid.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_validation_error
                          correlation_id:
                            type: string
                          details:
                            type: object
                            properties:
                              issues:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    code:
                                      type: string
                                      minLength: 1
                                      maxLength: 64
                                    path:
                                      type: array
                                      items:
                                        type: integer
                                        minimum: 0
                                      maxItems: 16
                                  required:
                                    - code
                                    - path
                                  additionalProperties: false
                                maxItems: 32
                            required:
                              - issues
                            additionalProperties: false
                          message:
                            type: string
                            enum:
                              - The request does not match the declared schema.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
        '429':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - rate_limited
                      correlation_id:
                        type: string
                      message:
                        type: string
                        enum:
                          - Rate limit exceeded.
                    required:
                      - code
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '500':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_contact_tag_response_unavailable
                          correlation_id:
                            type: string
                          details:
                            type: object
                            properties:
                              committed:
                                type: boolean
                                enum:
                                  - true
                              retryable:
                                type: boolean
                                enum:
                                  - false
                            required:
                              - committed
                              - retryable
                            additionalProperties: false
                          message:
                            type: string
                            enum:
                              - >-
                                The contact tag changed, but its response could
                                not be verified. Do not retry automatically.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_internal_error
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The request could not be completed.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
        '503':
          description: Error response.
          headers:
            X-Correlation-ID:
              description: Correlation identifier for this request.
              schema:
                type: string
                pattern: ^[0-9A-HJKMNP-TV-Z]{26}$
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_account_resolution_unavailable
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The reachable account set could not be read.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - api_contact_tag_write_unavailable
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - The contact tag could not be changed.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - rate_limiter_unavailable
                          correlation_id:
                            type: string
                          message:
                            type: string
                            enum:
                              - Rate limiter unavailable.
                        required:
                          - code
                          - message
                        additionalProperties: false
                    required:
                      - error
                    additionalProperties: false
components:
  schemas:
    PublicContactTagNameInput:
      $ref: 95e327ad-95e0-4157-a1d0-a858b3f9901a
      $defs:
        PublicContactTagNameInput:
          description: >-
            Tag name. Levios trims it, collapses whitespace, and requires a
            normalized length of 1–50 characters.
          maxLength: 200
          minLength: 1
          type: string
      $id: https://levios.app/schemas/public-contact-tag-name-input-v1
      $schema: https://json-schema.org/draft/2019-09/schema#
      title: PublicContactTagNameInput
      x-levios-max-serialized-bytes: 65536
      x-levios-schema-version: 1
    PublicContactTagMutationResult:
      $ref: 7e8e5a66-314d-4b54-a033-aa57f46a81d6
      $defs:
        PublicContactTagMutationResult:
          additionalProperties: false
          properties:
            tag:
              additionalProperties: false
              properties:
                id:
                  description: >-
                    Stable public tag UUID. Internal numeric catalog IDs are
                    never exposed.
                  format: uuid
                  pattern: >-
                    ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
                  type: string
                name:
                  description: >-
                    Normalized tag name: trimmed, with consecutive whitespace
                    collapsed to one ASCII space.
                  maxLength: 50
                  minLength: 1
                  pattern: ^(?!.*\s{2})(?!\s)(?!.*\s$)(?!.*[\u0000-\u001F\u007F]).+$
                  type: string
              required:
                - id
                - name
              type: object
          required:
            - tag
          type: object
      $id: https://levios.app/schemas/public-contact-tag-mutation-result-v1
      $schema: https://json-schema.org/draft/2019-09/schema#
      title: PublicContactTagMutationResult
      x-levios-max-serialized-bytes: 65536
      x-levios-schema-version: 1
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Levios API key sent as a Bearer token.

````

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