Skip to main content

Error Handling

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

HTTP Status Codes

Error Response Formats

Validation Errors (422)

Returned when field-level validation fails. The errors object maps field names to arrays of error messages:

Business Rule Errors (400 / 404)

Returned when a request is structurally valid but violates a business rule:

Authentication Errors (400 / 401)

Returned when credentials are invalid or a token has expired:

Common Issues and Solutions

”Incorrect username or password”

Cause: Invalid credentials or account not yet provisioned. Fix: Verify your username (email) and password. If you haven’t received credentials, contact api-support@coverwhale.com.

Token expired (401 on API calls)

Cause: The AccessToken expires after 3600 seconds (1 hour). Fix: Use the refresh token to obtain a new access token:

“The given data was invalid” (422)

Cause: One or more fields failed validation. Fix: Check the errors object in the response. Each key is the field path (e.g., insuredInformation.legalName) and the values describe what’s wrong.

Submission not found (404)

Cause: The displayId doesn’t exist, or you don’t have access to this submission. Fix: Verify the display ID. Submissions are scoped to your agency — you can only access submissions created by your account.

Submission not in required status (404)

Cause: You’re trying to perform an operation that requires a specific status. For example, binding requires Quoted status. Fix: Check the current submission status with GET /submission/{displayId} and ensure it matches the required status for your operation. See the submission lifecycle for status flow.

Best Practices

  • Always check the status code first — branch your error handling on the HTTP status before parsing the body
  • Log the full response — include headers and body for debugging
  • Handle 401 proactively — refresh your token before it expires rather than waiting for a failure
  • Implement retry with backoff for 429 responses — start with 1 second and double on each retry
  • Validate locally first — check required fields before sending requests to reduce round trips