CropPath for developers

All guides

Errors

Available

The shape of every error answer, the codes to handle and when to retry.

Every error answer is a JSON Error with two fields: error, a message in English for people, and code, the stable part for your code to match. code is the start of error (before the first colon) in lower-case snake case, for example {"error": "no such route", "code": "no_such_route"}. The text after the colon may change; never parse it. Two exceptions. POST /v1/oauth/token and POST /v1/oauth/revoke answer 400, 401 and 429 with OAuthError: error is the OAuth2 error code, the same as code, and the body may add error_description, the text. POST /v1/ingest/{route}, where devices send signed data, answers with IngestResult (status, id, reasons) for every outcome of the ingest service, rejections included.

Every answer carries X-Request-Id. You may send your own (1 to 64 ASCII letters, digits, ., _ or -; anything else is refused with 400 bad_request_id). Quote it when you ask CropPath support about a request.

Batch and OAuth2 errors

A batch request adds items, a list of BatchItemError (index, status, error, code): every invalid item on 400 invalid_batch, or the one item the stored records refused on batch_rejected, which answers the status the single-item route gives that item. In both cases nothing of the batch is stored.

The OAuth2 endpoints answer OAuthError (RFC 6749 §5.2): error is the RFC code (invalid_request, invalid_client, invalid_scope, unsupported_grant_type), equal to code, and error_description the text. A request refused before the endpoint runs (the rate limit, a bad X-Request-Id, an Idempotency-Key header) gets the usual body.

Common codes

Handle any other code by its HTTP status. The API reference lists the answers of each route.

In the API reference