Customers

Customer objects allow you to tie all interactions with the Lean platform to the same customer. The API allows you to create your customers. You can retrieve individual customers by their Lean ID or an id that you assign them in your own platform.

ENDPOINTS

POST /customers/v1/
GET /customers/v1/:customer_id
GET /customers/v1/app-user-id/:id
GET /customers/v1/:customer_id/entities
GET /customers/v1/:customer_id/entities/:entity_id
GET /customers/v1/:customer_id/payment-sources
GET /customers/v1/:customer_id/payment-source/:payment_source_id
GET /customers/v1/:customer_id/destinations

The Customer object

Attributes

customer_id string

Unique identifier for the customer


app_id string The application this user is tied to


app_user_id string

An assigned user id value from your backend. This has a unique constraint.


json

{
"customer_id": "34c11087-b6bc-429b-9a91-725941b1a547",
"app_id": YOUR_APP_ID,
"app_user_id": "123"
}

Create a customer

Parameters

app_user_id string

A unique value from your database, can be the corresponding User ID in your system, or any other string.

Response

Returns a newly created Customer object. Returns an error if the app_user_id is not unique, or has been created before.

bash

curl -X POST 'https://sandbox.leantech.me/customers/v1' \
--header 'lean-app-token: YOUR_APP_TOKEN', \
--header 'Content-Type: application/json' \
--data-raw '{
"user_app_id": "prod_user_001"
}'

json

{
"customer_id": "b2476424-ead1-44a9-9d07-df10ed6ca747",
"app_user_id": "prod_user_001"
}

Retrieving a Customer

You can fetch a Customer using either the customer_id or the app_user_id you supplied when creating the resource.

Parameters

customer_id string

The Customer you want to retrieve.


app-user-id string

An ID you supplied during creation of the Customer resource.


jsx

curl -X GET 'https://sandbox.leantech.me/customers/v1/b2476424-ead1-44a9-9d07-df10ed6ca747' \
--header 'lean-app-token: YOUR_APP_TOKEN', \
--header 'Content-Type: application/json' \

jsx

curl -X GET 'https://sandbox.leantech.me/customers/v1/app-user-id/123' \
--header 'lean-app-token: YOUR_APP_TOKEN', \
--header 'Content-Type: application/json' \

jsx

{
"customer_id": "34c11087-b6bc-429b-9a91-725941b1a547",
"app_id": YOUR_APP_ID,
"app_user_id": "123"
}

Querying resources attached to a Customer

The Customer API allows querying of objects attached to each Customer. You can read more about these in the relevant Object documentation in this reference.

Entity objects

Payment Source objects

Destination(s)