Docs Guides Error Handling

Error Handling

Standard HTTP status codes and JSON error bodies with machine-readable codes.

Error response format

{
  "detail": "Human-readable error message"
}

For server errors (500), the response includes additional fields:

{
  "error": "internal_server_error",
  "detail": "An unexpected error occurred",
  "status_code": 500,
  "request_id": "abc123-def456-..."
}

The request_id can be provided to support for troubleshooting.

HTTP status codes

StatusMeaningWhen it occurs
200SuccessRequest processed successfully
400Bad RequestInvalid request body, missing required fields, invalid values
401UnauthorizedMissing, invalid, or expired API credentials
403ForbiddenValid credentials but access denied (e.g. suspended organisation)
404Not FoundAward code not found, batch not found, or endpoint does not exist
429Too Many RequestsRate limit exceeded — see Rate Limiting
500Internal Server ErrorUnexpected server error

Common 400 errors

Missing required field

{
  "detail": [
    {
      "type": "missing",
      "loc": ["body", "award_code"],
      "msg": "Field required"
    }
  ]
}

Invalid award code

{
  "detail": "Award MA000999 is not available for deterministic calculations"
}

Invalid classification

{
  "detail": "Classification INVALID not found for award MA000009"
}

Invalid employment type

{
  "detail": "Invalid employment_type. Must be one of: full_time, part_time, casual"
}

Handling errors in code

response = requests.post(url, headers=headers, json=payload)

if response.status_code == 200:
    result = response.json()
elif response.status_code == 400:
    error = response.json()
    print(f"Bad request: {error['detail']}")
elif response.status_code == 401:
    print("Check your API credentials")
elif response.status_code == 404:
    print("Award or resource not found")
elif response.status_code == 429:
    retry_after = int(response.headers.get("Retry-After", 5))
    time.sleep(retry_after)
else:
    print(f"Unexpected error {response.status_code}: {response.text}")

Request tracing

All responses include an X-Request-ID header. Include this ID when contacting support about a specific request:

X-Request-ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890