Add Custom Attributes to Customers with email

Adds custom attributes to customers that have the specified email address.

Examples
curl -X POST "https://api.chartmogul.com/v1/customers/attributes/custom" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
          "email": "[email protected]",
          "custom": [
            {"type": "String", "key": "channel", "value": "Facebook"},
            {"type": "Integer", "key": "age", "value": 8}
          ]
         }'
customers = ChartMogul::Customer.search('[email protected]')
customers.each |c| 
  c.add_custom_attributes!(
    {type: "String", key: "channel", value: "Facebook"},
    {type: "Integer", key: "age", value: 8}
  )
end
ChartMogul.CustomAttribute.add(config, {
   'email': '[email protected]',
   'custom': [
     {"type": "String", "key": "channel", "value": "Facebook"},
     {'type': 'Integer', 'key': 'age', 'value': 8}
   ]
}, function (err, res) {
   // asynchronously called
});
<?php

$customers = ChartMogul\Customer::search("[email protected]");

foreach ($customers->entries as $customer) {
    $customer->addCustomAttributes(
        ["type" => "String", "key" => "channel", "value" => "Facebook"],
        ["type" => "Integer", "key" => "age", "value" => 8 ]
    );
}
?>
api.AddCustomAttributesWithEmail("[email protected]",
        []*cm.CustomAttribute{
            &cm.CustomAttribute{
                Type:  "String",
                Key:   "channel",
                Value: "Facebook"},
            &cm.CustomAttribute{
                Type:  "Integer",
                Key:   "CAC",
                Value: 8},
        })
chartmogul.CustomAttributes.add(
    config,
    data={
        'email': '[email protected]', 
        'custom': [
            {"type": "String", "key": "channel", "value": "Facebook"},
            {'type': 'Integer', 'key': 'CAC', 'value': 8}
        ]
    }
)
Result Format
{
  "entries": [
    {
      "id": 25647,
      "uuid": "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
      "external_id": "40574176",
      "email": "[email protected]",
      "name": "Smith Company",
      "customer-since": "2015-06-09T13:16:00-04:00",
      "status": "Active",
      "attributes": {
        "tags": ["important", "Prio1"],
        "stripe": {
          "coupon": true
        },
        "clearbit": {
          "name": "Acme"
        },
        "custom": {
          "channel": "Facebook",
          "age": 8
        }
      }
    },
    {
      "id": 13456,
      "uuid": "cus_fb305d54-75b4-431b-2334-eb6b9e540016",
      "external_id": "58473129",
      "email": "[email protected]",
      "name": "Adam",
      "customer-since": "2015-06-10T13:16:00-04:00",
      "status": "Active",
      "attributes": {
        "tags": ["important", "Prio1"],
        "stripe": {
          "coupon": false
        },
        "clearbit": {
          "name": "Umbrella Corp."
        },
        "custom": {
          "channel": "Facebook",
          "age": 8
        }
      }
    }
  ]
}
[
  #<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=>{
      :channel=> "Facebook",
      :age=> 8
    }
  }, 
  @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=>{
      :channel=> "Facebook",
      :age=> 8
    }
  }, 
  @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",
      "email": "[email protected]",
      "name": "Smith Company",
      "customer-since": "2015-06-09T13:16:00-04:00",
      "status": "Active",
      "attributes": {
        "tags": ["important", "Prio1"],
        "stripe": {
          "coupon": true
        },
        "clearbit": {
          "name": "Acme"
        },
        "custom": {
          "channel": "Facebook",
          "age": 8
        }
      }
    },
    {
      "id": 13456,
      "uuid": "cus_fb305d54-75b4-431b-2334-eb6b9e540016",
      "external_id": "58473129",
      "email": "[email protected]",
      "name": "Adam",
      "customer-since": "2015-06-10T13:16:00-04:00",
      "status": "Active",
      "attributes": {
        "tags": ["important", "Prio1"],
        "stripe": {
          "coupon": false
        },
        "clearbit": {
          "name": "Umbrella Corp."
        },
        "custom": {
          "channel": "Facebook",
          "age": 8
        }
      }
    }
  ]
}
<?php

array (
  "channel" => "Facebook",
  "age" => 8
)
array (
  "channel" => "Facebook",
  "age" => 8
)
?>
(*chartmogul.Customers)(0xc042062e70)({
 Entries: ([]*chartmogul.Customer) (len=11) {
  (*chartmogul.Customer)(0xc0421ca160)({
   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)(0xc04219e240)({
    Tags: ([]string) (len=6) {
     (string) (len=15) "merged-customer",
     (string) (len=10) "high-value",
     (string) (len=9) "important",
     (string) (len=5) "Prio1",
     (string) (len=10) "important2",
     (string) (len=5) "Prio2"
    },
    Stripe: (*chartmogul.Stripe)(0xc04219a4a0)({
     UID: (uint64) 0,
     Coupon: (bool) false
    }),
    Clearbit: (*chartmogul.Clearbit)(0xc0421d8000)({
     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) 8,
     (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)(0xc0421ca580)({
   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)(0xc04219e3c0)({
    Tags: ([]string) (len=2) {
     (string) (len=10) "important2",
     (string) (len=5) "Prio2"
    },
    Stripe: (*chartmogul.Stripe)(0xc04219a590)({
     UID: (uint64) 0,
     Coupon: (bool) false
    }),
    Clearbit: (*chartmogul.Clearbit)(0xc0421d80c0)({
     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) 8,
     (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[]
  })
},
Page: (uint32) 0,
PerPage: (uint32) 0,
HasMore: (bool) false,
CurrentPage: (int32) 0,
TotalPages: (int32) 0
})
Customers(entries=[
    <Customer{
        attributes=<Attributes{
        clearbit=<Clearbit{
        }>, 
        custom={
            'CAC': 8, 
            'channel': 'Facebook'}, 
        stripe=<Stripe{
        }>, 
        tags=['merged-customer', 
            'high-value', 
            'important', 
            'Prio1', 
            '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={
            'CAC': 8, 
            'channel': 'Facebook'}, 
        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'}>])

📘

Supported data types and their accepted formats

String - Accepts alphanumeric characters. Maximum of 255 characters allowed.
Integer - Accepts only numeric characters.
Decimal - Accepts floating point numbers.
Timestamp - In the ISO 8601 format.
Boolean - Can be one of TRUE, true, t, 1, FALSE, false, f, or 0.

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.
  • 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.
Language
Authentication
Basic
base64
: