curl --request POST \
--url https://api.melso.ai/v1/companies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"kind": "company",
"name": "Talleres Ebro",
"external_id": "cus_48213",
"owner": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"locale": "es"
},
"fiscal_profile": {
"tax_id": "B12345674",
"legal_name": "Talleres Ebro S.L.",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"activity_description": "Reparación de vehículos",
"vat_regime": "general"
},
"services": [
"invoicing",
"tax_returns",
"payroll"
]
}
'import requests
url = "https://api.melso.ai/v1/companies"
payload = {
"kind": "company",
"name": "Talleres Ebro",
"external_id": "cus_48213",
"owner": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"locale": "es"
},
"fiscal_profile": {
"tax_id": "B12345674",
"legal_name": "Talleres Ebro S.L.",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"activity_description": "Reparación de vehículos",
"vat_regime": "general"
},
"services": ["invoicing", "tax_returns", "payroll"]
}
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({
kind: 'company',
name: 'Talleres Ebro',
external_id: 'cus_48213',
owner: {name: 'Lucía Martín Pérez', email: 'lucia@example.com', locale: 'es'},
fiscal_profile: {
tax_id: 'B12345674',
legal_name: 'Talleres Ebro S.L.',
address: 'Calle Mayor 1',
postal_code: '50001',
city: 'Zaragoza',
activity_description: 'Reparación de vehículos',
vat_regime: 'general'
},
services: ['invoicing', 'tax_returns', 'payroll']
})
};
fetch('https://api.melso.ai/v1/companies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"kind": "freelancer",
"onboarded": true,
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"missing": [
"<string>"
],
"updated_at": "2023-11-07T05:31:56Z"
}{
"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": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}Create a company
Adds an autónomo (freelancer) or an empresa (company) to your partner account, with its owner and as much of its fiscal profile as you know.
curl --request POST \
--url https://api.melso.ai/v1/companies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"kind": "company",
"name": "Talleres Ebro",
"external_id": "cus_48213",
"owner": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"locale": "es"
},
"fiscal_profile": {
"tax_id": "B12345674",
"legal_name": "Talleres Ebro S.L.",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"activity_description": "Reparación de vehículos",
"vat_regime": "general"
},
"services": [
"invoicing",
"tax_returns",
"payroll"
]
}
'import requests
url = "https://api.melso.ai/v1/companies"
payload = {
"kind": "company",
"name": "Talleres Ebro",
"external_id": "cus_48213",
"owner": {
"name": "Lucía Martín Pérez",
"email": "lucia@example.com",
"locale": "es"
},
"fiscal_profile": {
"tax_id": "B12345674",
"legal_name": "Talleres Ebro S.L.",
"address": "Calle Mayor 1",
"postal_code": "50001",
"city": "Zaragoza",
"activity_description": "Reparación de vehículos",
"vat_regime": "general"
},
"services": ["invoicing", "tax_returns", "payroll"]
}
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({
kind: 'company',
name: 'Talleres Ebro',
external_id: 'cus_48213',
owner: {name: 'Lucía Martín Pérez', email: 'lucia@example.com', locale: 'es'},
fiscal_profile: {
tax_id: 'B12345674',
legal_name: 'Talleres Ebro S.L.',
address: 'Calle Mayor 1',
postal_code: '50001',
city: 'Zaragoza',
activity_description: 'Reparación de vehículos',
vat_regime: 'general'
},
services: ['invoicing', 'tax_returns', 'payroll']
})
};
fetch('https://api.melso.ai/v1/companies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"kind": "freelancer",
"onboarded": true,
"created_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"missing": [
"<string>"
],
"updated_at": "2023-11-07T05:31:56Z"
}{
"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": "The tax return changed or is not ready for approval",
"code": "version_conflict",
"request_id": "req_01JAB3K9X2"
}setup_request when the company is not registered yet: Melso’s
professionals register the autónomo (036 or 037 and RETA) or incorporate
the company as a case.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.
255Body
freelancer for an autónomo, company for an empresa.
freelancer, company The person who approves the company's invoices and returns.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Ask Melso's professionals to register the autónomo or incorporate the company.
none, register_autonomo, incorporate_sl invoicing, bookkeeping, tax_returns, payroll Response
The company. missing lists what its fiscal profile still needs.
freelancer for an autónomo, company for an empresa.
freelancer, company Whether the company's setup is finished.
Preview. Your ID for the company.
Preview. What the fiscal profile still needs, as in tax_missing.