Hello 👋🏼 How can we help?

Tag customer

Add tags to a single customer
Written by Konstantine
Updated 2 weeks ago

You can append a tag to an existing customer.

In order to remove a tag, use Untag customer method. If you want to update some other customer attributes, use Update customer method.

➡️ Request

URL https://api.helpcrunch.com/v1/customers/<customer_id>/tags
Method PUT
Headers Authorization: Bearer <your_api_key>

<customer_id> is the identifier for the customer as given by HelpCrunch. It is required for this method and looks like a combination of numbers, for example 1568834.

Read more about authorization header here.

Request Body Example

{
    "tags": [
        {
            "name": "Lead",
            "color": "#ccc"
        },
        {
            "name": "Black Friday"
        },
        {
            "name": "PPC"
        }
    ]
}


Tips

  • If you specify a non-existing tag, it will be automatically created, added to your account and appended to the customer.
  • You can assign any CSS color to the tag. If you don't specify it, the default #c377e0 color will be applied.


✅ Successful Response

If your request has succeeded, you'll get a 200 OK success status code together with the following response body. 

{
    "id": 7831827,
    "name": "Hakim Zarakim",
    "email": "hzarakim@example.com",
    "userId": "example_22",
    "company": "example",
    "phone": null,
    "firstSeen": 1593547200,
    "lastSeen": 1593547200,
    "location": {
        "regionCode": "London",
        "countryCode": "EN",
        "city": "London"
    },
    "device": null,
    "unsubscribed": false,
    "blocked": false,
    "source": null,
    "referer": null,
    "locale": "en",
    "notes": "He has never heard about magic",
    "lastPage": null,
    "tags": [
        {
            "name": "Paid",
            "color": "#fbfbfb"
        },
        {
            "name": "Lead",
            "color": "#cсс"
        },
        {
            "name": "Black Friday",
            "color": "#c377e0"
        },
        {
            "name": "PPC",
            "color": "#c377e0"
        },
    ],
    "customData": [
        {
            "property": "Subscription status",
            "value": "Suspended"
        },
        {
            "property": "Number of payments",
            "value": 13
        }
    ]
}

You can get details on every Customer Object field in the Customer model article.

🛑 Error Responses

You may get one of the following error status codes and responses. More info on the errors is available here.

401 Unauthorized

{
    "errors": [
        {
            "code": "invalid_token",
            "message": "Invalid token"
        }
    ]
}

404 Not Found

{
    "errors": [
        {
            "code": "entity_not_found",
            "message": "Customer not found"
        }
    ]
}

429 Too Many Requests

{
    "errors": [
        {
            "code": "too_many_requests",
            "message": "You have exceeded your requests limit"
        }
    ]
}

If you have any questions regarding the REST API, feel free to chat us any time.

👩‍💻 Happy Coding! 👨‍💻

Did this answer your question?