Create or update a customer
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Talleres Ebro S.L.",
"kind": "company",
"tax_id": "B12345674",
"country": "ES",
"address": "Calle Mayor 1, 50001 Zaragoza",
"email": "facturas@talleresebro.example"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/customers"
payload = {
"name": "Talleres Ebro S.L.",
"kind": "company",
"tax_id": "B12345674",
"country": "ES",
"address": "Calle Mayor 1, 50001 Zaragoza",
"email": "facturas@talleresebro.example"
}
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({
name: 'Talleres Ebro S.L.',
kind: 'company',
tax_id: 'B12345674',
country: 'ES',
address: 'Calle Mayor 1, 50001 Zaragoza',
email: 'facturas@talleresebro.example'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"country": "<string>",
"kind": "company",
"created_at": "2023-11-07T05:31:56Z",
"tax_id": "<string>",
"address": "<string>",
"email": "<string>"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"country": "<string>",
"kind": "company",
"created_at": "2023-11-07T05:31:56Z",
"tax_id": "<string>",
"address": "<string>",
"email": "<string>"
}{
"error": "lines[0].vat_rate must be 21, 10, 4 or 0",
"code": "invalid_invoice",
"request_id": "req_01JAB3K9X2"
}{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Customers
Create or update a customer
Creates a customer, or updates the one whose id you send.
POST
/
companies
/
{company_id}
/
customers
Create or update a customer
curl --request POST \
--url https://api.melso.ai/v1/companies/{company_id}/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Talleres Ebro S.L.",
"kind": "company",
"tax_id": "B12345674",
"country": "ES",
"address": "Calle Mayor 1, 50001 Zaragoza",
"email": "facturas@talleresebro.example"
}
'import requests
url = "https://api.melso.ai/v1/companies/{company_id}/customers"
payload = {
"name": "Talleres Ebro S.L.",
"kind": "company",
"tax_id": "B12345674",
"country": "ES",
"address": "Calle Mayor 1, 50001 Zaragoza",
"email": "facturas@talleresebro.example"
}
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({
name: 'Talleres Ebro S.L.',
kind: 'company',
tax_id: 'B12345674',
country: 'ES',
address: 'Calle Mayor 1, 50001 Zaragoza',
email: 'facturas@talleresebro.example'
})
};
fetch('https://api.melso.ai/v1/companies/{company_id}/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"country": "<string>",
"kind": "company",
"created_at": "2023-11-07T05:31:56Z",
"tax_id": "<string>",
"address": "<string>",
"email": "<string>"
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"country": "<string>",
"kind": "company",
"created_at": "2023-11-07T05:31:56Z",
"tax_id": "<string>",
"address": "<string>",
"email": "<string>"
}{
"error": "lines[0].vat_rate must be 21, 10, 4 or 0",
"code": "invalid_invoice",
"request_id": "req_01JAB3K9X2"
}{
"error": "invalid token",
"code": "unauthorized",
"request_id": "req_01JAB3K9X2"
}{
"error": "invoice not found",
"code": "not_found",
"request_id": "req_01JAB3K9X2"
}{
"error": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Live capability. Melso runs this in production today. Partner keys reach it once your partner account is enabled. See Availability.
Authorizations
Your partner secret key, mk_live_… for real companies or mk_test_…
for test companies. Keep it on your servers. See
Authentication.
Headers
A unique key, such as a UUID, that makes a retried create safe. Reusing a key with a different body is refused.
Maximum string length:
255Path Parameters
The company's ID. Every company-scoped call works in exactly this company.
Body
application/json
Required string length:
1 - 300company for a business, professional for an autónomo, individual for a consumer.
Available options:
company, professional, individual Send it to update that customer instead of creating one.
NIF or CIF. Required unless kind is individual. One customer per tax ID and country.
ISO 3166-1 alpha-2. Melso invoices customers in Spain (ES) today.
Where the issued invoice is emailed.
Response
The updated customer.