post https://api.chartmogul.com/v1/customers/attributes/tags
Adds tags to customers that have the specified email address.
Examples
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": ["important21", "Prio22"]
}, function (err, res) {
// asynchronously called
});
<?php
$customers = ChartMogul\Customer::search("[email protected]");
foreach ($customers->entries as $customer) {
$customer->addTags(["important21", "Prio22"]);
}
?>
api.AddTagsToCustomersWithEmail(
"[email protected]",
[]string{"important2", "Prio2"})
chartmogul.Tags.add(
config,
data={
"email": "[email protected]",
"tags": ["important2", "Prio2"]
})
Result Format
{
"entries": [
{
"id": 25647,
"uuid": "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
"external_id": "40574176",
"name": "Smith Company",
"email": "[email protected]",
"status": "Active",
"customer-since": "2015-06-09T13:16:00-04:00",
"attributes": {
"tags": ["important", "Prio1"],
"stripe": {
"coupon": true
},
"clearbit": {
"name": "Acme"
},
"custom": {
"CAC": 213
}
}
},
{
"id": 13456,
"uuid": "cus_fb305d54-75b4-431b-2334-eb6b9e540016",
"external_id": "58473129",
"name": "Adam",
"email": "[email protected]",
"customer-since": "2015-06-10T13:16:00-04:00",
"status": "Active",
"attributes": {
"tags": ["important", "Prio1"],
"stripe": {
"coupon": false
},
"clearbit": {
"name": "Umbrella Corp"
},
"custom": {
"CAC": 32
}
}
}
]
}
[
#<ChartMogul::Customer:0x007fc7e1ca7028
@id=25647,
@uuid="cus_de305d54-75b4-431b-adb2-eb6b9e546012",
@external_id="40574176",
@name="Smith Company",
@email="[email protected]",
@status="Active",
@customer_since=2015-06-09 13:16:00 -04:00,
@attributes={
:tags=>["important", "Prio1"],
:stripe=>{
:coupon=> true
},
:clearbit=>{
:name=> "Acme"
},
:custom=>{
:CAC=> 213
}
},
@address={
:address_line1=>"First line of address",
:address_line2=>"Second line of address",
:address_zip=>"0185128",
:city=>"Nowhereville",
:state=>"Alaska",
:country=>"US"
},
@mrr=3000,
@arr=36000,
@billing_system_url="https:\/\/dashboard.stripe.com\/customers\/cus_4Z2ZpyJFuQ0XMb",
@chartmogul_url="https:\/\/app.chartmogul.com\/#customers\/25647-Example_Company",
@billing_system_type="Stripe",
@currency="USD",
@currency_sign="$"
>,
#<ChartMogul::Customer:0x005ec6a0ca7123
@id=13456,
@uuid="cus_fb305d54-75b4-431b-2334-eb6b9e540016",
@external_id="58473129",
@name="Adam",
@email="[email protected]",
@status="Active",
@customer_since=2015-06-10 13:16:00 -04:00,
@attributes={
:tags=>["important", "Prio1"],
:stripe=>{
:coupon=> false
},
:clearbit=>{
:name=> "Umbrella Corp."
},
:custom=>{
:CAC=> 32
}
},
@address={
:address_line1=>"First line of address",
:address_line2=>"Second line of address",
:address_zip=>"",
:city=>"",
:state=>"",
:country=>""
},
@mrr=400,
@arr=4800,
@billing_system_url="",
@chartmogul_url="https:\/\/app.chartmogul.com\/#customers\/13456-Adam",
@billing_system_type="ImportApi",
@currency="USD",
@currency_sign="$"
>
]
{
"entries": [
{
"id": 25647,
"uuid": "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
"external_id": "40574176",
"name": "Smith Company",
"email": "[email protected]",
"status": "Active",
"customer-since": "2015-06-09T13:16:00-04:00",
"attributes": {
"tags": ["important", "Prio1"],
"stripe": {
"coupon": true
},
"clearbit": {
"name": "Acme"
},
"custom": {
"CAC": 213
}
}
},
{
"id": 13456,
"uuid": "cus_fb305d54-75b4-431b-2334-eb6b9e540016",
"external_id": "58473129",
"name": "Adam",
"email": "[email protected]",
"customer-since": "2015-06-10T13:16:00-04:00",
"status": "Active",
"attributes": {
"tags": ["important", "Prio1"],
"stripe": {
"coupon": false
},
"clearbit": {
"name": "Umbrella Corp"
},
"custom": {
"CAC": 32
}
}
}
]
}
<?php
array (
0 => "important",
1 => "Prio1"
)
array (
0 => "important",
1 => "Prio1"
)
?>
(*chartmogul.Customers)(0xc042088b40)({
Entries: ([]*chartmogul.Customer) (len=11) {
(*chartmogul.Customer)(0xc04207ec60)({
ID: (uint32) 4861688,
DataSourceUUID: (string) "",
UUID: (string) (len=40) "cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
ExternalID: (string) (len=8) "cus_0001",
Name: (string) (len=10) "Adam Smith",
Email: (string) (len=14) "[email protected]",
Status: (string) (len=6) "Active",
CustomerSince: (string) (len=25) "2015-11-01T00:00:00+00:00",
Attributes: (*chartmogul.Attributes)(0xc042089440)({
Tags: ([]string) (len=6) {
(string) (len=15) "merged-customer",
(string) (len=10) "high-value",
(string) (len=10) "important2",
(string) (len=5) "Prio2"
},
Stripe: (*chartmogul.Stripe)(0xc0420418b0)({
UID: (uint64) 0,
Coupon: (bool) false
}),
Clearbit: (*chartmogul.Clearbit)(0xc04203eae0)({
ID: (string) "",
Name: (string) "",
LegalName: (string) "",
Domain: (string) "",
URL: (string) "",
Metrics: (map[string]interface {}) <nil>,
Category: (*chartmogul.Category)(<nil>)
}),
Custom: (map[string]interface {}) (len=2) {
(string) (len=3) "CAC": (float64) 25,
(string) (len=7) "channel": (string) (len=8) "Facebook"
}
}),
Address: (*chartmogul.Address)(<nil>),
Mrr: (float64) 0,
Arr: (float64) 0,
BillingSystemURL: (string) "",
ChartmogulURL: (string) "",
BillingSystemType: (string) "",
Currency: (string) "",
CurrencySign: (string) "",
Company: (string) "",
Country: (string) "",
State: (string) "",
City: (string) "",
LeadCreatedAt: (string) "",
FreeTrialStartedAt: (string) "",
Errors: (chartmogul.Errors) chartmogul: map[]
}),
(*chartmogul.Customer)(0xc04207f080)({
ID: (uint32) 4874834,
DataSourceUUID: (string) "",
UUID: (string) (len=40) "cus_922c2672-ee04-11e6-bea8-7fac984477db",
ExternalID: (string) (len=8) "cus_0013",
Name: (string) (len=10) "Adam Smith",
Email: (string) (len=14) "[email protected]",
Status: (string) (len=4) "Lead",
CustomerSince: (string) "",
Attributes: (*chartmogul.Attributes)(0xc0420895c0)({
Tags: ([]string) (len=2) {
(string) (len=10) "important2",
(string) (len=5) "Prio2"
},
Stripe: (*chartmogul.Stripe)(0xc042041930)({
UID: (uint64) 0,
Coupon: (bool) false
}),
Clearbit: (*chartmogul.Clearbit)(0xc04203eba0)({
ID: (string) "",
Name: (string) "",
LegalName: (string) "",
Domain: (string) "",
URL: (string) "",
Metrics: (map[string]interface {}) <nil>,
Category: (*chartmogul.Category)(<nil>)
}),
Custom: (map[string]interface {}) {
}
}),
Address: (*chartmogul.Address)(<nil>),
Mrr: (float64) 0,
Arr: (float64) 0,
BillingSystemURL: (string) "",
ChartmogulURL: (string) "",
BillingSystemType: (string) "",
Currency: (string) "",
CurrencySign: (string) "",
Company: (string) "",
Country: (string) "",
State: (string) "",
City: (string) "",
LeadCreatedAt: (string) "",
FreeTrialStartedAt: (string) "",
Errors: (chartmogul.Errors) chartmogul: map[]
}),
},
Page: (uint32) 1,
PerPage: (uint32) 0,
HasMore: (bool) false,
CurrentPage: (int32) 1,
TotalPages: (int32) 1
})
Customers(entries=[
<Customer{
attributes=<Attributes{
clearbit=<Clearbit{
}>,
custom={
'CAC': 25,
'channel': 'Facebook'},
stripe=<Stripe{
}>,
tags=['merged-customer',
'high-value',
'important2',
'Prio2']}>,
customer_since=datetime.datetime(2015, 11, 1, 0, 0),
email='[email protected]',
external_id='cus_0001',
id=4861688,
name='Adam Smith',
status='Active',
uuid='cus_c0dc8d74-edfd-11e6-a357-832dddba822f'}>,
<Customer{
attributes=<Attributes{
clearbit=<Clearbit{
}>,
custom={
},
stripe=<Stripe{
}>,
tags=['important2', 'Prio2']}>,
customer_since=None,
email='[email protected]',
external_id='cus_0013',
id=4874834,
name='Adam Smith',
status='Lead',
uuid='cus_922c2672-ee04-11e6-bea8-7fac984477db'}>,
])
In the response, entries
contains an array of JSON
objects with the following data:
id
- The internal ChartMogul ID of thecustomer
object with specified email.uuid
- The UUID of thecustomer
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 ofActive
orCancelled
, 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.clearbit
- A JSON object representing publicly available information about this customer retrieved from Clearbit.custom
- A JSON object representing custom attributes that you have added to this customer.