PgBeam Docs

Response Conventions

Status codes, error envelope, retries, and idempotency across the PgBeam API.

Every endpoint follows the same conventions for status codes, error responses, retries, and idempotency.

Status codes

CodeMeaningDescription
200OKSuccess with a response body
201CreatedA resource was created
204No ContentSuccess, no response body
4xxClient errorBad request, unauthorized, not found, etc.
5xxServer errorSomething went wrong on our end

Pagination

List endpoints return an array plus pagination metadata.

Error envelope

All errors use the same JSON envelope:

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Project not found"
  }
}
FieldTypeDescription
error.codestringMachine-readable error code
error.messagestringHuman-readable description

Error codes

HTTP Statuserror.codeDescription
400INVALID_INPUTBad request — fix the input
401UNAUTHORIZEDMissing or invalid authentication
403FORBIDDENInsufficient permissions or plan limits
404NOT_FOUNDResource not found
409CONFLICTResource already exists or state conflict
422INVALID_INPUTValidation error
429RATE_LIMITEDToo many requests (includes Retry-After header)
500INTERNAL_ERRORInternal server error
502Bad gateway
503Service unavailable
504Gateway timeout

Retries

Retryable status codes

The SDKs automatically retry requests that fail with these status codes:

StatusRetryableNotes
408YesRequest timeout
429YesRate limited — respects Retry-After
502YesBad gateway
503YesService unavailable — respects Retry-After
504YesGateway timeout
Network errorYesConnection refused, DNS failure, timeout
All other codesNoReturned immediately

Exponential backoff with jitter

The wait between retries follows this formula:

delay = min(initialDelay × 2^attempt, maxDelay) × random(0.5, 1.5)
SettingDefaultDescription
Max retries5Total retry attempts (0 to disable)
Initial delay500msFirst backoff interval
Max delay30sBackoff ceiling

Retry-After header

When the server returns a Retry-After header (on 429 or 503), the SDKs use that value instead of their own computed backoff. Both formats are supported:

  • Integer seconds: Retry-After: 60
  • HTTP-date: Retry-After: Thu, 01 Jan 2026 00:00:00 GMT

Idempotency

POST and PATCH requests include an Idempotency-Key header so retries never double-create resources.

  • Keys are UUID v4, generated once per SDK call and reused across all attempts
  • Sent on every attempt (including the first) so the server can deduplicate even if the initial request succeeds but the client loses the response
  • GET and DELETE are naturally idempotent — no key needed
  • The server caches idempotent responses for 24 hours
  • Transient errors (408, 429, 502, 503, 504) are not cached — the next retry executes the handler again

See the TypeScript SDK and Go SDK docs for language-specific configuration.

On this page