Skip to main content

Create 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": "",
"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",
"timezone": "Europe/Paris",
"url": "http://hooli.com",
"zipcode": "91364",
"billing_configuration": {
"invoice_grace_period": 3,
"payment_provider": "stripe",
"provider_customer_id": "cus_12345",
"sync": true,
"sync_with_provider": true,
"document_locale": "fr",
"vat_rate": 12.5
},
"metadata": [
{
"key": "Name",
"value": "John",
"display_in_invoice": 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",
"timezone": "Europe/Paris",
"url": "http://hooli.com",
"zipcode": "91364",
"billing_configuration": {
"invoice_grace_period": 3,
"payment_provider": "stripe",
"provider_customer_id": "cus_12345",
"sync": true,
"sync_with_provider": true,
"document_locale": "fr",
"vat_rate": 12.5
},
"metadata": [
{
"key": "Key example",
"value": "Value example",
"display_in_invoice": true
}
]
}
}
info

If the customer already exists, this request will trigger 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 of the customer's billing address
currencyString      Optional
ISO 4217
Currency of the customer - learn more
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      OptionalFull name of the customer
phoneString      OptionalPhone number of the customer
stateString      OptionalState of the customer's billing address
timezoneString      Optional
TZ database
Timezone of the customer - learn more
Will override the organization's timezone
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
invoice_grace_periodInteger      OptionalGrace period in days for the invoice.
payment_providerString      OptionalPayment provider used to bill the customer.
Accepted values: stripe and gocardless
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
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
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
document_localeString      OptionalDocument locale in ISO 639-1 format - learn more
vat_rateFloat      OptionalCustom VAT applied to the customer.
It will override the one defined at organization level

Metadata

AttributesTypeDescription
keyString      OptionalMetadata object key
valueString      OptionalMetadata object value
display_in_invoiceBoolean      OptionalField that determines whether the metadata key-value pair will be visible on invoices

Responses

The customer was succesfuly created or updated.

Returns a customer object.