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",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"province": "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",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"province": "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',
address: 'Calle Mayor 1',
postal_code: '50001',
city: 'Zaragoza',
province: '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>",
"kind": "company",
"is_customer": true,
"is_supplier": true,
"tax_id": "<string>",
"country": "<string>",
"address": "<string>",
"postal_code": "<string>",
"city": "<string>",
"province": "<string>",
"email": "<string>",
"phone": "<string>",
"iban": "<string>",
"notes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Create or update a customer
Creates or updates 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",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"province": "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",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"province": "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',
address: 'Calle Mayor 1',
postal_code: '50001',
city: 'Zaragoza',
province: '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>",
"kind": "company",
"is_customer": true,
"is_supplier": true,
"tax_id": "<string>",
"country": "<string>",
"address": "<string>",
"postal_code": "<string>",
"city": "<string>",
"province": "<string>",
"email": "<string>",
"phone": "<string>",
"iban": "<string>",
"notes": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}id it creates one (201), or completes the contact with the same tax ID (200). With id, only the fields you send change. Send an Idempotency-Key to retry safely.Authorizations
A company API key, mk_live_…, that the company's owner creates in the
Melso app under Settings, Connect your AI, API keys. It works in that
one company with the owner's authority. Test keys (mk_test_…) are not
issued. Keep the key on your servers. See
Authentication.
Headers
A unique key of yours, such as a UUID, that makes a retried create
safe. For 24 hours a retry with the same key and body gets the first
answer again, with Idempotent-Replayed: true. The same key with
another body answers 422 idempotency_key_reused; while the first
request runs, 409 idempotency_key_in_use. A 5xx answer is not
kept, so its retry runs again. See Conventions.
255Path Parameters
Body
A customer's details. Adding one needs name. Any other field, such as
iban or is_supplier, answers 400 with field naming it.
Response
The customer you changed, or the existing one with that tax ID, completed.