Skip to content

Seed / raise many tuples at once (all-or-nothing)

PUT
/v1/tenants/{tenantId}/sequences/batch
curl --request PUT \
--url https://api.emite.cr/v1/tenants/example/sequences/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "entries": [ { "branchId": "example", "terminalId": "example", "docType": "01", "nextConsecutive": 1 } ] }'

Applies every entry in a single transaction; any decrease (or any other error of the single-tuple operation) rolls back the whole batch. Returns the counter cells after the change, in the order of entries.

tenantId
required
string
Media typeapplication/json
object
entries
required

Tuples to seed (all-or-nothing).

Array<object>
object
branchId
required

Branch UUID.

string
terminalId
required

Terminal UUID (must belong to the branch).

string
docType
required

Hacienda document type (01..10).

string
Allowed values: 01 02 03 04 05 06 07 08 09 10
nextConsecutive
required

Number the NEXT emitted document will carry. Can only be raised, never lowered (the server rejects a value at or below the current floor with SEQUENCE_CANNOT_DECREASE).

number
>= 1 <= 9999999999
Media typeapplication/json
Array<object>
object
branchId
required

Branch UUID.

string format: uuid
branchCode
required

3-digit branch code (001).

string
branchName
required

Branch display name.

string
terminalId
required

Terminal UUID.

string format: uuid
terminalCode
required

5-digit terminal code (00001).

string
terminalName
required

Terminal display name.

string
docType
required

Hacienda document type (01..10).

string
Allowed values: 01 02 03 04 05 06 07 08 09 10
docTypeName
required

Hacienda document type name (always Spanish, never translated).

string
lastConsecutive
required

Last number treated as used (0 if never emitted for this tuple).

number
nextConsecutive
required

Number the next document will carry (= lastConsecutive + 1).

number
hasEmitted
required

True when this tuple already has a counter row with last_consecutive > 0. Advisory only (raising the counter is always allowed); the UI shows a "affects future docs only" hint.

boolean
Example
[
{
"branchCode": "001",
"terminalCode": "00001",
"docType": "01"
}
]

Missing or invalid JWT / API key

Tenant boundary violation or insufficient scope.

At least one entry is at or below its current floor.