Skip to content

Create a branch

POST
/v1/tenants/{tenantId}/branches
curl --request POST \
--url https://api.emite.cr/v1/tenants/example/branches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "code": "001", "name": "Sucursal Central", "isDefault": true }'

Branch code must be 1-3 digits (zero-padded to 3) and unique within the tenant. With isDefault: true the new branch becomes the one a document uses when it names no branchCode, and the previous default loses the flag. A new branch has no terminal: create one under it (POST …/branches/{branchId}/terminals) before issuing from it.

tenantId
required
string

Tenant UUID.

Media typeapplication/json
object
code
required

Branch (sucursal) number, 1–3 digits, zero-padded to 3 (1 → 001): the first three digits of every consecutivo issued from it. Unique in the company, and immutable once created.

string
Example
001
name
required

Name to recognize the branch by in the app and the API; documents do not show it.

string
Example
Sucursal Central
isDefault

Make it the company's default branch — the one a document uses when it names no branchCode — taking the flag from the previous one. Defaults to false.

boolean
Example
true
Media typeapplication/json
object
id
required

Id of the branch — the {branchId} of the branch and terminal routes.

string format: uuid
code
required

Branch number, 3 digits: the first three digits of every consecutivo issued from it, and the branchCode a document names to be issued from it. Fixed once created.

string
name
required

Name of the branch, for the app and the API; documents do not show it.

string
isDefault
required

Whether it is the company's default branch — the one a document uses when it names no branchCode. At most one branch is the default; with none, creating a document that names no branch answers 412 TENANT_NOT_CONFIGURED.

boolean
Example
{
"code": "001",
"name": "Casa Matriz"
}

Missing or invalid JWT / API key

Tenant boundary violation or insufficient scope.

Duplicate branch code in this tenant.