Skip to main content
POST
https://api.stateset.com
/
v1
/
customers
/
:id
/
tag
curl --location --request POST 'https://api.stateset.com/v1/customers/:id/tag' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>' \
--data-raw '{
    "customer_id": "cust_123abc",
    "tags_to_add": ["vip", "high_value", "early_adopter"],
    "tags_to_remove": ["prospect"],
    "tag_metadata": {
        "category": "loyalty",
        "source": "manual",
        "expiry_date": "2024-12-31"
    }
}'
{
  "id": "cust_123abc",
  "current_tags": [
    "vip",
    "high_value", 
    "early_adopter",
    "repeat_buyer",
    "email_subscriber"
  ],
  "tags_added": ["vip", "high_value", "early_adopter"],
  "tags_removed": ["prospect"],
  "tag_count": 5,
  "segments": [
    {
      "id": "seg_premium",
      "name": "Premium Customers",
      "matched_by_tags": ["vip", "high_value"]
    },
    {
      "id": "seg_engaged",
      "name": "Highly Engaged",
      "matched_by_tags": ["repeat_buyer", "email_subscriber"]
    }
  ],
  "updated_at": "2024-01-15T10:30:00Z",
  "updated_by": "user_123",
  "success": true
}

Body

customer_id
string
The unique identifier of the customer
tags_to_add
array
Array of tags to add to the customer
tags_to_remove
array
Array of tags to remove from the customer
tag_metadata
object
Optional metadata for tags

Response

id
string
The customer ID
current_tags
array
Array of all current tags on the customer
tags_added
array
Tags that were successfully added
tags_removed
array
Tags that were successfully removed
tag_count
number
Total number of tags on the customer
segments
array
Customer segments based on current tags
updated_at
string
Timestamp when tags were last updated
success
boolean
Indicates whether the operation was successful
curl --location --request POST 'https://api.stateset.com/v1/customers/:id/tag' \
--header 'Content-Type: application/json' \
--header 'Authorization: Token <token>' \
--data-raw '{
    "customer_id": "cust_123abc",
    "tags_to_add": ["vip", "high_value", "early_adopter"],
    "tags_to_remove": ["prospect"],
    "tag_metadata": {
        "category": "loyalty",
        "source": "manual",
        "expiry_date": "2024-12-31"
    }
}'
{
  "id": "cust_123abc",
  "current_tags": [
    "vip",
    "high_value", 
    "early_adopter",
    "repeat_buyer",
    "email_subscriber"
  ],
  "tags_added": ["vip", "high_value", "early_adopter"],
  "tags_removed": ["prospect"],
  "tag_count": 5,
  "segments": [
    {
      "id": "seg_premium",
      "name": "Premium Customers",
      "matched_by_tags": ["vip", "high_value"]
    },
    {
      "id": "seg_engaged",
      "name": "Highly Engaged",
      "matched_by_tags": ["repeat_buyer", "email_subscriber"]
    }
  ],
  "updated_at": "2024-01-15T10:30:00Z",
  "updated_by": "user_123",
  "success": true
}