Videpay returns standard HTTP status codes wrapped in a consistent JSON envelope. Most integration issues are authentication, validation, or business-rule errors, all surfaced in the `message` field. Read `message` first. It's giving stack trace, but polite.
Need machine-readable request/response bodies for your AI or codebase? Download this page as plain Markdown.
Your script gets 401 Unauthorized. You check: using sandbox API key? Calling sandbox.api.videpay.io? x-api-key header set? Fixing the env var resolves it. Classic environment mismatch: we've all been there, no judgment.
Every failed API call returns the same JSON envelope from the global exception handler, not the raw NestJS `{ error: "Bad Request" }` object alone. Read `message` first; use `details` for any extra fields Nest attached (usually `{ error: "Bad Request" }`). Validation errors are a single `message` string (multiple field issues joined with `; `).
What to log vs show users
Log `statusCode`, `path`, and `message` for debugging. `url`, `ip`, and `health` are diagnostic metadata: do not surface them to end users.
| Field | Type | Required | Description |
|---|---|---|---|
statusCode | integer | Yes | HTTP status (same as response status line). |
message | string | Yes | Human-readable error. Validation failures look like `amount: amount must be a valid positive number string`. |
details | object | No | Optional extra context. Often `{ error: "Bad Request" }` or `{ error: "Unauthorized" }`. |
method | string | No | HTTP method of the failed request. |
path | string | No | Request path without query string. |
timestamp | string | No | ISO-8601 time the error was generated. |
environment | string | No | Server environment (e.g. sandbox, live). |
(any endpoint)Typical validation error (400).
(any endpoint)Missing or invalid API key (401).