post https://api.chartmogul.com/v1/customers
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": "US-NY",
"city": "New York",
"company": "Pinata Technologies",
"lead_created_at": "2022-10-14 00:00:00",
"free_trial_started_at": "2022-11-01 00:00:00",
"owner": "[email protected]",
"attributes": {
"tags": ["important", "Prio1"],
"custom": [
{ "type": "String", "key": "channel", "value": "Facebook", "source": "integration" },
{ "type": "Integer", "key": "age", "value": 18 }
]
},
"primary_contact": {
"first_name": "Anna",
"last_name": "Gardner",
"email": "[email protected]",
"title": "CFO",
"phone": "+123456789",
"linked_in": "https://linkedin.com/example",
"twitter": "https://twitter.com/example",
"notes": "Heading\nBody\nFooter"
},
"website_url": "https://example.com"
}'
ChartMogul::Customer.create!(
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
external_id: "cus_0001",
name: "Adam Smith",
email: "[email protected]",
country: "US",
state: "US-NY",
city: "New York",
company: "Pinata Technologies",
lead_created_at: Time.utc(2022, 10, 14),
free_trial_started_at: Time.utc(2022, 11, 1),
attributes: {
tags: ["important", "Prio1"],
custom: [
{ type: "String", key: "channel", value: "Facebook", source: "integration" },
{ type: "Integer", key: "age", value: 18 },
],
},
website_url: "https://example.com",
)
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",
state: "US-NY",
city: "New York",
company: "Pinata Technologies",
lead_created_at: "2022-10-14",
free_trial_started_at: "2022-11-01",
attributes: {
tags: ["important", "Prio1"],
custom: [
{
type: "String",
key: "channel",
value: "Facebook",
source: "integration",
},
{ type: "Integer", key: "age", value: 18 },
],
},
website_url: "https://example.com",
});
ChartMogul\Customer::create([
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"external_id" => "cus_0001",
"name" => "Adam Smith",
"email" => "[email protected]",
"country" => "US",
"state" => "US-NY",
"city" => "New York",
"company" => "Pinata Technologies",
"lead_created_at" => "2022-10-14",
"free_trial_started_at" => "2022-11-01",
"attributes" => [
"tags" => ["important", "Prio1"],
"custom" => [
["type" => "String", "key" => "channel", "value" => "Facebook", "source" => "integration"],
["type" => "Integer", "key" => "age", "value" => 18],
],
],
"website_url" => "https://example.com",
]);
api.CreateCustomer(&cm.NewCustomer{
DataSourceUUID: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
ExternalID: "cus_0001",
Name: "Adam Smith",
Email: "[email protected]",
Country: "US",
State: "US-NY",
City: "New York",
Company: "Pinata Technologies",
LeadCreatedAt: "2022-10-14",
FreeTrialStartedAt: "2022-11-01",
Attributes: &cm.NewAttributes{
Tags: []string{"important", "Prio1"},
Custom: []*cm.CustomAttribute{
{Type: "String", Key: "channel", Value: "Facebook", Source: "integration"},
{Type: "Integer", Key: "age", Value: 18},
},
},
WebsiteUrl: "https://example.com",
});
chartmogul.Customer.create(
config,
data={
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"external_id": "cus_0001",
"name": "Adam Smith",
"email": "[email protected]",
"country": "US",
"state": "US-NY",
"city": "New York",
"company": "Pinata Technologies",
"lead_created_at": "2022-10-14",
"free_trial_started_at": "2022-11-01",
"attributes": {
"tags": ["important", "Prio1"],
"custom": [
{
"type": "String",
"key": "channel",
"value": "Facebook",
"source": "integration",
},
{
"type": "Integer",
"key": "age",
"value": 18
},
],
},
"website_url": "https://example.com",
},
)
Result Format
{
"id": 74596,
"uuid": "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
"external_id": "cus_0001",
"external_ids": ["cus_0001"],
"data_source_uuid": "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"data_source_uuids": ["ds_fef05d54-47b4-431b-aed2-eb6b9e545430"],
"name": "Adam Smith",
"email": "[email protected]",
"company": "Pinata Technologies",
"status": "Active",
"lead_created_at": "2022-10-14T00:00:00.000Z",
"free_trial_started_at": "2022-11-01T00:00:00.000Z",
"customer-since": null,
"zip": null,
"city": "New York",
"state": "NY",
"country": "US",
"address": {
"address_zip": null,
"city": "New York",
"state": "New York",
"country": "United States"
},
"attributes": {
"tags": ["important", "Prio1"],
"custom": { "channel": "Facebook", "age": 18 },
"stripe": {},
"clearbit": {}
},
"mrr": 0,
"arr": 0,
"billing-system-type": "Custom",
"billing-system-url": null,
"chartmogul-url": "https://app.chartmogul.com/#/customers/74596-Pinata_Technologies",
"currency": "USD",
"currency-sign": "$",
"owner": "[email protected]",
"website_url": "https://example.com"
}
<ChartMogul::Customer:0x000000006615e8
@id=74596,
@uuid="cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
@external_id="cus_0001",
@external_ids=["cus_0001"],
@data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
@data_source_uuids=["ds_fef05d54-47b4-431b-aed2-eb6b9e545430"]
@name="Adam Smith",
@email="[email protected]",
@company="Pinata Technologies",
@status="Active",
@lead_created_at=2022-10-24 00:00:00 UTC,
@free_trial_started_at=2022-11-01 00:00:00 UTC,
@customer_since=nil,
@zip=nil,
@city="New York",
@state="NY",
@country="US",
@address={
:address_zip=>nil,
:city=>"New York",
:state=>"New York",
:country=>"United States",
},
@attributes={
:tags=>["important", "Prio1"],
:custom=>{:channel=>"Facebook", :age=>18},
:stripe=>{},
:clearbit=>{}, # deprecated
},
@mrr=0,
@arr=0,
@billing_system_type="Custom",
@billing_system_url=nil,
@chartmogul_url="https://app.chartmogul.com/#/customers/74596-Pinata_Technologies",
@currency="USD",
@currency_sign="$",
@owner="[email protected]",
@website_url="https://example.com",
>
{
id: 74596,
uuid: "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
external_id: "cus_0001",
external_ids: ["cus_0001"],
data_source_uuid: "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
data_source_uuids: ["ds_fef05d54-47b4-431b-aed2-eb6b9e545430"],
name: "Adam Smith",
email: "[email protected]",
company: "Pinata Technologies",
status: "Active",
lead_created_at: "2022-10-14T00:00:00.000Z",
free_trial_started_at: "2022-11-01T00:00:00.000Z",
"customer-since": null,
zip: null,
city: "New York",
state: "NY",
country: "US",
address: {
address_zip: null,
city: "New York",
state: "New York",
country: "United States"
},
attributes: {
tags: ["important", "Prio1"],
custom: { channel: "Facebook", age: 18 },
stripe: {},
clearbit: {}
},
mrr: 0,
arr: 0,
"billing-system-type": "Custom",
"billing-system-url": null,
"chartmogul-url": "https://app.chartmogul.com/#/customers/74596-Pinata_Technologies",
currency: "USD",
"currency-sign": "$",
owner: "[email protected]",
website_url: "https://example.com"
}
ChartMogul\Customer::__set_state(array(
"id" => 74596,
"uuid" => "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
"external_id" => "cus_0001",
"external_ids" => array(
0 => "cus_0001",
),
"data_source_uuid" => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
"data_source_uuids" => array(
0 => "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
),
"name" => "Adam Smith",
"email" => "[email protected]",
"company" => "Pinata Technologies",
"status" => "Active",
"lead_created_at" => "2022-10-14T00:00:00.000Z",
"free_trial_started_at" => "2022-11-01T00:00:00.000Z",
"customer_since" => NULL,
"zip" => NULL,
"city" => "New York",
"state" => "NY",
"country" => "US",
"address" => array(
"address_zip" => NULL,
"city" => "New York",
"state" => "New York",
"country" => "United States",
),
"attributes" => array(
"tags" => array(
0 => "important",
1 => "Prio1",
),
"custom" => array(
"channel" => "Facebook",
"age" => 18,
),
"stripe" => array(),
"clearbit" => array(), // deprecated
),
"mrr" => 0,
"arr" => 0,
"billing_system_type" => "Custom",
"billing_system_url" => NULL,
"chartmogul_url" => "https://app.chartmogul.com/#/customers/74596-Pinata_Technologies",
"currency" => "USD",
"currency_sign" => "$",
"owner" => "[email protected]",
"website_url" => "https://example.com",
))
(*chartmogul.Customer)(0xc0420706e0)({
ID: (uint32) 74596,
UUID: (string) (len=40) "cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
ExternalID: (string) (len=8) "cus_0001",
ExternalIDs: ([]string) (len=1 cap=1) {
(string) (len=8) "cus_0001",
},
DataSourceUUID: (string) (len=39) "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
DataSourceUUIDs: ([]string) (len=1 cap=1) {
(string) (len=39) "ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
},
Name: (string) (len=10) "Adam Smith",
Email: (string) (len=14) "[email protected]",
Company: (string) (len=19) "Pinata Technologies",
Status: (string) (len=6) "Active",
LeadCreatedAt: (string) (len=24) "2022-10-14T00:00:00.000Z",
FreeTrialStartedAt: (string) (len=24) "2022-11-01T00:00:00.000Z",
CustomerSince: (string) "",
City: (string) (len=8) "New York",
State: (string) (len=2) "NY",
Country: (string) (len=2) "US",
Address: (*chartmogul.Address)(0xc0421e4000)({
AddressZIP: (string) "",
City: (string) (len=8) "New York",
State: (string) (len=8) "New York",
Country: (string) (len=13) "United States",
}),
Attributes: (*chartmogul.Attributes)(0xc04221a3c0)({
Tags: ([]string) (len=2 cap=4) {
(string) (len=9) "important",
(string) (len=5) "Prio1"
},
Custom: (map[string]interface {}) (len=2) {
(string) (len=7) "channel": (string) (len=8) "Facebook",
(string) (len=3) "age": (float64) 18
},
Stripe: (map[string]interface {}) {},
Clearbit: (map[string]interface {}) {}, // deprecated
}),
Mrr: (float64) 0,
Arr: (float64) 0,
BillingSystemType: (string) (len=10) "Custom",
BillingSystemURL: (string) "",
ChartmogulURL: (string) (len=56) "https://app.chartmogul.com/#/customers/74596-Pinata_Technologies",
Currency: (string) (len=3) "USD",
CurrencySign: (string) (len=1) "$",
Owner: (string) (len=25) "[email protected]",
WebsiteUrl: (string) (len=19) "https://example.com",
Errors: (chartmogul.Errors) chartmogul: map[],
})
<Customer{
id=74596,
uuid="cus_f466e33d-ff2b-4a11-8f85-417eb02157a7",
external_id="cus_0001",
external_ids=["cus_0001"],
data_source_uuid="ds_fef05d54-47b4-431b-aed2-eb6b9e545430",
data_source_uuids=["ds_fef05d54-47b4-431b-aed2-eb6b9e545430"],
name="Adam Smith",
email="[email protected]",
company="Pinata Technologies",
status="Active",
free_trial_started_at=datetime.datetime(2022, 11, 1, 0, 0),
lead_created_at=datetime.datetime(2022, 10, 14, 0, 0),
customer_since=None,
zip=None,
city="New York",
state="NY",
country="US",
address=<Address{
address_zip=None,
city="New York",
state="New York",
country="United States",
}>,
attributes=<Attributes{
tags=["important", "Prio1"],
custom={channel: "Facebook", age: 18},
stripe={},
clearbit={}, # deprecated
}>,
mrr=0.0,
arr=0.0,
billing_system_type="Custom",
billing_system_url=None,
chartmogul_url="https://app.chartmogul.com/#/customers/74596-Pinata_Technologies",
currency="USD",
currency_sign="$",
owner: "[email protected]",
website_url="https://example.com",
}>
The response object contains the following data:
Key | Description |
---|---|
id | The internal ChartMogul ID for the customer object. |
uuid | The ChartMogul UUID for the customer. |
external_id | The unique external identifier for the customer. It usually originates from a billing system outside of ChartMogul. |
external_ids | An array containing the unique external identifiers of both the customer itself as well as all customer records that have been merged into it. |
data_source_uuid | The ChartMogul UUID for the source the customer is from. |
data_source_uuids | An array containing the ChartMogul UUIDs for the source the customer is from as well as the UUIDs for the sources of customers merged into it. |
name | DEPRECATED The customer's name. This parameter is getting deprecated. Instead, use the first_name and last_name of the contact object when importing data into ChartMogul. |
email | DEPRECATED The customer's email address. This parameter is getting deprecated. Instead, use the email of the contact object when importing data into ChartMogul. |
company | The customer's company name. |
status | The customer status. One of New Lead , Working Lead , Qualified Lead , Unqualified Lead , Active , Past Due , or Cancelled . |
lead_created_at | The time the customer was established as lead. This is given as ISO 8601-formatted string, except in the Ruby and Python libraries (where they are given as datetime objects). |
free_trial_started_at | The time at which the customer started a free trial. This is given as ISO 8601-formatted string, except in the Ruby and Python libraries (where they are given as datetime objects). |
customer-since | The time at which the customer started their first subscription. This is given as ISO 8601-formatted string, except in the Ruby and Python libraries (where they are given as datetime objects). |
zip | The zip code from the customer's address, as a string. |
city | The city from the customer's address. |
state | The US state where the customer is located — the last two letters of the US state code as per the ISO-3166-2 standard. For example, CA or NY . |
country | The country from customer's address, as ISO 3166-1 alpha-2-formatted string. |
address | An object containing the customer's address. |
address.address_zip | The zip code from the customer's address. |
address.city | The full name for the city from the customer's address. |
address.state | The full name for the state from the customer's address. |
address.country | The full name for the country from the customer's address. |
attributes | An object containing tags, custom attributes, and Stripe metadata. |
attributes.tags | An array of tags on the customer. |
attributes.custom | An object containing the custom attributes on the custom, as key-value pairs. |
attributes.stripe | An object with the customer's Stripe metadata. An empty object if the customer is not a Stripe customer. |
attributes.clearbit | [deprecated] A legacy field, formerly containing publicly available information about the customer. However, ChartMogul no longer utilizes Clearbit, thus the value will always be an empty object. |
mrr | The current monthly recurring revenue for this customer, expressed in your account currency, as an integer number of cents. For the actual amount, divide by 100. |
arr | The current annual run rate for this customer, expressed in your account currency, as an integer number of cents. For the actual amount, divide by 100. |
billing-system-type | The billing system the customer was imported from. For example Stripe , Recurly , Custom , etcetera. |
billing-system-url | A URL for this customer linking to the customer record in your billing system, if available. |
chartmogul-url | A URL for this customer linking to the customer record in ChartMogul. |
currency | Your account currency. This is used to express MRR and ARR in. |
currency-sign | The symbol(s) used to represent the currency, e.g. $ , or € . |
owner | The user responsible for the customer relationship. |
website_url | The URL of the customer's website. |