Skip to content

Report progress on an authorised run

POST
/entitlements/runs/{runId}/progress
curl --request POST \
--url https://api.sloose.com/entitlements/runs/run_7c2e/progress \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "rowsWritten": 1, "rowsCreated": 1, "rowsUpdated": 1, "rowsFailed": 1, "done": true, "outcome": "complete", "modules": [ "example" ], "error": "example" }'

Call this in batches as the import writes, and once more with done: true when it finishes. The ledger row is the meter; the D1 run row written alongside is the history.

runId
required

The run id from POST /entitlements/runs/authorise.

string
Example
run_7c2e

The run id from POST /entitlements/runs/authorise.

Media typeapplication/json
object
rowsWritten

Rows written since the last report. Non-negative.

number | null
rowsCreated
number | null
rowsUpdated
number | null
rowsFailed
number | null
done

True on the final report. Closes the run and settles the meter.

boolean | null
outcome

How the run ended. Only meaningful with done: true.

string | null
Allowed values: complete cancelled error
modules

Modules the run touched. At most 50 are kept.

Array<string> | null
error

Failure message, truncated to 2,000 characters.

string | null
key
additional properties

The period usage after this report.

Media typeapplication/json
object
periodStart
required
string
periodEnd
required
string
rowsWritten
required
number
rowsOverage
required
number
creditsUsed
required
number
runs
required
number
Examplegenerated
{
"periodStart": "example",
"periodEnd": "example",
"rowsWritten": 1,
"rowsOverage": 1,
"creditsUsed": 1,
"runs": 1
}

rowsWritten is negative or not a number.

Media typeapplication/json
object
error
required
string
key
additional properties
Examplegenerated
{
"error": "example"
}

No bearer, or one that is expired, revoked or no longer resolves to a member.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

No such run, or it has already been settled.

Media typeapplication/json
object
error
required
string
key
additional properties
Examplegenerated
{
"error": "example"
}