Skip to main content

Errors

The Gomry API uses standard HTTP status codes to indicate the outcome of a request. Errors return a JSON body with an error field describing the issue.

Error Response Format

{
  "error": "Human-readable error message"
}
For validation errors, additional detail may be included:
{
  "error": "Invalid pagination parameters",
  "details": {
    "fieldErrors": {
      "page_size": ["Number must be less than or equal to 200"]
    }
  }
}

Status Codes

CodeMeaningWhen It Happens
200OKRequest succeeded
400Bad RequestInvalid query parameters or request body
401UnauthorizedMissing or invalid API key
404Not FoundResource doesn’t exist or doesn’t belong to your organization
429Too Many RequestsRate limit exceeded — slow down and retry
500Internal Server ErrorSomething went wrong on our end

Handling Errors

const response = await fetch(url, { headers: { "X-API-KEY": apiKey } });

if (!response.ok) {
  const { error } = await response.json();
  
  switch (response.status) {
    case 401:
      console.error("Authentication failed:", error);
      break;
    case 404:
      console.error("Resource not found:", error);
      break;
    case 429:
      // Retry after a short delay
      await new Promise((r) => setTimeout(r, 2000));
      break;
    default:
      console.error(`API error (${response.status}):`, error);
  }
}
A 404 response does not confirm the resource doesn’t exist — it may belong to a different organization. The API intentionally returns 404 instead of 403 to avoid leaking information about other organizations’ data.