Creating tag in kommo with Kommo Make API Call

I want to adding tags from make to kommo.

here is docs from kommo

// Adding tags for a particular entity type
// Method
POST /api/v4/{entity_type:leads|contacts|companies|customers}/tags

// Description
// This method allows to add multiple tags for a particular entity specified in the method 
// URL.

// Limitations
// Method is available in correspondence to the user rights.

// Request header
Content-Type: application/json

// Request parameters
// To add a tag, the “name” parameter should be passed. If the passed tag name already
// exists, this tag’s ID will be returned in the responce

// An example of the request
        
[
    {
        "name": "Tag 1"
    },
    {
        "name": "Tag 2",
        "request_id": "my_request_id"
    },
    {
        "name": "Tag 3"
    }
]
        
    
// Data type header when the request is successful
// Content-Type: application/hal+json

// Data type header in case of an error
// Content-Type: application/problem+json

// HTTP response codes.
// Response code
200	Tags added successfully
401	User is not authorized
400	Invalid data given. Details are available in the request response
// Response parameters
// Method return a collection of created tags.

// Response example
        
{
    "_total_items": 3,
    "_embedded": {
        "tags": [
            {
                "id": 263807,
                "name": "Tag 1",
                "request_id": "0"
            },
            {
                "id": 263809,
                "name": "Tag 2",
                "request_id": "my_request_id"
            },
            {
                "id": 263811,
                "name": "Tag 3",
                "request_id": "2"
            }
        ]
    }
}

here is my request

method: POST
URL: /v4/leads/tags

body:
[
    {
        "name": "Tag 1 Test"
    }
]

but when I send it, I recieve a 200 code succesfull and response body like this:

{
    "_total_items": 0,
    "_embedded": {
        "tags": []
    }
}

here I can see, that this tag dosn’t created (tags is empty)

What I do wrong? And what I can do to fix this?

Hi there!

You need to use this endpoint in the URL:

v4/leads/tags
POST (method)

request body:

[
    {
        "name": "Tag 1"
    },
    {
        "name": "Tag 2"
    },
    {
        "name": "Tag 3"
    }
]



2 Likes

Thank you very much!

1 Like