Customers API
A customer in the Inveterate system is anyone that has purchased an Inveterate subscription product from this merchant's store.
A customer is represented as an object with the following structure:
{
accountState: String, // from Shopify
contractId: Number,
createdAt: String,
credit: Number,
customerId: String,
email: String,
firstName: String,
lastName: String,
orderCount: Number,
orderIds: Array[Number]
merchantId: String,
status: String, // status of Inveterate subscription
totalSpend: Number,
updatedAt: String
}Endpoints & Methods
Get a single customer
GET https://public.inveterateapi.com/customers/{customerId}
Gets a single customer.
Path Parameters
customerId*
String
The Shopify ID for a specific customer.
Headers
X-Inveterate-Api-Key*
String
Required to access all protected endpoints on this API. Obtained from merchant's Inveterate dashboard.
{
"data": {
"customer": {
"accountState": "ENABLED",
"contractId": 1234567890,
"createdAt": "2021-10-27T18:10:08.754Z",
...
}
}
"success": true,
"errors": []
}{
"data": {}
"success": false,
"errors": [
"Invalid API key"
]
}Get all customers
GET https://api.inveterate.com/2022-01/customers
Query Parameters
limit
Int
Amount of customers to return per request. Default is no limit. Max is 100.
lastCustomerId
Int
Used to determine the index offset of which customers to return.
Headers
X-Inveterate-Api-Key*
String
Required to access all protected endpoints on this API. Obtained from merchant's Inveterate dashboard.
{
"data": {
"customers": [
{
"accountState": "ENABLED",
"contractId": 1234567890,
"createdAt": "2021-10-27T18:10:08.754Z",
...
}
],
"lastCustomerId": "1234567890"
}
"success": true,
"errors": []
}{
"data": {}
"success": false,
"errors": [
"Invalid API key"
]
}Get Customers (Paginated)
Optionally using the limit and lastCustomerId query string parameters, you can "paginate" through the customer records returned.
For the first page, just add the limit parameter. The response for this will include the lastCustomerId, which needs to be added as a query string parameter to the request for page 2.
Page 1 request example
curl --location --request GET "${PUBLIC_API_URL}/customers?limit=1" \
--header "X-Inveterate-Api-Key: ${PUBLIC_API_KEY}"Page 1 response example
{
"success": true,
"data": {
"customers": [
{
"lastName": "Alda",
"firstName": "Alan",
"customerId": "6082598928622"
}
],
"lastCustomerId": "6082598928622",
"limit": "1"
},
"errors": []
}Page 2 request example
curl --location --request GET "${PUBLIC_API_URL}/customers?limit=1&lastCustomerId=6082598928622" \
--header "X-Inveterate-Api-Key: ${PUBLIC_API_KEY}"Page 2 response example
{
"success": true,
"data": {
"customers": [
{
"lastName": "Bernanke",
"firstName": "Ben",
"customerId": "6082606694638"
}
],
"lastCustomerId": "6082606694638",
"limit": "1"
},
"errors": []
}Cancel Customer Subscription
Request customer cancellation
POST https://public.inveterateapi.com/customers/{customerId}/cancel
Step 1 of the customer's subscription cancellation process. A successful request to this endpoint submits a customer cancellation request. Customer will receive an email with a link to confirm cancellation of their subscription.
Request Body
merchantId*
String
{
"success": true,
"data": {
"cancelRequest": {
"merchantId": "inveterate-staging-barefoot",
"cancelToken": "c52157e9-2406-49d1-b374-583c92a3e3dd",
"customerId": "5574691979318",
"status": "INITIALIZED",
"createdAt": "2022-03-15T00:07:16.168Z",
"updatedAt": "2022-03-15T00:07:16.168Z"
}
},
"errors": []
}{
"data": {}
"success": false,
"errors": [
"Invalid API key"
]
}Last updated
Was this helpful?
