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

# Assign a tag to a client and create the tag if it does not exist

> Assign a tag to a client for a specific client property. The tag will be created if it doesn't exist. The mode parameter determines whether to add the tag to the client existing tags or replace all client existing tags by this one.



## OpenAPI

````yaml https://public.leanpay.fr/openapi/leanpay_api_documentation.swagger.yaml post /client-properties/{clientPropertyId}/assign-tag-to-client
openapi: 3.1.1
info:
  version: 1.0.0
  title: LeanPay Api documentation
  contact:
    email: integration@leanpay.fr
servers:
  - url: https://api.leanpay.fr/v1/public
security: []
tags:
  - name: clients
    description: Routes related to clients
  - name: invoices
    description: Routes related to invoices
  - name: credit-notes
    description: Routes related to credit notes
  - name: misc-operations
    description: Routes related to misc operations
  - name: contacts
    description: Routes related to client contacts
  - name: addresses
    description: Routes related to client addresses
  - name: payments
    description: Routes related to invoice payments
  - name: portal-payments
    description: >-
      Routes related to portal payments (online payments made by debtors from
      the customer portal)
  - name: paybacks
    description: Routes related to credit note paybacks
  - name: links
    description: Routes related to invoice/credit note links
  - name: comments
    description: Routes related to comments
  - name: deleted-elements
    description: Routes related to deleted elements
  - name: client-properties
    description: Routes related to client properties
paths:
  /client-properties/{clientPropertyId}/assign-tag-to-client:
    post:
      tags:
        - client-properties
      summary: Assign a tag to a client and create the tag if it does not exist
      description: >-
        Assign a tag to a client for a specific client property. The tag will be
        created if it doesn't exist. The mode parameter determines whether to
        add the tag to the client existing tags or replace all client existing
        tags by this one.
      parameters:
        - in: path
          name: clientPropertyId
          required: true
          schema:
            type: string
            format: uuid
          description: The ID of the client property
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignTagToClientRequest'
      responses:
        '200':
          description: Tag assigned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssignTagToClientResponse'
        '400':
          description: >-
            Response sent when the assign tag request data provided is invalid
            or client property ID is invalid
        '404':
          description: Client property or client not found
      security:
        - authorization: []
components:
  schemas:
    AssignTagToClientRequest:
      type: object
      properties:
        client:
          $ref: '#/components/schemas/IdOrExternalId'
        tag:
          type: object
          properties:
            label:
              type: string
              maxLength: 80
              minLength: 1
          required:
            - label
        mode:
          type: string
          enum:
            - add
            - replace
          default: replace
      required:
        - client
        - tag
    AssignTagToClientResponse:
      type: object
      properties:
        tagId:
          type: string
          format: uuid
        clientTagIds:
          type: array
          items:
            type: string
            format: uuid
      required:
        - tagId
        - clientTagIds
    IdOrExternalId:
      type: object
      oneOf:
        - properties:
            id:
              type: string
              format: uuid
        - properties:
            externalId:
              type: string
              maxLength: 80
  securitySchemes:
    authorization:
      type: apiKey
      name: Authorization
      in: header

````