LogoLogo
  • Inveterate Dev Docs
  • API Reference Docs
    • Public API 2.0 Reference
      • Admin
        • Benefits
        • Members
          • Credits
        • Merchant
        • Tiers
          • Benefits
          • Campaigns
        • Webhooks
      • Storefront
        • Members
          • Credits
            • Redemption
          • Cancellation
        • Benefits
        • Tiers
          • Benefits
          • Campaigns
        • Specification
      • Schemas
    • [LEGACY] Public API Reference
      • Benefits API
      • Campaigns API
      • Customers API
      • Merchant API
      • Credits API
      • Free tiers API
      • Webhooks
  • Stack Reference Docs
    • Landing Page
    • Storefront
      • Properties
      • Customizations
        • Add To Cart Button
    • Customer Metafields
Powered by GitBook
On this page
  • Endpoints & Methods
  • Get a single customer
  • Get all customers
  • Get Customers (Paginated)
  • Cancel Customer Subscription
  • Request customer cancellation

Was this helpful?

Export as PDF
  1. API Reference Docs
  2. [LEGACY] Public API Reference

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

Name
Type
Description

customerId*

String

The Shopify ID for a specific customer.

Headers

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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"
  ]
}

PreviousCampaigns APINextMerchant API

Last updated 1 year ago

Was this helpful?