Skip to main content
POST
Create or update a customer
Without 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

Authorization
string
header
required

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

Idempotency-Key
string

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.

Maximum string length: 255

Path Parameters

company_id
string<uuid>
required

The company's ID. Every company-scoped call works in exactly this company.

Body

application/json

A customer's details. Adding one needs name. Any other field, such as iban or is_supplier, answers 400 with field naming it.

id
string<uuid>

Send it to change that customer instead of adding one.

name
string

Legal name, or the person's full name. Required to add a customer.

Required string length: 1 - 300
kind
enum<string>

Omit it and Melso tells it from the tax ID: a business's tax ID makes a company; a Spanish person's DNI or NIE, or no tax ID, an individual. Send professional for a self-employed professional you invoice with IRPF withheld.

Available options:
company,
professional,
individual
tax_id
string

NIF, CIF, NIE, EU VAT number or a foreign tax ID, as written. Melso stores it uppercase without spaces, dots or dashes: up to 32 letters and digits. A company has one contact per tax ID. An invoice to a company or professional customer needs it.

country
string
default:ES

The two-letter country of the tax ID and the address. Melso invoices customers in Spain (ES) only.

address
string

Street, number, floor and door. An invoice to a customer with a tax ID is issued only once the customer has an address.

Maximum string length: 300
postal_code
string
Maximum string length: 20
city
string
Maximum string length: 120
province
string
Maximum string length: 120
email
string<email>

Where Melso emails the issued invoice.

phone
string
Maximum string length: 40
notes
string
Maximum string length: 4000

Response

The customer you changed, or the existing one with that tax ID, completed.

id
string<uuid>
required
name
string
required
kind
enum<string>
required

company for a business, professional for a self-employed professional, individual for a consumer.

Available options:
company,
professional,
individual
is_customer
boolean
required

The company invoices it. Always true once this API saved it.

is_supplier
boolean
required

It also invoices the company.

tax_id
string
required

As Melso stores it. Empty when it has none.

country
string
required
address
string
required
postal_code
string
required
city
string
required
province
string
required
email
string
required
phone
string
required
iban
string
required

A supplier's IBAN, saved in the app. This API never sets it.

notes
string
required
created_at
string<date-time>
required
updated_at
string<date-time>
required