Error Handling

The SDX API uses standard HTTP status codes and returns structured error responses to help you diagnose and resolve issues quickly.

Error response format

All errors follow a consistent JSON structure:

{
  "error": {
    "code": "validation_error",
    "message": "The 'start_date' field must be a valid ISO 8601 date.",
    "details": [
      {
        "field": "start_date",
        "issue": "Invalid date format: '2026/01/15'. Expected 'YYYY-MM-DD'."
      }
    ],
    "request_id": "req_abc123def456"
  }
}
FieldDescription
codeMachine-readable error code (see table below)
messageHuman-readable description of the error
detailsOptional array of field-level errors (for validation failures)
request_idUnique identifier for the request — include this in support tickets

HTTP status codes

StatusMeaning
200Success
201Resource created
204Success with no body (e.g. DELETE)
304Not modified (ETag match)
400Bad request — invalid syntax or parameters
401Unauthorized — missing or invalid authentication
403Forbidden — valid credentials but insufficient permissions
404Not found — resource does not exist
409Conflict — resource already exists or state conflict
422Unprocessable entity — validation failed
429Too many requests — rate limit exceeded
500Internal server error
502Bad gateway
503Service unavailable — maintenance or temporary outage

Error codes

CodeHTTP StatusDescription
authentication_required401No Authorization header provided
invalid_token401API key or OAuth token is invalid or expired
insufficient_scope403Token does not have the required scope
resource_not_found404The requested resource does not exist
validation_error422One or more fields failed validation
duplicate_resource409A resource with the same unique key already exists
rate_limit_exceeded429Request rate limit exceeded
meter_overlap422Meter reading date range overlaps an existing reading
building_locked403Building is locked for editing (e.g. during an audit)
report_not_ready422Insufficient data to generate the requested report
file_too_large400Uploaded file exceeds the 50 MB limit
unsupported_format400File format is not supported
internal_error500Unexpected server error
service_unavailable503Planned maintenance or temporary outage

Validation errors

For 422 responses, the details array lists every field that failed validation:

{
  "error": {
    "code": "validation_error",
    "message": "Request body contains 2 validation errors.",
    "details": [
      {
        "field": "consumption",
        "issue": "Must be a positive number."
      },
      {
        "field": "unit",
        "issue": "Must be one of: kWh, MJ, therms, GJ, kBtu."
      }
    ],
    "request_id": "req_xyz789"
  }
}

Troubleshooting common errors

401 — Authentication required

  • Verify the Authorization header is present and formatted as Bearer YOUR_TOKEN.
  • Confirm the API key or OAuth token has not been revoked.
  • Check that you are using a production key for api.sdx.dev and a sandbox key for sandbox.api.sdx.dev.

403 — Insufficient scope

  • The API key or OAuth token does not include the required scope. Check the Authentication page for the scope needed by each endpoint.

422 — Meter overlap

  • A reading already exists for the same meter and overlapping date range. Either adjust the dates or delete the existing reading first.

429 — Rate limit exceeded

  • Wait for the duration specified in the Retry-After header. See Rate Limits for retry strategies.

500 — Internal error

  • This is a server-side issue. Retry the request after a short delay. If the error persists, contact api-support@sdx.dev with the request_id.

Next steps