Add Tags to Customers by Email

POST https://api.chartmogul.com/v1/customers/attributes/tags

Adds tags to customers that have the specified email address.

curl -X POST "https://api.chartmogul.com/v1/customers/attributes/tags" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
           "email": "[email protected]",
           "tags": ["important", "Prio1"]
         }'
customers = ChartMogul::Customer.search("[email protected]")

customers.each { |c| c.add_tags!("important", "Prio1") }
ChartMogul.Tag.add(config, {
  email: "[email protected]",
  tags: ["important", "Prio1"],
});
$customers = ChartMogul\Customer::search("[email protected]");

foreach ($customers->entries as $customer) {
  $customer->addTags(["important", "Prio1"]);
}
api.AddTagsToCustomersWithEmail(
  "[email protected]",
  []string{"important", "Prio1"}
)
chartmogul.Tags.add(
  config, data={"email": "[email protected]", "tags": ["important", "Prio1"]}
)
{
  "entries": [
    {
      "id": 25647,
      "uuid": "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
      "external_id": "cus_0001",
      "name": "Smith Company",
      "email": "[email protected]",
      "status": "Active",
      "customer-since": "2022-06-09T13:16:00-04:00",
      "attributes": {
        "tags": ["important", "Prio1"],
        "stripe": {
          "coupon": true
        },
        "custom": {
          "CAC": 213
        }
      }
    }
  ]
}
#<ChartMogul::Customer:0x007fc7e1ca7028 
  @id=25647, 
  @uuid="cus_de305d54-75b4-431b-adb2-eb6b9e546012", 
  @external_id="cus_0001", 
  @name="Smith Company", 
  @email="[email protected]",
  @status="Active", 
  @customer_since=2022-06-09 13:16:00 -04:00,
  @attributes={
    :tags=>["important", "Prio1"], 
    :stripe=>{
      :coupon=> true
    },
    :custom=>{
      :CAC=> 213
    }
  }
>
{
  entries: [
    {
      id: 25647,
      uuid: "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
      external_id: "cus_0001",
      name: "Smith Company",
      email: "[email protected]",
      status: "Active",
      "customer-since": "2022-06-09T13:16:00-04:00",
      attributes: {
        tags: ["important", "Prio1"],
        stripe: {
          coupon: true
        },
        custom: {
          CAC: 213
        }
      }
    }
  ]
}
array (
  0 => "important",
  1 => "Prio1"
)
(*chartmogul.Customers)(0xc042088b40)({
 Entries: ([]*chartmogul.Customer) (len=11) {
  (*chartmogul.Customer)(0xc04207ec60)({
   ID: (uint32) 25647,
   DataSourceUUID: (string) "",
   UUID: (string) (len=40) "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
   ExternalID: (string) (len=8) "cus_0001",
   Name: (string) (len=10) "Smith Company",
   Email: (string) (len=16) "[email protected]",
   Status: (string) (len=6) "Active",
   CustomerSince: (string) (len=25) "2022-06-09T13:16:00-04:00",
   Attributes: (*chartmogul.Attributes)(0xc042089440)({
    Tags: ([]string) (len=2) {
     (string) (len=10) "important",
     (string) (len=5) "Prio1"
    },
    Stripe: (*chartmogul.Stripe)(0xc0420418b0)({
     UID: (uint64) 0,
     Coupon: (bool) true
    }),
    Clearbit: (*chartmogul.Clearbit)(0xc04203eae0)({
    }),
    Custom: (map[string]interface {}) (len=2) {
     (string) (len=3) "CAC": (float64) 213
    }
   }),
  })
 },
 Page: (uint32) 1,
 PerPage: (uint32) 0,
 HasMore: (bool) false,
 CurrentPage: (int32) 1,
 TotalPages: (int32) 1
})
Customers(entries=[
  <Customer{
    attributes=<Attributes{
      custom={
          "CAC": 213}, 
      stripe=<Stripe{
      }>, 
      tags=["important", 
      "Prio1"]}>, 
    customer_since=datetime.datetime(2022, 6, 9, 13, 16), 
    email="[email protected]",
    external_id="cus_0001", 
    id=25647, 
    name="Smith Company", 
    status="Active", 
    uuid="cus_de305d54-75b4-431b-adb2-eb6b9e546012"
  }>, 
])

Body parameters

email string required
The email address of the customers to whom tags must be added.
tags array(string) required
An Array of tags to be added to the customers.

Response

In the response, entries contains an array of JSON objects with the following data:

id
The internal ChartMogul ID of the customer object with specified email.
uuid
The UUID of the customer object generated by ChartMogul.
external_id
The unique external identifier for this customer, if any.
name
The name of this customer.
email
This customer's email address.
status
The status of this customer. One of Active or Cancelled, depending on whether the customer has any active subscriptions or not.
customer-since
An RFC3339 formatted datetime attribute indicating when the customer first started paying for a subscription.
attributes
A JSON object representing this customer's attributes containing the following data:
tags
An Array of all the tags now on this customer.
stripe
A JSON object representing any metadata on this customer object in your Stripe account.
custom
A JSON object representing custom attributes that you have added to this customer.