Add Custom Attributes to Customers by 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", "source": "integration"},
              {"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", source: "integration" },
    { type: "Integer", key: "age", value: 8 }
  )
}
ChartMogul.CustomAttribute.add(config, {
  email: "[email protected]",
  custom: [
    {
      type: "String",
      key: "channel",
      value: "Facebook",
      source: "integration",
    },
    {
      type: "Integer",
      key: "age",
      value: 8,
    },
  ],
});
$customers = ChartMogul\Customer::search("[email protected]");

foreach ($customers->entries as $customer) {
  $customer->addCustomAttributes(
    ["type" => "String", "key" => "channel", "value" => "Facebook", "source" => "integration"],
    ["type" => "Integer", "key" => "age", "value" => 8]
  );
}
api.AddCustomAttributesWithEmail("[email protected]",
  []*cm.CustomAttribute{
    &cm.CustomAttribute{
      Type:   "String",
      Key:    "channel",
      Value:  "Facebook",
      Source: "integration"},
    &cm.CustomAttribute{
      Type:  "Integer",
      Key:   "CAC",
      Value: 8},
  }
)
chartmogul.CustomAttributes.add(
  config,
  data={
    "email": "[email protected]",
    "custom": [
      {
        "type": "String",
        "key": "channel",
        "value": "Facebook",
        "source": "integration",
      },
      {
        "type": "Integer",
        "key": "CAC",
        "value": 8,
      },
    ],
  },
)
Result Format
{
  "entries": [
    {
      "id": 25647,
      "uuid": "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
      "external_id": "cus_0001",
      "email": "[email protected]",
      "name": "Smith Company",
      "mrr": 3000,
      "arr": 36000,
      "status": "Active",
      "customer-since": "2022-06-09T13:16:00-04:00",
      "billing-system-url": "https://dashboard.stripe.com/customers/cus_4Z2ZpyJFuQ0XMb",
      "chartmogul-url": "https://app.chartmogul.com/#customers/25647-Smith_Company",
      "billing-system-type": "Stripe",
      "currency": "USD",
      "currency-sign": "$",
      "attributes": {
        "tags": ["important", "Prio1"],
        "stripe": {
          "coupon": true
        },
        "clearbit": {},
        "custom": {
          "channel": "Facebook",
          "age": 8
        }
      }
    }
  ]
}
#<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
    },
    :clearbit=>{},
    :custom=>{
      :channel=> "Facebook",
      :age=> 8
    }
  }, 
  @mrr=3000,
  @arr=36000,
  @billing_system_url="https://dashboard.stripe.com/customers/cus_4Z2ZpyJFuQ0XMb",
  @chartmogul_url="https://app.chartmogul.com/#customers/25647-Smith_Company",
  @billing_system_type="Stripe",
  @currency="USD",
  @currency_sign="$"
>
{
  entries: [
    {
      id: 25647,
      uuid: "cus_de305d54-75b4-431b-adb2-eb6b9e546012",
      external_id: "cus_0001",
      email: "[email protected]",
      name: "Smith Company",
      mrr: 3000,
      arr: 36000,
      status: "Active",
      "customer-since": "2022-06-09T13:16:00-04:00",
      "billing-system-url": "https://dashboard.stripe.com/customers/cus_4Z2ZpyJFuQ0XMb",
      "chartmogul-url": "https://app.chartmogul.com/#customers/25647-Smith_Company",
      "billing-system-type": "Stripe",
      currency: "USD",
      "currency-sign": "$",
      attributes: {
        tags: ["important", "Prio1"],
        stripe: {
          coupon: true
        },
        clearbit: {},
        custom: {
          channel: "Facebook",
          age: 8
        }
      }
    }
  ]
}
array (
  "channel" => "Facebook",
  "age" => 8
)
(*chartmogul.Customers)(0xc042062e70)({
  Entries: ([]*chartmogul.Customer) (len=11) {
    (*chartmogul.Customer)(0xc0421ca160)({
      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) "Adam Smith",
      Email: (string) (len=14) "[email protected]",
      Status: (string) (len=6) "Active",
      CustomerSince: (string) (len=25) "2022-06-09T13:16:00-04:00",
      Attributes: (*chartmogul.Attributes)(0xc04219e240)({
        Tags: ([]string) (len=2) {
        (string) (len=9) "important",
        (string) (len=5) "Prio1"
        },
        Stripe: (*chartmogul.Stripe)(0xc04219a4a0)({
        UID: (uint64) 0,
        Coupon: (bool) true
        }),
        Clearbit: (*chartmogul.Clearbit)(0xc0421d8000)({
        }),
        Custom: (map[string]interface {}) (len=2) {
        (string) (len=7) "channel": (string) (len=8) "Facebook",
        (string) (len=3) "age": (float64) 8,
        }
    }),
    Address: (*chartmogul.Address)(<nil>),
    Mrr: (float64) 3000,
    Arr: (float64) 36000,
    BillingSystemURL: (string) (len=57) "https://dashboard.stripe.com/customers/cus_4Z2ZpyJFuQ0XMb",
    ChartmogulURL: (string) (len=57) "https://app.chartmogul.com/#customers/25647-Smith_Company",
    BillingSystemType: (string) (len=6) "Stripe",
    Currency: (string) (len=3) "USD",
    CurrencySign: (string) (len=1) "$",
    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{
    arr=36000,
    attributes=<Attributes{
    clearbit=<Clearbit{
    }>, 
    custom={
        "channel": "Facebook",
        "age": 8, }, 
    stripe=<Stripe{
        "coupon": True,
    }>, 
    tags=["important", 
        "Prio1"]}>,
    billing_system_type: "Stripe",
    billing_system_url="https://dashboard.stripe.com/customers/cus_4Z2ZpyJFuQ0XMb",
    chartmogul_url: "https://app.chartmogul.com/#customers/25647-Smith_Company",
    currency="USD",
    currency_sing="$",
    customer_since=datetime.datetime(2022, 6, 9, 13, 16), 
    email="[email protected]", 
    external_id="cus_0001", 
    id=25647,
    mrr=3000,
    name="Smith Company", 
    status="Active", 
    uuid="cus_de305d54-75b4-431b-adb2-eb6b9e546012"
  }>
])

📘

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. This is a legacy field. ChartMogul no longer utilizes Clearbit.
  • custom - A JSON object representing custom attributes that you have added to this customer.
Language
Credentials
Basic
base64
: