Create a Customer

Creates a customer object in ChartMogul under the specified data_source.

Examples
curl -X POST "https://api.chartmogul.com/v1/customers" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
          "data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
          "external_id": "cus_0001",
          "name": "Adam Smith",
          "email": "[email protected]",
          "country": "US",
          "state": "NY",
          "city": "New York",
          "lead_created_at": "2015-10-14 00:00:00",
          "free_trial_started_at": "2015-11-01 00:00:00",
          "attributes": {
              "tags": ["important", "Prio1"],
              "custom": [
                  {"type": "String", "key": "channel", "value": "Facebook", "source": "integration"},
                  {"type": "Integer", "key": "age", "value": 18}
              ]
          }
         }'
ChartMogul::Customer.create!(
  data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
  external_id: "cus_0001",
  name: "Adam Smith",
  email: "[email protected]",
  country: "US",
  city: "New York",
  lead_created_at: Time.utc(2015, 10, 14),
  free_trial_started_at: Time.utc(2015, 11, 1),
  attributes: {
        tags: ["important", "Prio1"],
        custom: [
            {type: "String", key: "channel", value: "Facebook", source: "integration"},
            {type: "Integer", key: "age", value: 18}
        ]
    }
)
ChartMogul.Customer.create(config, {
    "data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
    "external_id": "cus_0001",
    "name": "Adam Smith",
    "email": "[email protected]",
    "country": "US",
    "city": "New York",
    "lead_created_at": "2015-10-14",
    "free_trial_started_at": "2015-11-01",
    "attributes": {
            "tags": ["important", "Prio1"],
            "custom": [
                {"type": "String", "key": "channel", "value": "Facebook", "source": "integration"},
                {"type": "Integer", "key": "age", "value": 18}
            ]
     }
    }, function (err, res){
    // asynchronously called
});
<?php

ChartMogul\Customer::create([
    "data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
    "external_id" => "cus_0001",
    "name" => "Adam Smith",
    "email" => "[email protected]",
    "country" => "US",
    "city" => "New York",
    "lead_created_at" => "2015-10-14",
    "free_trial_started_at" => "2015-11-01",
        "attributes" => [
            "tags" => ["important", "Prio1"],
            "custom" => [
                ["type" => "String", "key" => "channel", "value" => "Facebook", "source" => "integration"],
                ["type" => "Integer", "key" => "age", "value" => 18]
            ]
        ]
]);
?>
api.CreateCustomer(&cm.NewCustomer{
  DataSourceUUID:     dsUUID,
  ExternalID:         "cus_0001",
  Name:               "Adam Smith",
  Email:              "[email protected]",
  Country:            "US",
  City:               "New York",
  LeadCreatedAt:      "2015-10-14",
  FreeTrialStartedAt: "2015-11-01",
  Attributes: &cm.NewAttributes{
    Tags: []string{"important", "Prio1"},
    Custom: []*cm.CustomAttribute{
      {Key: "channel", Value: "Facebook", Type: "String", Source: "integration"},
      {Key: "age", Value: 18, Type: "Integer"},
    }
  }})
ChartMogul.Customer.create(
    config,
    data={
        "data_source_uuid": "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
        "external_id": "cus_0001",
        "name": "Adam Smith",
        "email": "[email protected]",
        "country": "US",
        "city": "New York",
        "lead_created_at": "2015-10-14",
        "free_trial_started_at": "2015-11-01",
            "attributes": {
                    "tags": ["important", "Prio1"],
                    "custom": [
                        {"type": "String", "key": "channel", "value": "Facebook", "source": "integration"},
                        {"type": "Integer", "key": "age", "value": 18}
                    ]
                }
    })
Result Format
{
  "id": 74596,
  "uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
  "external_id": "cus_0001",
  "name": "Adam Smith",
  "email": "[email protected]",
  "status": "Lead",
  "customer-since": null,
  "attributes": {
    "custom": {
      "channel": "Facebook",
      "age": 18
    },
    "clearbit": {},
    "stripe": {},
    "tags": [
      "important",
      "Prio1"
    ]
  },
  "data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
  "data_source_uuids": [
    "ds_fef05d54-47b4-431b-aed2-eb6b9e545430"
  ],
  "external_ids": [
    "cus_0001"
  ],
  "company": "",
  "country": "US",
  "state": null,
  "city": "New York",
  "zip": null,
  "lead_created_at": "2015-10-14T00:00:00Z",
  "free_trial_started_at": "2015-11-01T00:00:00Z",
  "address": {
    "country": "United States",
    "state": null,
    "city": "New York",
    "address_zip": null
  },
  "mrr": 0,
  "arr": 0,
  "billing-system-url": null,
  "chartmogul-url": "https://app.chartmogul.com/#customers/74596-Adam_Smith",
  "billing-system-type": "Custom",
  "currency": "USD",
  "currency-sign": "$"
}
#<ChartMogul::Customer:0x000000006615e8
 @address=
  {:country=>"United States",
   :state=>nil,
   :city=>"New York",
   :address_zip=>nil},
 @arr=0,
 @attributes=
  {:custom=>{:channel=>"Facebook", :age=>18},
   :clearbit=>{},
   :stripe=>{},
   :tags=>["important", "Prio1"]},
 @billing_system_type="Custom",
 @billing_system_url=nil,
 @chartmogul_url="https://app.chartmogul.com/#customers/6354002-Adam_Smith",
 @city="New York",
 @company="",
 @country="US",
 @currency="USD",
 @currency_sign="$",
 @customer_since=nil,
 @data_source_uuid="ds_e7d1b08e-0276-11e7-9af7-138812f19424",
 @data_source_uuids=["ds_e7d1b08e-0276-11e7-9af7-138812f19424"],
 @email="[email protected]",
 @external_id="cus_0001",
 @external_ids=["cus_0001"],
 @free_trial_started_at=2015-11-01 00:00:00 UTC,
 @id=6354002,
 @lead_created_at=2015-10-14 00:00:00 UTC,
 @mrr=0,
 @name="Adam Smith",
 @state=nil,
 @status="Lead",
 @uuid="cus_e814c4a0-0276-11e7-b154-dbf8b45871a1",
 @zip=nil>
{ 
  "id": 6195369,
  "uuid": "cus_eaa30dc2-025c-11e7-9b58-5b5a8ca7dc6a",
  "external_id": "cus_0001",
  "name": "Adam Smith",
  "email": "[email protected]",
  "status": "Lead",
  "customer-since": null,
  "attributes": { 
    "custom": { 
      "channel": "Facebook", 
      "age": 18 
    },
    "clearbit": {},
    "stripe": {},
    "tags": [ 'important', 'Prio1' ]
  },
  "data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
  "data_source_uuids": [ 'ds_fef05d54-47b4-431b-aed2-eb6b9e545430' ],
  "external_ids": [ 'cus_0001' ],
  "company": "",
  "country": "US",
  "state": null,
  "city": "New York",
  "zip": null,
  "lead_created_at": "2015-10-14T00:00:00.000Z",
  "free_trial_started_at": "2015-11-01T00:00:00.000Z",
  "address": { 
    "country": "United States",
    "state": null,
    "city": "New York",
    "address_zip": null
  },
  "mrr": 0,
  "arr": 0,
  "billing-system-url": null,
  "chartmogul-url": "https://app.chartmogul.com/#customers/6195369-Adam_Smith",
  "billing-system-type": "Custom",
  "currency": "USD",
  "currency-sign": "$"
}
<?php
ChartMogul\Customer::__set_state(array(
   'id' => 6262350,
   'uuid' => 'cus_721eb496-026b-11e7-aa36-5f20dd128faa',
   'external_id' => 'cus_0001',
   'name' => 'Adam Smith',
   'email' => '[email protected]',
   'company' => '',
   'status' => 'Lead',
   'customer_since' => NULL,
   'attributes' =>
  array (
    'custom' =>
    array (
      'channel' => 'Facebook',
      'age' => 18,
    ),
    'clearbit' =>
    array (
    ),
    'stripe' =>
    array (
    ),
    'tags' =>
    array (
      0 => 'important',
      1 => 'Prio1',
    ),
  ),
   'address' =>
  array (
    'country' => 'United States',
    'state' => NULL,
    'city' => 'New York',
    'address_zip' => NULL,
  ),
   'mrr' => 0,
   'arr' => 0,
   'billing_system_url' => NULL,
   'chartmogul_url' => 'https://app.chartmogul.com/#customers/6262350-Adam_Smith',
   'billing_system_type' => 'Custom',
   'currency' => 'USD',
   'currency_sign' => '$',
   'data_source_uuid' => 'ds_fef05d54-47b4-431b-aed2-eb6b9e545430',
   'data_source_uuids' =>
  array (
    0 => 'ds_fef05d54-47b4-431b-aed2-eb6b9e545430',
  ),
   'external_ids' =>
  array (
    0 => 'cus_0001',
  ),
   'city' => 'New York',
   'country' => 'US',
   'state' => NULL,
   'zip' => NULL,
   'lead_created_at' => '2015-10-14T00:00:00.000Z',
   'free_trial_started_at' => '2015-11-01T00:00:00.000Z',
  )),
))
?>
(*chartmogul.Customer)(0xc0420706e0)({
 ID: (uint32) 4861688,
 DataSourceUUID: (string) (len=39) "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
 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=4) "Lead",
 CustomerSince: (string) "",
Attributes: (*chartmogul.Attributes)(0xc04221a3c0)({
  Tags: ([]string) (len=2 cap=4) {
   (string) (len=9) "important",
   (string) (len=5) "Prio1"
  },
  Stripe: (*chartmogul.Stripe)(0xc042213440)({
   UID: (uint64) 0,
   Coupon: (bool) false
  }),
  Clearbit: (*chartmogul.Clearbit)(0xc0421fc060)({
   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=7) "channel": (string) (len=8) "Facebook",
   (string) (len=3) "age": (float64) 18
  }
 }),
 Address: (*chartmogul.Address)(0xc0421e4000)({
  AddressZIP: (string) "",
  City: (string) (len=8) "New York",
  State: (string) "",
  Country: (string) (len=13) "United States"
 }),
 Mrr: (float64) 0,
 Arr: (float64) 0,
 BillingSystemURL: (string) "",
 ChartmogulURL: (string) (len=56) "https://app.chartmogul.com/#customers/4861688                   -Adam_Smith",
 BillingSystemType: (string) (len=10) "Custom",
 Currency: (string) (len=3) "USD",
 CurrencySign: (string) (len=1) "$",
 Company: (string) "",
 Country: (string) (len=2) "US",
 State: (string) "",
 City: (string) (len=8) "New York",
 LeadCreatedAt: (string) (len=24) "2015-10-14T00:00:00.000Z",
 FreeTrialStartedAt: (string) (len=24) "2015-11-01T00:00:00.000Z",
 Errors: (chartmogul.Errors) chartmogul: map[]
})
<Customer{
    address=<Address{
        address_zip=None,
        city='New York',
        country='United States',
        state=None}>,
    arr=0.0,
    attributes=<Attributes{
        clearbit=<Clearbit{
        }>,
        custom={
        },
        stripe=<Stripe{
        }>,
        tags=[]}>,
    billing_system_type='Custom',
    billing_system_url=None,
    chartmogul_url='https://app.chartmogul.com/#customers/4868653-Adam_Smith',
    city='New York',
    company='',
    country='US',
    currency='USD',
    currency_sign='$',
    customer_since=None,
    data_source_uuid='ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11',
    data_source_uuids=['ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11'],
    email='[email protected]',
    external_id='cus_0008',
    external_ids=['cus_0008'],
    free_trial_started_at=datetime.datetime(2015, 11, 1, 0, 0),
    id=4868653,
    lead_created_at=datetime.datetime(2015, 10, 14, 0, 0),
    mrr=0.0,
    name='Adam Smith',
    state=None,
    status='Lead',
    uuid='cus_6a75dd6a-ee01-11e6-9c15-9fa749e4d3b1',
    zip=None}>

