Skip to main content
The Max AI API uses standard HTTP status codes and returns structured JSON error responses. Every error includes a machine-readable code, a human-readable message, and a trace_id for debugging.

Error Response Format

HTTP Status Codes

Success

Client Errors

Server Errors

Error Examples

400 — Validation Errors

The API returns 400 Bad Request when a required parameter is missing or has an invalid format. The message field tells you exactly which parameter is wrong: Missing required parameter:
Invalid ID format:
In v3, resource IDs use a readable prefixed format (e.g., pat_c56103bcd39c46d39f3138dd2b5e05f6). The API accepts both prefixed IDs and raw UUIDs as path parameters. On every version, the X-Organization-Id header accepts org_… or a raw UUID.
Invalid header value:
Common causes:
  • A required path or query parameter is missing from the request
  • An ID parameter contains an invalid value (e.g., not-a-uuid instead of a prefixed ID like pat_c56103bcd39c46d39f3138dd2b5e05f6 or a raw UUID like 550e8400-e29b-41d4-a716-446655440000)
  • The X-Organization-Id header is neither a raw UUID nor an org_… id
  • A comma-separated filter was supplied with no values — ?code= or ?code=, on /bills and /era-service-lines, ?status= on /bills and /claims. This is rejected rather than ignored, because dropping the filter would widen the response to every record in the organization instead of narrowing it. If your cohort is empty, omit the parameter (or skip the request entirely) rather than sending it blank:

401 — Invalid API Key

The message field varies depending on the specific authentication failure (invalid key, revoked key, missing header, etc.).

403 — Insufficient Scope

Returned when your API key is valid but lacks the required scope for the endpoint. The message tells you whether the key itself is missing the scope, or whether the scope is on the key but not granted by the organization’s installation.

404 — Resource Not Found

429 — Rate Limit Exceeded

The response includes headers to help you retry at the right time: See Rate Limits for retry strategies and best practices.

Insurance and payer error codes

Returned by POST /v4/patients/{id}/insurance:exact and POST /v4/payers. None of them wrote anything to the EHR. PATCH /v4/patients/{patientId}/insurance-policies/{policyId} answers 409 policy_update_refused when the EHR did not take the type change: it refused the save (for example, ModMed locks a policy that has claims) or still shows the previous type after it. Retrying will not help; check the policy in the EHR. GET /v4/payers?patientId= answers 404 patient_not_found when the patient is not in your organization. GET /v4/payers?newChart=true answers 400 for a primaryFacilityId outside your organization and 503 no_booking_identity when no live system connector can create the chart. An unknown instanceId is not an error: it returns an empty list.

Referring provider error codes

Returned by PUT /v4/patients/{id}/referring-provider. None of them wrote anything to the EHR.

Prescription error codes

The prescription and pharmacy endpoints (v4, ModMed) return named codes so an app can branch without parsing prose. Codes marked (draft) or (send) come from POST /v4/prescriptions, /void and /send; see E-Prescribing.

Handling Errors in Code

Debugging

If you encounter an unexpected error:
  1. Check the trace_id in the error response
  2. Verify your API key and Organization ID are correct
  3. Confirm your app has the required scopes for the endpoint
  4. Contact the Max AI team with the trace_id for further investigation