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

# Add a tag to a contact

> Assigns an existing tag to a contact.
User must have 'contacts' access role.
`account_id` is derived from the authenticated user's account for the company.




## OpenAPI

````yaml POST /v1/add-tag-to-contact/{company_id}
openapi: 3.0.3
info:
  title: SalesCaptain API Documentation Service
  description: >
    API Documentation Service for SalesCaptain platform.

    This service provides endpoints for managing and retrieving company
    information for API documentation purposes.
  version: 0.1.0
  contact:
    name: SalesCaptain API Team
    email: support@salescaptain.com
  license:
    name: Proprietary
    url: https://salescaptain.com/license
servers:
  - url: https://api.salescaptain.com
    description: Production server
security:
  - BearerAuth: []
tags:
  - name: Health
    description: Service health and status endpoints
  - name: Companies
    description: Company management and retrieval operations
  - name: Accounts
    description: Account management and retrieval operations
  - name: Conversation Profiles
    description: Conversation profile management for communication channels
  - name: Conversations
    description: Conversation management and retrieval operations
  - name: Contacts
    description: Contact management and retrieval operations
  - name: Tags
    description: Tag listing, creation, deletion, and contact assignment operations
  - name: Custom Fields
    description: Custom field definition management
  - name: Templates
    description: SMS template retrieval operations
  - name: Analytics
    description: Call analytics and reporting operations
externalDocs:
  description: SalesCaptain API Documentation
  url: https://docs.salescaptain.com
paths:
  /v1/add-tag-to-contact/{company_id}:
    post:
      tags:
        - Tags
      summary: Add a tag to a contact
      description: >
        Assigns an existing tag to a contact.

        User must have 'contacts' access role.

        `account_id` is derived from the authenticated user's account for the
        company.
      operationId: addTagToContact
      parameters:
        - name: company_id
          in: path
          required: true
          description: Unique identifier for the company
          schema:
            type: string
            format: uuid
            example: 7f22b96a-f75b-461e-9a1d-b8ff6f53f519
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contact_id:
                  type: string
                  format: uuid
                  description: Unique identifier for the contact
                  example: 11111111-1111-1111-1111-111111111111
                tag_id:
                  type: string
                  format: uuid
                  description: Unique identifier for the tag to assign
                  example: c9d8e7f6-a5b4-3210-9876-543210fedcba
              required:
                - contact_id
                - tag_id
            example:
              contact_id: 11111111-1111-1111-1111-111111111111
              tag_id: c9d8e7f6-a5b4-3210-9876-543210fedcba
      responses:
        '200':
          description: Tag assigned to contact successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Tag assigned to contact successfully!
                  data:
                    type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/ContactTagAssigned'
              example:
                message: Tag assigned to contact successfully!
                data:
                  data:
                    tag_track_id: dddddddd-dddd-dddd-dddd-dddddddddddd
                    contact_id: 11111111-1111-1111-1111-111111111111
                    tag_id: c9d8e7f6-a5b4-3210-9876-543210fedcba
                    tag_name: VIP Customer
                    created_at: '2026-08-11T15:20:00.000Z'
                    message: Tag assigned to contact successfully
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_contact_id:
                  summary: Missing contact_id
                  value:
                    status: failure
                    error: contact_id is required
                missing_tag_id:
                  summary: Missing tag_id
                  value:
                    status: failure
                    error: tag_id is required
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          description: Access forbidden or permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: failure
                error: You don't have permission to add tag to contact!
        '429':
          $ref: '#/components/responses/RateLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - BearerAuth: []
components:
  schemas:
    ContactTagAssigned:
      type: object
      description: Response object after assigning a tag to a contact
      properties:
        tag_track_id:
          type: string
          format: uuid
          description: Unique identifier for the tag assignment record
          example: dddddddd-dddd-dddd-dddd-dddddddddddd
        contact_id:
          type: string
          format: uuid
          description: Unique identifier for the contact
          example: 11111111-1111-1111-1111-111111111111
        tag_id:
          type: string
          format: uuid
          description: Unique identifier for the tag
          example: c9d8e7f6-a5b4-3210-9876-543210fedcba
        tag_name:
          type: string
          description: Display name of the assigned tag
          example: VIP Customer
        created_at:
          type: string
          format: date-time
          description: Timestamp when the tag was assigned
          example: '2026-08-11T15:20:00.000Z'
        message:
          type: string
          description: Success message from the assignment operation
          example: Tag assigned to contact successfully
      required:
        - tag_track_id
        - contact_id
        - tag_id
        - tag_name
        - created_at
    Error:
      type: object
      description: Error response object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid request parameters
        code:
          type: string
          description: Error code for programmatic handling
          example: INVALID_PARAMS
        timestamp:
          type: string
          format: date-time
          description: Timestamp when the error occurred
          example: '2023-12-01T10:30:00Z'
        path:
          type: string
          description: API endpoint path where the error occurred
          example: /v1/fetch-companies
      required:
        - error
  responses:
    UnauthorizedError:
      description: Authentication token is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Unauthorized access
            code: UNAUTHORIZED
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
    RateLimitError:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Too many requests, please try again later
            code: RATE_LIMIT_EXCEEDED
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
      headers:
        X-RateLimit-Limit:
          description: Request limit per time window
          schema:
            type: integer
            example: 30
        X-RateLimit-Remaining:
          description: Remaining requests in current window
          schema:
            type: integer
            example: 0
        X-RateLimit-Reset:
          description: Time when the rate limit resets
          schema:
            type: integer
            example: 1701425400
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Problem encountered while fetching companies!
            code: INTERNAL_ERROR
            timestamp: '2023-12-01T10:30:00Z'
            path: /v1/fetch-companies
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Authentication token required for accessing protected endpoints.

        The token should be obtained from the main SalesCaptain authentication
        service.

````