In the response, the JSON object contains the following data:

  • id - The internal ChartMogul ID of the customer object.
  • uuid - The UUID of the customer object generated by ChartMogul.
  • external_id - The unique external identifier for this customer, if any.
  • external_ids - An array containing the unique external identifiers of all customer records that have been merged into this customer.
  • data_source_uuid - The ChartMogul UUID of the data source of this customer.
  • data_source_uuids - An array containing the ChartMogul UUIDs of all data sources that contribute data to this customer. This is most relevant for merged customers.
  • name - The name of this customer.
  • email - This customer's email address.
  • company - This customer's company name.
  • status - The status of this customer. One of Lead, Active, Past due or Cancelled.
  • lead_created_at - The time at which this customer was established as a lead, as specified by you.
  • free_trial_started_at - The time at which this customer started a free trial of your product or service, as specified by you.
  • customer-since - An RFC3339 formatted datetime attribute indicating when the customer first started paying for a subscription.
  • country - The country from the customer's address.
  • state - The state from the customer's address.
  • city - The city from the customer's address.
  • zip - The zip code from the customer's address.
  • attributes - A JSON object representing this customer's attributes containing the following data:
    • tags - An Array of tags that you have added to 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.
  • address - A JSON object representing this customer's address containing the following data:
    • address_zip - The zip code from this customer's address.
    • city - The city from this customer's address.
    • state - The state from this customer's address.
    • country - The country code from this customer's address as per the ISO-3166 alpha-2 standard.
  • mrr - The current monthly recurring revenue for this customer, expressed in the currency selected for your account, as an integer number of cents. Divide by 100 to obtain the actual amount.
  • arr - The current annual run rate for this customer, also expressed as an integer number of cents in your account's selected currency.
  • billing-system-url - A URL for this customer's data in your billing system, if available.
  • chartmogul-url - The URL for this customer's ChartMogul page. This is only accessible to a user logged in to your ChartMogul account.
  • billing-system-type - The type of the billing system from where the customer was imported to ChartMogul. For example, Stripe, Recurly, Chargify, or Custom.
  • currency - The currency of the MRR readings for this customer.
  • currency-sign - Text representation to display the currency. E.g. $, or €.
Language
Authentication
Basic
base64
: