Wahlu API

Errors

Understand the canonical error envelope and safe retry guidance.

Error response format

Every JSON error uses the same strict envelope. The HTTP status and theerror.status value match, while request_id gives support a safe correlation identifier.

403 response
{
  "success": false,
  "error": {
    "code": "INSUFFICIENT_SCOPE",
    "message": "This API key does not include the required scope.",
    "status": 403,
    "retryable": false,
    "request_id": "req_scope_01k0",
    "repair_guidance": "Use an API key with schedule:write.",
    "next_action": "use_authorized_api_key",
    "details": {
      "required_scopes": [
        "schedule:write"
      ]
    }
  }
}
ParameterTypeDescription
success*falseAlways false for an error response.
error.code*stringStable machine-readable error code.
error.message*stringSafe human-readable explanation.
error.status*integerCanonical HTTP status, matching the response status.
error.retryable*booleanWhether retrying can succeed without changing the request.
error.request_id*stringCorrelation ID to include when contacting support.
error.issuesarrayOptional bounded field-level validation issues.
error.repair_guidancestringOptional safe guidance for repairing the request or state.
error.next_actionstringOptional bounded action identifier for an agent.

Common error codes

ParameterTypeDescription
MALFORMED_REQUEST / INVALID_HEADER / INVALID_QUERY400The request could not be interpreted or validated.
UNAUTHORIZED401The Bearer token is missing or invalid.
INSUFFICIENT_SCOPE / BRAND_ACCESS_DENIED / ENTITLEMENT_REQUIRED403The key lacks the required authority or product access.
NOT_FOUND404The resource is missing or not visible to this key.
IDEMPOTENCY_KEY_CONFLICT409The key was reused with different request data.
DOMAIN_VALIDATION_FAILED / PREFLIGHT_BLOCKED422The request is well formed but is not safe or ready to perform.
RATE_LIMITED429Wait for Retry-After before retrying.
INTERNAL_ERROR / DEPENDENCY_UNAVAILABLE500 / 503Retry only when retryable is true.

Handle errors safely

JavaScript
const response = await fetch("https://api.wahlu.com/v1/context", {
  headers: {
    Authorization: "Bearer wahlu_live_your_api_key_here",
  },
});

const body = await response.json();

if (!response.ok) {
  console.error(body.error.code, body.error.request_id);

  if (body.error.retryable) {
    const retryAfter = response.headers.get("Retry-After");
    // Retry after the server-provided delay. Do not retry non-retryable errors.
    console.log({ retryAfter, guidance: body.error.repair_guidance });
  }
}