StarSling
API

Errors

The error body shape, what each status code means, and how the CLI maps them to exit codes

View Markdown

Every failure returns a JSON body with the same shape, so a client can branch on one field rather than parsing prose.

Error body

{
  "code": "INSUFFICIENT_SCOPE",
  "message": "This credential is missing the bill:read scope."
}
FieldTypeNotes
codestringA stable machine-readable identifier. Branch on this, never on message.
messagestringHuman-readable explanation. Wording may change at any time.
detailsarrayPresent on validation failures only. Each entry is { "path": …, "error": … }, naming the offending parameter.

code is drawn from a closed set:

codeMeaning
VALIDATIONA parameter was present but unacceptable — an unknown enum value, an out-of-range limit, two mutually exclusive window parameters.
MALFORMED_REQUESTThe request could not be parsed — bad JSON in a POST body, or a query string the server cannot read.
UNAUTHENTICATEDNo credential, or one that is expired or invalid.
INSUFFICIENT_SCOPEThe credential is valid but lacks a required scope.
NOT_FOUNDNo such resource within the orgs you can reach.

Status codes

StatusTypical codeWhat to do
400MALFORMED_REQUESTFix the request itself. Retrying unchanged will not help.
401UNAUTHENTICATEDSupply a credential, or refresh an expired session. See Authentication.
403INSUFFICIENT_SCOPEReissue the credential with the scope the endpoint names.
404NOT_FOUNDCheck the id — but note it may exist in an org you cannot reach.
422VALIDATIONRead details for the offending parameter and correct it.
500A control-plane fault. Safe to retry with backoff; every endpoint in this reference is read-only.

A 404 is deliberately indistinguishable from "exists, but not yours". The API will not confirm that an id exists in an org you cannot see, so treat 404 as "not visible to this credential" rather than "does not exist".

Retrying

Every endpoint documented here is a read, so retries are safe and cannot double-charge or mutate state. Retry 500 and 429 with exponential backoff; do not retry 400, 401, 403, 404, or 422 without changing the request, since the outcome is deterministic.

If you are rate limited the control plane returns 429. Back off before retrying.

Exit codes in the CLI

The sling CLI maps these responses onto a fixed exit-code table, so a script or agent can branch on $? without parsing output:

ExitMeaningFrom
0Success2xx
1Unexpected CLI crashnever an API outcome
2Usage error — bad flags, conflicting parametersclient-side, or 422
3Not found404
4Auth — missing, expired, or under-scoped credential401, 403
5Control-plane or transport failure5xx
6Partial — telemetry incomplete, result still returned200 with gaps
7Rate limited429
10Remote outcome failed — e.g. a run concluded unsuccessfully200

Note that 10 is not an error: the request succeeded and the result was a failure. It is what lets sling runs show <id> --wait gate a pipeline on a run's conclusion.

On this page