Skip to content

Error Responses ​

All API error responses return a JSON object with a message field and the application/json content type.

Response Structure ​

Every error response contains:

FieldTypeDescription
messagestringA human-readable explanation of the error.

Additional Fields ​

Depending on the error type, extra fields may be present:

FieldTypeWhen Present
errorsobjectValidation errors (422). Keys are the camelCase request field names (nested ones in dot notation, e.g. billingAddress.line1), values are arrays of error messages.

Production Masking ​

Two kinds of message exist:

  • Domain messages — the specific texts documented on the endpoint pages (e.g. Na tento posudok už máte aktívnu ponuku., Heslo sa nepodarilo obnoviť., Unauthenticated., validation messages). They are returned verbatim in every environment and are localized through APP_LOCALE — production runs in Slovak, so the texts on this and the endpoint pages are what the API actually sends. The framework mask texts below are not localized.
  • Framework HTTP errors (403, 404, 405, 429, unexpected 500) — in production the message is replaced by the generic status text: Forbidden, Not Found, Method Not Allowed, Too Many Requests, An unexpected error occurred.. The more specific texts shown for these codes below and on endpoint pages (This action is unauthorized., Access denied for authenticated users., Testimony file not found., …) only appear in non-production environments. Branch on the status code, not on the message.

Examples ​

401 Unauthorized ​

Returned when authentication is missing or invalid.

json
{
  "message": "Unauthenticated."
}

403 Forbidden ​

Returned when the authenticated user is not authorized for the action: wrong role, not the owner of the resource, a guest-only endpoint called with a token (Access denied for authenticated users.), or an endpoint that requires a verified email called by an unverified user (Access denied for unverified users.).

json
{
  "message": "This action is unauthorized."
}

404 Not Found ​

Returned when the requested resource or route does not exist.

json
{
  "message": "Not Found"
}

409 Conflict ​

Returned when the action conflicts with the current resource state — an invalid state transition, a testimony that no longer accepts offers or checkout, a duplicate offer, an offer that is no longer available or can no longer be withdrawn, or a payment that belongs to another offer. State names in the message are the Slovak state labels (Čaká na ponuky, S ponukami, Prijatý, Hotový, Zrušený).

json
{
  "message": "Prechod zo stavu „Zrušený“ do stavu „Prijatý“ nie je možný."
}

Every state-changing endpoint (create offer, withdraw offer, accept offer, cancel, complete) can also answer 409 when another request modified the same testimony at the same moment. Re-fetch the resource and retry if the action still applies:

json
{
  "message": "Záznam bol medzitým zmenený. Skúste to znova."
}

422 Unprocessable Content ​

Returned when validation fails. Includes an errors object with per-field messages.

json
{
  "message": "E-mail musí byť platná e-mailová adresa. (a 2 ďalších chýb)",
  "errors": {
    "email": [
      "E-mail musí byť platná e-mailová adresa."
    ],
    "password": [
      "Heslo musí mať minimálne 8 znakov."
    ],
    "passwordConfirmation": [
      "Hodnota Heslo znova sa musí zhodovať s hodnotou z Heslo."
    ]
  }
}

Any request whose input contains invalid UTF-8 or a NUL byte is rejected the same way, with Hodnota obsahuje znaky, ktoré nie je možné uložiť. on the offending field.

Business-rule violations use the same status with a plain message and no errors object:

json
{
  "message": "Platba ešte nebola dokončená."
}

429 Too Many Requests ​

Returned when a rate limit is exceeded. The Retry-After header tells how many seconds to wait; X-RateLimit-Limit and X-RateLimit-Remaining are sent on every rate-limited endpoint.

json
{
  "message": "Too Many Attempts."
}
EndpointsLimit
Login, Register Client, Register Expert, Send Password Reset Email, Password Reset5 requests per minute per IP address
Check Email10 requests per minute per IP address
Resend Verification Email3 requests per minute per user (or IP)
All authenticated endpoints (/me/*, testimonies, offers, invoices, sandbox) except Logout120 requests per minute per user
Checkout Offeradditionally 3 requests per minute per user
Create Testimonyadditionally 10 per hour and 20 per day per user
Create Offeradditionally 5 per hour per user and testimony
Withdraw Offeradditionally 10 per hour per user

500 Internal Server Error ​

Returned when an unexpected server error occurs. The message is masked in production.

Production:

json
{
  "message": "An unexpected error occurred."
}

Non-production (includes the actual exception message):

json
{
  "message": "SQLSTATE[42S02]: Base table or view not found..."
}

502 Bad Gateway ​

Returned by Checkout Offer, Accept Offer and Withdraw Offer when Stripe could not be reached, rate-limited the request or answered with a server error. Retry later.

json
{
  "message": "Pri spracovaní platby nastala chyba. Skúste to znova."
}

Content Type ​

All error responses are returned with the header:

http
Content-Type: application/json