Skip to Content

apiErrorResponse()

function apiErrorResponse(error, options?): Response;

An error envelope as an HTTP response, with its request id and, for a retry, Retry-After.

Parameters

error

code

| "INVALID_REQUEST" | "UNAUTHENTICATED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PAYLOAD_TOO_LARGE" | "RATE_LIMITED" | "USAGE_LIMIT_EXHAUSTED" | "SERVICE_UNAVAILABLE" | "INTERNAL_ERROR" = ApiErrorCodeSchema

message

string = ...

param?

string = ...

reason?

| "invalid_json" | "parameter_invalid" | "unsupported_endpoint" | "provider_missing" | "provider_unsupported" | "credentials_missing" | "credentials_malformed" | "token_invalid" | "token_expired" | "session_revoked" | "customer_deleted" | "customer_access_revoked" | "identity_token_invalid" | "identity_token_expired" | "identity_provider_unmatched" | "identity_subject_deleted" | "api_key_invalid" | "api_key_expired" | "api_key_revoked" | "no_active_grant" | "grant_expired" | "model_not_entitled" | "customer_suspended" | "permission_missing" | "project_not_in_scope" | "mode_not_in_scope" | "workspace_access_required" | "session_required" | "app_user_id_taken" | "grant_already_active" | "grant_not_cancelable" | "default_product_grant" | "default_product_in_use" | "idempotency_key_reused" | "checkout_in_progress" | "source_subscription_ambiguous" | "too_many_concurrent_requests" | "subscription_quota_exhausted" | "paid_credits_exhausted" | "provider_spend_limit_exhausted" | "provider_quota_exhausted" | "identity_provider_unavailable" | "stream_authorization_unavailable" | "metering_unavailable" | "product_not_configured" | "sign_in_not_configured" = ...

requestId

string = ...

requiredPermission?

| "projects:write" | "projects:read" | "products:write" | "products:read" | "accounts:write" | "accounts:read" | "customers:write" | "customers:read" | "logs:read" | "backups:write" | "backups:read" | "secrets-integrations:write" | "secrets-integrations:read" | "subscription-sign-ins:write" | "subscription-sign-ins:read" | "starred-items:write" | "starred-items:read" | "api-keys:write" | "api-keys:read" = ...

options?

retryAfterSeconds?

number | null

Last updated on