Error Handling

Understand the error model used across all DealSurface API endpoints.

Error response format

Error responses are JSON objects with an error field describing the issue. Some errors include additional fields for context.

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

Status codes

CodeMeaningCommon causes
200OKRequest succeeded.
400Bad RequestInvalid parameters (e.g. non-integer product_id, missing required field, invalid enum value).
401UnauthorizedMissing, invalid, or expired API key.
402Payment RequiredInsufficient credits for a billable operation.
403ForbiddenKey lacks required scope, or API access is disabled for your team.
404Not FoundResource not found: product doesn't exist, prospect has no cached data, or company metadata not ready.
409ConflictLead generation already in progress for this prospect. Wait and retry.
429Too Many RequestsRate limit exceeded. Check X-RateLimit-Reset header.
500Internal Server ErrorAn unexpected error occurred. Details are not exposed to clients for security.
502Bad GatewayThe backend service returned a malformed or unexpected response.
503Service UnavailableA downstream service is temporarily unavailable.
504Gateway TimeoutThe backend did not respond within the timeout (60 seconds for lead/outreach generation).

Error examples

400 Bad Request

{
  "error": "product_id is required and must be a positive integer"
}

402 Payment Required

{
  "error": "Insufficient credits",
  "credits_remaining": 0,
  "credits_required": 10,
  "period_ends_at": "2026-04-01T00:00:00Z"
}

409 Conflict

{
  "error": "Lead generation already in progress for this prospect"
}

429 Too Many Requests

{
  "error": "Rate limit exceeded. Try again in 42 seconds."
}
Error Handling | DealSurface Docs