This API is in beta. Endpoints and response shapes may change before stable release.

Error responses

All error responses are JSON with a consistent shape. Most errors include an error key with a machine-readable code. Validation failures (422) include an errors key with a map of field-level messages.

Error response shape
Field Type Mutability Notes
error string optional Machine-readable error code. Present on all non-422 errors.
errors object optional Field-level validation errors. Present on 422 responses only.

Status codes

Status Code Meaning
400 unsupported_version The X-FarmReady-Api-Version header contains an unknown version.
401 unauthorized Missing or invalid Bearer token.
403 forbidden Token lacks permission for this action or organisation. Also returned when the organisation does not have a Shed subscription.
404 not_found The requested resource does not exist or is not visible to the authenticated token.
422 Validation failed. The errors key contains field-level details.
429 rate_limited Rate limit exceeded. See Rate Limiting for details.

Validation errors (422)

Validation error bodies contain an errors object where each key is a field name and the value is a list of error strings.

422 Validation failure
{
  "errors": {
    "supplier": ["can't be blank"],
    "received_at": ["is invalid"]
  }
}