AccountCompanies
Create a company
Creates a company under the account the request resolves to. The NIF is registered in the name of that account's holder, never in the name of the caller.
- activate: unless it is false, the company is switched on in aeat_environment and its three default invoice series (ordinary, simplified, corrective) are seeded there. This endpoint never switches an existing company on: that is POST /v1/companies/{company_id}/activations.
- numbering: decides the code, format, counter reset and starting number those series are born with. Only accepted when the request activates the company.
- Billing: no charge is ever started here. Creating a production NIF requires being the billing subject of the account (403 otherwise), and an account without billing is rejected with 402; no checkout is opened in either case.
- Duplicates: a NIF that already exists in the account is rejected with 409, and the response carries the existing error.details.company_id.
- Addresses: a Spanish postal code (country_code omitted or ES) must have 5 digits, in address and in legal_representative.address; otherwise 422 POSTAL_CODE_INVALID_ES and nothing is created. Other countries' postal codes are free-form.
post/v1/accounts/{account_id}/companies
Request
- Base URL: https://app.beel.es/api
- URL: https://app.beel.es/api/v1/accounts/{account_id}/companies
- Auth: HTTP bearer
Headers
Idempotency-Keystring
Idempotency key to prevent duplicates in sensitive operations.
- Any unique client-generated string (e.g. an order id). A UUID also works but is not required
- Allowed characters: letters, digits, _ and - (max 255 chars)
- Retrying with the same key replays the first response when it was a success (2xx) or a server error (5xx): same status and body, plus the header Idempotency-Replay: true. After a 5xx, check whether the operation took effect before retrying with a new key
- A 4xx is not stored: the key is released, so the corrected request can reuse it
- Stored responses expire 24 hours after processing
The key is scoped per user and environment, and bound to the request body, so retrying after a network timeout replays the stored response instead of repeating the operation.
| Status | Code | When |
|---|---|---|
| 400 | INVALID_IDEMPOTENCY_KEY | The key breaks the format rules above. |
| 409 | IDEMPOTENCY_KEY_PROCESSING | The first request is still in flight. Wait for the Retry-After seconds (2) and retry with the same key. |
| 409 | IDEMPOTENCY_KEY_MISMATCH | The key was already used with a different body. Use a new key. |
Request body
Example request
{
"nif": "B12345674",
"legal_name": "Mi Empresa SL",
"entity_type": "INDIVIDUAL",
"address": {
"street": "Calle Mayor, 123",
"number": "123",
"floor": "2º A",
"door": "A",
"postal_code": "28001",
"city": "Madrid",
"province": "Madrid",
"country": "España",
"country_code": "ES"
},
"legal_form": "SL",
"legal_representative": {
"full_name": "María García López",
"nif": "12345678A",
"address": {
"street": "Calle Mayor, 123",
"number": "123",
"floor": "2º A",
"door": "A",
"postal_code": "28001",
"city": "Madrid",
"province": "Madrid",
"country": "España",
"country_code": "ES"
}
},
"trade_name": "Mi Empresa",
"default_main_tax": {
"type": "IVA",
"percentage": 21,
"regime_key": "01"
},
"default_irpf_rate": 15,
"numbering": {
"code": "FAC",
"initial_number": 151,
"format": "{CODIGO}-{YYYY}-{NUM:4}",
"simplified": {
"code": "FAC",
"initial_number": 40,
"format": "{CODIGO}-{YYYY}-{NUM:4}"
},
"corrective": {
"code": "FAC",
"initial_number": 40,
"format": "{CODIGO}-{YYYY}-{NUM:4}"
}
},
"aeat_environment": "PROD"
}Response
Company created
Example response
{
"data": {
"entity_type": "INDIVIDUAL",
"environment": "PROD",
"aeat_environment": "PROD",
"account_state": "TEST_ONLY",
"legal_representative": {
"full_name": "María García López",
"nif": "12345678A",
"address": {
"street": "Calle Mayor, 123",
"number": "123",
"floor": "2º A",
"door": "A",
"postal_code": "28001",
"city": "Madrid",
"province": "Madrid",
"country": "España",
"country_code": "ES"
}
},
"phone": "+34 612 345 678",
"email": "user@example.com",
"default_iban": "ES1234567890123456789012",
"default_swift": "ABCDESMMXXX",
"invoice_template_type": "MODERN_TABLE",
"invoice_accent_color": "#fc481d",
"invoice_language": "es",
"email_language": "es",
"series": [
{
"name": "Main Series",
"code": "FAC",
"description": "Series for standard invoices",
"format": "{CODIGO}-{YYYY}-{NUM:4}",
"initial_number": 1
}
]
},
"meta": {
"timestamp": "2025-01-15T10:30:00Z",
"request_id": "4bf92f3577b34da6a3ce929d0e0e4736"
}
}Changes
No recorded changes to this operation across all 1 revision of this API.