Authorise a run before writing anything
const url = 'https://api.sloose.com/entitlements/runs/authorise';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"declaredRows":1,"projectId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/entitlements/runs/authorise \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "declaredRows": 1, "projectId": "example" }'Checks the run against the plan and returns a run id to report progress against.
An authorised run always completes. Everything is checked here, once, rather than part-way through an import that has already written half its rows. A set bigger than the plan allows in one run is refused with LIMIT_ROWS_PER_RUN; an org that has used its import runs for the period is refused with LIMIT_RUNS. A run counts against the period at its first written row, so a dry run, a cancelled run or one that writes nothing costs nothing. Rows per month are bookkeeping for browser runs, never a refusal.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
How many rows the run intends to write. Must be a non-negative number.
The project this run came from, when it came from a saved one. Ignored unless it names a project in this org.
Examplegenerated
{ "declaredRows": 1, "projectId": "example"}Responses
Section titled “Responses”Authorised. Allowance is reserved.
object
Report progress against this id.
Example
{ "ok": true}declaredRows is missing, negative or not a number.
object
Examplegenerated
{ "error": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}Refused. code says why — the set is too big for one run, the period’s runs are used, or the org is suspended.
object
Why an action was refused. A closed set: the widget switches on it.
With LIMIT_ROWS_PER_RUN: the most rows one run may declare.
Example
{ "ok": false, "code": "LIMIT_ROWS"}