Skip to main content

Create or update a customer

Route

POST
/api/v1/customers

Usage

LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request POST "$LAGO_URL/api/v1/customers" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"customer": {
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"currency": "EUR",
"email": "dinesh@piedpiper.test",
"legal_name": "Coleman-Blair",
"legal_number": "49-008-2965",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"phone": "1-171-883-3711 x245",
"state": "CA",
"url": "http://hooli.com",
"zipcode": "91364",
"billing_configuration": {
"payment_provider": "stripe",
"provider_customer_id": "cus_12345",
"sync": true,
"vat_rate": 12.5,
"sync_with_provider": true
}
}
}'

Arguments

{
"customer": {
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"currency": "EUR",
"email": "dinesh@piedpiper.test",
"legal_name": "Coleman-Blair",
"legal_number": "49-008-2965",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"phone": "1-171-883-3711 x245",
"state": "CA",
"url": "http://hooli.com",
"zipcode": "91364",
"billing_configuration": {
"payment_provider": "stripe",
"provider_customer_id": "cus_12345",
"sync": true,
"vat_rate": 12.5,
"sync_with_provider": true
}
}
}
info

If the customer already exists, the call will work as an update

AttributesTypeDescription
external_idString      RequiredCustomer unique identifier in your application
address_line1String      OptionalFirst line of the billing address
address_line2String      OptionalSecond line of the billing address
cityString      OptionalCity of the customer's billing address
countryString      Optional
ISO 3166 alpha 2 Country code.
Country code of the customer's billing address
currencyString      OptionalCurrency of customer
emailString      OptionalEmail of the customer
legal_nameString      OptionalLegal company name of the customer
legal_numberString      OptionalLegal company number of the customer
logo_urlString      OptionalLogo URL of the customer
nameString      RequiredFull name of the customer
phoneString      OptionalPhone number of the customer
stateString      OptionalState of the customer's billing address
urlString      OptionalCustom URL of the customer
zipcodeString      OptionalZipcode of the customer's billing address
billing_configurationObject      OptionalPayment provider specific configuration used to bill the customer

Billing configuration

AttributesTypeDescription
payment_providerString      OptionalPayment provider used to bill the customer.
Only accepted value: stripe, this field is required if you want to assign a provider_customer_id
provider_customer_idString      OptionalCustomer ID on the payment provider.
If not provided, Lago can optionally create the provider customer
sync_with_providerBoolean      OptionalSet to true if you want to create the customer record in the provider's system. Only applies when provider_customer_id is null and sync_with_provider is set to true. Default value: false
syncBoolean      OptionalSet to true is you want to create the provider customer synchronously with the customer creation.
Apply only when provider_customer_id is null and payment provider is configured to create customer.
Default value: false
vat_rateFloat      OptionalCustom VAT applied to the customer.
It will override the one defined at organization level

Responses

The customer was succesfuly created or updated.

Returns a customer object.