Create customer
curl --request POST \
--url https://api.getlago.com/api/v2/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"external_id": "customer_123",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"account_type": "customer",
"email": "billing@acme.example",
"phone": "example",
"url": "example",
"logo_url": "example",
"address_line1": "example",
"address_line2": "example",
"city": "example",
"state": "example",
"zipcode": "example",
"country": "example",
"legal_name": "example",
"legal_number": "example",
"tax_identification_number": "example",
"currency": "USD",
"timezone": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"external_salesforce_id": "example",
"billing_entity_code": "main",
"invoice_grace_period": 1,
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"sync": false,
"sync_with_provider": false,
"shipping_address": {
"address_line1": "example",
"address_line2": "example",
"city": "example",
"zipcode": "example",
"state": "example",
"country": "FR"
},
"tax_codes": [
"vat"
],
"invoice_custom_section_codes": [
"legal"
],
"metadata": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "reference",
"value": "123",
"display_on_invoice": false
}
],
"integration_customers": [
{
"integration_type": "netsuite",
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "default",
"external_customer_id": "customer_123",
"integration_code": "anrok",
"subsidiary_id": "subsidiary_123",
"sync_with_provider": false,
"targeted_object": "customer"
}
]
}
}
'import requests
url = "https://api.getlago.com/api/v2/customers"
payload = { "customer": {
"external_id": "customer_123",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"account_type": "customer",
"email": "billing@acme.example",
"phone": "example",
"url": "example",
"logo_url": "example",
"address_line1": "example",
"address_line2": "example",
"city": "example",
"state": "example",
"zipcode": "example",
"country": "example",
"legal_name": "example",
"legal_number": "example",
"tax_identification_number": "example",
"currency": "USD",
"timezone": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": False,
"external_salesforce_id": "example",
"billing_entity_code": "main",
"invoice_grace_period": 1,
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": ["card"],
"document_locale": "example",
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"sync": False,
"sync_with_provider": False,
"shipping_address": {
"address_line1": "example",
"address_line2": "example",
"city": "example",
"zipcode": "example",
"state": "example",
"country": "FR"
},
"tax_codes": ["vat"],
"invoice_custom_section_codes": ["legal"],
"metadata": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "reference",
"value": "123",
"display_on_invoice": False
}
],
"integration_customers": [
{
"integration_type": "netsuite",
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "default",
"external_customer_id": "customer_123",
"integration_code": "anrok",
"subsidiary_id": "subsidiary_123",
"sync_with_provider": False,
"targeted_object": "customer"
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
external_id: 'customer_123',
name: 'example',
firstname: 'example',
lastname: 'example',
customer_type: 'company',
account_type: 'customer',
email: 'billing@acme.example',
phone: 'example',
url: 'example',
logo_url: 'example',
address_line1: 'example',
address_line2: 'example',
city: 'example',
state: 'example',
zipcode: 'example',
country: 'example',
legal_name: 'example',
legal_number: 'example',
tax_identification_number: 'example',
currency: 'USD',
timezone: 'example',
finalize_zero_amount_invoice: 'inherit',
skip_invoice_custom_sections: false,
external_salesforce_id: 'example',
billing_entity_code: 'main',
invoice_grace_period: 1,
payment_provider: 'example',
payment_provider_code: 'example',
provider_customer_id: 'cus_example',
provider_payment_methods: ['card'],
document_locale: 'example',
periodic_invoice_issuing_date_anchor: 'current_period_end',
periodic_invoice_issuing_date_adjustment: 'keep_anchor',
sync: false,
sync_with_provider: false,
shipping_address: {
address_line1: 'example',
address_line2: 'example',
city: 'example',
zipcode: 'example',
state: 'example',
country: 'FR'
},
tax_codes: ['vat'],
invoice_custom_section_codes: ['legal'],
metadata: [
{
id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
key: 'reference',
value: '123',
display_on_invoice: false
}
],
integration_customers: [
{
integration_type: 'netsuite',
id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
code: 'default',
external_customer_id: 'customer_123',
integration_code: 'anrok',
subsidiary_id: 'subsidiary_123',
sync_with_provider: false,
targeted_object: 'customer'
}
]
}
})
};
fetch('https://api.getlago.com/api/v2/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v2/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'external_id' => 'customer_123',
'name' => 'example',
'firstname' => 'example',
'lastname' => 'example',
'customer_type' => 'company',
'account_type' => 'customer',
'email' => 'billing@acme.example',
'phone' => 'example',
'url' => 'example',
'logo_url' => 'example',
'address_line1' => 'example',
'address_line2' => 'example',
'city' => 'example',
'state' => 'example',
'zipcode' => 'example',
'country' => 'example',
'legal_name' => 'example',
'legal_number' => 'example',
'tax_identification_number' => 'example',
'currency' => 'USD',
'timezone' => 'example',
'finalize_zero_amount_invoice' => 'inherit',
'skip_invoice_custom_sections' => false,
'external_salesforce_id' => 'example',
'billing_entity_code' => 'main',
'invoice_grace_period' => 1,
'payment_provider' => 'example',
'payment_provider_code' => 'example',
'provider_customer_id' => 'cus_example',
'provider_payment_methods' => [
'card'
],
'document_locale' => 'example',
'periodic_invoice_issuing_date_anchor' => 'current_period_end',
'periodic_invoice_issuing_date_adjustment' => 'keep_anchor',
'sync' => false,
'sync_with_provider' => false,
'shipping_address' => [
'address_line1' => 'example',
'address_line2' => 'example',
'city' => 'example',
'zipcode' => 'example',
'state' => 'example',
'country' => 'FR'
],
'tax_codes' => [
'vat'
],
'invoice_custom_section_codes' => [
'legal'
],
'metadata' => [
[
'id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'key' => 'reference',
'value' => '123',
'display_on_invoice' => false
]
],
'integration_customers' => [
[
'integration_type' => 'netsuite',
'id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'code' => 'default',
'external_customer_id' => 'customer_123',
'integration_code' => 'anrok',
'subsidiary_id' => 'subsidiary_123',
'sync_with_provider' => false,
'targeted_object' => 'customer'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v2/customers"
payload := strings.NewReader("{\n \"customer\": {\n \"external_id\": \"customer_123\",\n \"name\": \"example\",\n \"firstname\": \"example\",\n \"lastname\": \"example\",\n \"customer_type\": \"company\",\n \"account_type\": \"customer\",\n \"email\": \"billing@acme.example\",\n \"phone\": \"example\",\n \"url\": \"example\",\n \"logo_url\": \"example\",\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"state\": \"example\",\n \"zipcode\": \"example\",\n \"country\": \"example\",\n \"legal_name\": \"example\",\n \"legal_number\": \"example\",\n \"tax_identification_number\": \"example\",\n \"currency\": \"USD\",\n \"timezone\": \"example\",\n \"finalize_zero_amount_invoice\": \"inherit\",\n \"skip_invoice_custom_sections\": false,\n \"external_salesforce_id\": \"example\",\n \"billing_entity_code\": \"main\",\n \"invoice_grace_period\": 1,\n \"payment_provider\": \"example\",\n \"payment_provider_code\": \"example\",\n \"provider_customer_id\": \"cus_example\",\n \"provider_payment_methods\": [\n \"card\"\n ],\n \"document_locale\": \"example\",\n \"periodic_invoice_issuing_date_anchor\": \"current_period_end\",\n \"periodic_invoice_issuing_date_adjustment\": \"keep_anchor\",\n \"sync\": false,\n \"sync_with_provider\": false,\n \"shipping_address\": {\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"zipcode\": \"example\",\n \"state\": \"example\",\n \"country\": \"FR\"\n },\n \"tax_codes\": [\n \"vat\"\n ],\n \"invoice_custom_section_codes\": [\n \"legal\"\n ],\n \"metadata\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"key\": \"reference\",\n \"value\": \"123\",\n \"display_on_invoice\": false\n }\n ],\n \"integration_customers\": [\n {\n \"integration_type\": \"netsuite\",\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"default\",\n \"external_customer_id\": \"customer_123\",\n \"integration_code\": \"anrok\",\n \"subsidiary_id\": \"subsidiary_123\",\n \"sync_with_provider\": false,\n \"targeted_object\": \"customer\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getlago.com/api/v2/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"external_id\": \"customer_123\",\n \"name\": \"example\",\n \"firstname\": \"example\",\n \"lastname\": \"example\",\n \"customer_type\": \"company\",\n \"account_type\": \"customer\",\n \"email\": \"billing@acme.example\",\n \"phone\": \"example\",\n \"url\": \"example\",\n \"logo_url\": \"example\",\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"state\": \"example\",\n \"zipcode\": \"example\",\n \"country\": \"example\",\n \"legal_name\": \"example\",\n \"legal_number\": \"example\",\n \"tax_identification_number\": \"example\",\n \"currency\": \"USD\",\n \"timezone\": \"example\",\n \"finalize_zero_amount_invoice\": \"inherit\",\n \"skip_invoice_custom_sections\": false,\n \"external_salesforce_id\": \"example\",\n \"billing_entity_code\": \"main\",\n \"invoice_grace_period\": 1,\n \"payment_provider\": \"example\",\n \"payment_provider_code\": \"example\",\n \"provider_customer_id\": \"cus_example\",\n \"provider_payment_methods\": [\n \"card\"\n ],\n \"document_locale\": \"example\",\n \"periodic_invoice_issuing_date_anchor\": \"current_period_end\",\n \"periodic_invoice_issuing_date_adjustment\": \"keep_anchor\",\n \"sync\": false,\n \"sync_with_provider\": false,\n \"shipping_address\": {\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"zipcode\": \"example\",\n \"state\": \"example\",\n \"country\": \"FR\"\n },\n \"tax_codes\": [\n \"vat\"\n ],\n \"invoice_custom_section_codes\": [\n \"legal\"\n ],\n \"metadata\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"key\": \"reference\",\n \"value\": \"123\",\n \"display_on_invoice\": false\n }\n ],\n \"integration_customers\": [\n {\n \"integration_type\": \"netsuite\",\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"default\",\n \"external_customer_id\": \"customer_123\",\n \"integration_code\": \"anrok\",\n \"subsidiary_id\": \"subsidiary_123\",\n \"sync_with_provider\": false,\n \"targeted_object\": \"customer\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"external_id\": \"customer_123\",\n \"name\": \"example\",\n \"firstname\": \"example\",\n \"lastname\": \"example\",\n \"customer_type\": \"company\",\n \"account_type\": \"customer\",\n \"email\": \"billing@acme.example\",\n \"phone\": \"example\",\n \"url\": \"example\",\n \"logo_url\": \"example\",\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"state\": \"example\",\n \"zipcode\": \"example\",\n \"country\": \"example\",\n \"legal_name\": \"example\",\n \"legal_number\": \"example\",\n \"tax_identification_number\": \"example\",\n \"currency\": \"USD\",\n \"timezone\": \"example\",\n \"finalize_zero_amount_invoice\": \"inherit\",\n \"skip_invoice_custom_sections\": false,\n \"external_salesforce_id\": \"example\",\n \"billing_entity_code\": \"main\",\n \"invoice_grace_period\": 1,\n \"payment_provider\": \"example\",\n \"payment_provider_code\": \"example\",\n \"provider_customer_id\": \"cus_example\",\n \"provider_payment_methods\": [\n \"card\"\n ],\n \"document_locale\": \"example\",\n \"periodic_invoice_issuing_date_anchor\": \"current_period_end\",\n \"periodic_invoice_issuing_date_adjustment\": \"keep_anchor\",\n \"sync\": false,\n \"sync_with_provider\": false,\n \"shipping_address\": {\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"zipcode\": \"example\",\n \"state\": \"example\",\n \"country\": \"FR\"\n },\n \"tax_codes\": [\n \"vat\"\n ],\n \"invoice_custom_section_codes\": [\n \"legal\"\n ],\n \"metadata\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"key\": \"reference\",\n \"value\": \"123\",\n \"display_on_invoice\": false\n }\n ],\n \"integration_customers\": [\n {\n \"integration_type\": \"netsuite\",\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"default\",\n \"external_customer_id\": \"customer_123\",\n \"integration_code\": \"anrok\",\n \"subsidiary_id\": \"subsidiary_123\",\n \"sync_with_provider\": false,\n \"targeted_object\": \"customer\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"shipping_address": {
"address_line1": "example",
"address_line2": "example",
"city": "example",
"zipcode": "example",
"state": "example",
"country": "FR"
},
"x402_agent_address": "0x0000000000000000000000000000000000000000",
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "example",
"value": "example",
"display_on_invoice": false,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
],
"integration_customers": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"type": "netsuite",
"integration_code": "anrok",
"code": "default",
"is_default": false,
"category": "payment"
}
]
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}Customers
Create customer
Creates a new customer.
POST
/
customers
Create customer
curl --request POST \
--url https://api.getlago.com/api/v2/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": {
"external_id": "customer_123",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"account_type": "customer",
"email": "billing@acme.example",
"phone": "example",
"url": "example",
"logo_url": "example",
"address_line1": "example",
"address_line2": "example",
"city": "example",
"state": "example",
"zipcode": "example",
"country": "example",
"legal_name": "example",
"legal_number": "example",
"tax_identification_number": "example",
"currency": "USD",
"timezone": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"external_salesforce_id": "example",
"billing_entity_code": "main",
"invoice_grace_period": 1,
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"sync": false,
"sync_with_provider": false,
"shipping_address": {
"address_line1": "example",
"address_line2": "example",
"city": "example",
"zipcode": "example",
"state": "example",
"country": "FR"
},
"tax_codes": [
"vat"
],
"invoice_custom_section_codes": [
"legal"
],
"metadata": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "reference",
"value": "123",
"display_on_invoice": false
}
],
"integration_customers": [
{
"integration_type": "netsuite",
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "default",
"external_customer_id": "customer_123",
"integration_code": "anrok",
"subsidiary_id": "subsidiary_123",
"sync_with_provider": false,
"targeted_object": "customer"
}
]
}
}
'import requests
url = "https://api.getlago.com/api/v2/customers"
payload = { "customer": {
"external_id": "customer_123",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"account_type": "customer",
"email": "billing@acme.example",
"phone": "example",
"url": "example",
"logo_url": "example",
"address_line1": "example",
"address_line2": "example",
"city": "example",
"state": "example",
"zipcode": "example",
"country": "example",
"legal_name": "example",
"legal_number": "example",
"tax_identification_number": "example",
"currency": "USD",
"timezone": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": False,
"external_salesforce_id": "example",
"billing_entity_code": "main",
"invoice_grace_period": 1,
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": ["card"],
"document_locale": "example",
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"sync": False,
"sync_with_provider": False,
"shipping_address": {
"address_line1": "example",
"address_line2": "example",
"city": "example",
"zipcode": "example",
"state": "example",
"country": "FR"
},
"tax_codes": ["vat"],
"invoice_custom_section_codes": ["legal"],
"metadata": [
{
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "reference",
"value": "123",
"display_on_invoice": False
}
],
"integration_customers": [
{
"integration_type": "netsuite",
"id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"code": "default",
"external_customer_id": "customer_123",
"integration_code": "anrok",
"subsidiary_id": "subsidiary_123",
"sync_with_provider": False,
"targeted_object": "customer"
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: {
external_id: 'customer_123',
name: 'example',
firstname: 'example',
lastname: 'example',
customer_type: 'company',
account_type: 'customer',
email: 'billing@acme.example',
phone: 'example',
url: 'example',
logo_url: 'example',
address_line1: 'example',
address_line2: 'example',
city: 'example',
state: 'example',
zipcode: 'example',
country: 'example',
legal_name: 'example',
legal_number: 'example',
tax_identification_number: 'example',
currency: 'USD',
timezone: 'example',
finalize_zero_amount_invoice: 'inherit',
skip_invoice_custom_sections: false,
external_salesforce_id: 'example',
billing_entity_code: 'main',
invoice_grace_period: 1,
payment_provider: 'example',
payment_provider_code: 'example',
provider_customer_id: 'cus_example',
provider_payment_methods: ['card'],
document_locale: 'example',
periodic_invoice_issuing_date_anchor: 'current_period_end',
periodic_invoice_issuing_date_adjustment: 'keep_anchor',
sync: false,
sync_with_provider: false,
shipping_address: {
address_line1: 'example',
address_line2: 'example',
city: 'example',
zipcode: 'example',
state: 'example',
country: 'FR'
},
tax_codes: ['vat'],
invoice_custom_section_codes: ['legal'],
metadata: [
{
id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
key: 'reference',
value: '123',
display_on_invoice: false
}
],
integration_customers: [
{
integration_type: 'netsuite',
id: '1a901a90-1a90-1a90-1a90-1a901a901a90',
code: 'default',
external_customer_id: 'customer_123',
integration_code: 'anrok',
subsidiary_id: 'subsidiary_123',
sync_with_provider: false,
targeted_object: 'customer'
}
]
}
})
};
fetch('https://api.getlago.com/api/v2/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getlago.com/api/v2/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'external_id' => 'customer_123',
'name' => 'example',
'firstname' => 'example',
'lastname' => 'example',
'customer_type' => 'company',
'account_type' => 'customer',
'email' => 'billing@acme.example',
'phone' => 'example',
'url' => 'example',
'logo_url' => 'example',
'address_line1' => 'example',
'address_line2' => 'example',
'city' => 'example',
'state' => 'example',
'zipcode' => 'example',
'country' => 'example',
'legal_name' => 'example',
'legal_number' => 'example',
'tax_identification_number' => 'example',
'currency' => 'USD',
'timezone' => 'example',
'finalize_zero_amount_invoice' => 'inherit',
'skip_invoice_custom_sections' => false,
'external_salesforce_id' => 'example',
'billing_entity_code' => 'main',
'invoice_grace_period' => 1,
'payment_provider' => 'example',
'payment_provider_code' => 'example',
'provider_customer_id' => 'cus_example',
'provider_payment_methods' => [
'card'
],
'document_locale' => 'example',
'periodic_invoice_issuing_date_anchor' => 'current_period_end',
'periodic_invoice_issuing_date_adjustment' => 'keep_anchor',
'sync' => false,
'sync_with_provider' => false,
'shipping_address' => [
'address_line1' => 'example',
'address_line2' => 'example',
'city' => 'example',
'zipcode' => 'example',
'state' => 'example',
'country' => 'FR'
],
'tax_codes' => [
'vat'
],
'invoice_custom_section_codes' => [
'legal'
],
'metadata' => [
[
'id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'key' => 'reference',
'value' => '123',
'display_on_invoice' => false
]
],
'integration_customers' => [
[
'integration_type' => 'netsuite',
'id' => '1a901a90-1a90-1a90-1a90-1a901a901a90',
'code' => 'default',
'external_customer_id' => 'customer_123',
'integration_code' => 'anrok',
'subsidiary_id' => 'subsidiary_123',
'sync_with_provider' => false,
'targeted_object' => 'customer'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v2/customers"
payload := strings.NewReader("{\n \"customer\": {\n \"external_id\": \"customer_123\",\n \"name\": \"example\",\n \"firstname\": \"example\",\n \"lastname\": \"example\",\n \"customer_type\": \"company\",\n \"account_type\": \"customer\",\n \"email\": \"billing@acme.example\",\n \"phone\": \"example\",\n \"url\": \"example\",\n \"logo_url\": \"example\",\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"state\": \"example\",\n \"zipcode\": \"example\",\n \"country\": \"example\",\n \"legal_name\": \"example\",\n \"legal_number\": \"example\",\n \"tax_identification_number\": \"example\",\n \"currency\": \"USD\",\n \"timezone\": \"example\",\n \"finalize_zero_amount_invoice\": \"inherit\",\n \"skip_invoice_custom_sections\": false,\n \"external_salesforce_id\": \"example\",\n \"billing_entity_code\": \"main\",\n \"invoice_grace_period\": 1,\n \"payment_provider\": \"example\",\n \"payment_provider_code\": \"example\",\n \"provider_customer_id\": \"cus_example\",\n \"provider_payment_methods\": [\n \"card\"\n ],\n \"document_locale\": \"example\",\n \"periodic_invoice_issuing_date_anchor\": \"current_period_end\",\n \"periodic_invoice_issuing_date_adjustment\": \"keep_anchor\",\n \"sync\": false,\n \"sync_with_provider\": false,\n \"shipping_address\": {\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"zipcode\": \"example\",\n \"state\": \"example\",\n \"country\": \"FR\"\n },\n \"tax_codes\": [\n \"vat\"\n ],\n \"invoice_custom_section_codes\": [\n \"legal\"\n ],\n \"metadata\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"key\": \"reference\",\n \"value\": \"123\",\n \"display_on_invoice\": false\n }\n ],\n \"integration_customers\": [\n {\n \"integration_type\": \"netsuite\",\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"default\",\n \"external_customer_id\": \"customer_123\",\n \"integration_code\": \"anrok\",\n \"subsidiary_id\": \"subsidiary_123\",\n \"sync_with_provider\": false,\n \"targeted_object\": \"customer\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getlago.com/api/v2/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"external_id\": \"customer_123\",\n \"name\": \"example\",\n \"firstname\": \"example\",\n \"lastname\": \"example\",\n \"customer_type\": \"company\",\n \"account_type\": \"customer\",\n \"email\": \"billing@acme.example\",\n \"phone\": \"example\",\n \"url\": \"example\",\n \"logo_url\": \"example\",\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"state\": \"example\",\n \"zipcode\": \"example\",\n \"country\": \"example\",\n \"legal_name\": \"example\",\n \"legal_number\": \"example\",\n \"tax_identification_number\": \"example\",\n \"currency\": \"USD\",\n \"timezone\": \"example\",\n \"finalize_zero_amount_invoice\": \"inherit\",\n \"skip_invoice_custom_sections\": false,\n \"external_salesforce_id\": \"example\",\n \"billing_entity_code\": \"main\",\n \"invoice_grace_period\": 1,\n \"payment_provider\": \"example\",\n \"payment_provider_code\": \"example\",\n \"provider_customer_id\": \"cus_example\",\n \"provider_payment_methods\": [\n \"card\"\n ],\n \"document_locale\": \"example\",\n \"periodic_invoice_issuing_date_anchor\": \"current_period_end\",\n \"periodic_invoice_issuing_date_adjustment\": \"keep_anchor\",\n \"sync\": false,\n \"sync_with_provider\": false,\n \"shipping_address\": {\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"zipcode\": \"example\",\n \"state\": \"example\",\n \"country\": \"FR\"\n },\n \"tax_codes\": [\n \"vat\"\n ],\n \"invoice_custom_section_codes\": [\n \"legal\"\n ],\n \"metadata\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"key\": \"reference\",\n \"value\": \"123\",\n \"display_on_invoice\": false\n }\n ],\n \"integration_customers\": [\n {\n \"integration_type\": \"netsuite\",\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"default\",\n \"external_customer_id\": \"customer_123\",\n \"integration_code\": \"anrok\",\n \"subsidiary_id\": \"subsidiary_123\",\n \"sync_with_provider\": false,\n \"targeted_object\": \"customer\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v2/customers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"external_id\": \"customer_123\",\n \"name\": \"example\",\n \"firstname\": \"example\",\n \"lastname\": \"example\",\n \"customer_type\": \"company\",\n \"account_type\": \"customer\",\n \"email\": \"billing@acme.example\",\n \"phone\": \"example\",\n \"url\": \"example\",\n \"logo_url\": \"example\",\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"state\": \"example\",\n \"zipcode\": \"example\",\n \"country\": \"example\",\n \"legal_name\": \"example\",\n \"legal_number\": \"example\",\n \"tax_identification_number\": \"example\",\n \"currency\": \"USD\",\n \"timezone\": \"example\",\n \"finalize_zero_amount_invoice\": \"inherit\",\n \"skip_invoice_custom_sections\": false,\n \"external_salesforce_id\": \"example\",\n \"billing_entity_code\": \"main\",\n \"invoice_grace_period\": 1,\n \"payment_provider\": \"example\",\n \"payment_provider_code\": \"example\",\n \"provider_customer_id\": \"cus_example\",\n \"provider_payment_methods\": [\n \"card\"\n ],\n \"document_locale\": \"example\",\n \"periodic_invoice_issuing_date_anchor\": \"current_period_end\",\n \"periodic_invoice_issuing_date_adjustment\": \"keep_anchor\",\n \"sync\": false,\n \"sync_with_provider\": false,\n \"shipping_address\": {\n \"address_line1\": \"example\",\n \"address_line2\": \"example\",\n \"city\": \"example\",\n \"zipcode\": \"example\",\n \"state\": \"example\",\n \"country\": \"FR\"\n },\n \"tax_codes\": [\n \"vat\"\n ],\n \"invoice_custom_section_codes\": [\n \"legal\"\n ],\n \"metadata\": [\n {\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"key\": \"reference\",\n \"value\": \"123\",\n \"display_on_invoice\": false\n }\n ],\n \"integration_customers\": [\n {\n \"integration_type\": \"netsuite\",\n \"id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\",\n \"code\": \"default\",\n \"external_customer_id\": \"customer_123\",\n \"integration_code\": \"anrok\",\n \"subsidiary_id\": \"subsidiary_123\",\n \"sync_with_provider\": false,\n \"targeted_object\": \"customer\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "main",
"external_id": "customer_123",
"account_type": "customer",
"name": "example",
"firstname": "example",
"lastname": "example",
"customer_type": "company",
"sequential_id": 100,
"slug": "example",
"country": "example",
"address_line1": "example",
"address_line2": "example",
"state": "example",
"zipcode": "example",
"email": "billing@acme.example",
"city": "example",
"url": "example",
"phone": "example",
"logo_url": "example",
"legal_name": "example",
"legal_number": "example",
"currency": "USD",
"tax_identification_number": "example",
"timezone": "example",
"applicable_timezone": "Europe/Paris",
"external_salesforce_id": "example",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"invoice_grace_period": 1,
"periodic_invoice_issuing_date_anchor": "current_period_end",
"periodic_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "example",
"payment_provider_code": "example",
"provider_customer_id": "cus_example",
"provider_payment_methods": [
"card"
],
"document_locale": "example",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z",
"deleted_at": null,
"shipping_address": {
"address_line1": "example",
"address_line2": "example",
"city": "example",
"zipcode": "example",
"state": "example",
"country": "FR"
},
"x402_agent_address": "0x0000000000000000000000000000000000000000",
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "example",
"value": "example",
"display_on_invoice": false,
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T08:59:51.123456Z"
}
],
"taxes": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "VAT",
"code": "standard_vat",
"rate": 20,
"description": "Standard VAT",
"created_at": "2022-04-29T08:59:51.123456Z",
"updated_at": "2022-04-29T09:30:00.123456Z",
"deleted_at": null
}
],
"integration_customers": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "customer_123",
"type": "netsuite",
"integration_code": "anrok",
"code": "default",
"is_default": false,
"category": "payment"
}
]
}
}{
"code": "invalid_expand",
"details": [
{
"code": "malformed",
"field": "expands",
"meta": {
"allowed_values": []
}
}
]
}{
"code": "unauthorized",
"details": []
}{
"code": "feature_unavailable",
"details": []
}{
"code": "resource_not_found",
"details": [
{
"code": "resource_not_found",
"field": "base",
"meta": {
"resource": "resource_name"
}
}
]
}{
"code": "validation_errors",
"details": [
{
"code": "value_is_mandatory",
"field": "name",
"meta": {}
}
]
}API v2 is in beta. Endpoints return the
X-Lago-Endpoint-Status: beta header.