Skip to content
Hoursmith Docs
API

Errors

The Hoursmith API uses a consistent error envelope with stable codes. Learn the format, status codes, and how to handle each.

Every error response uses the same JSON envelope, so you can handle failures predictably.

Error format

{
  "error": {
    "code": "validation_error",
    "message": "Request validation failed.",
    "fields": { "name": "required" }
  }
}
  • code — a stable, machine-readable string. Branch your logic on this, not on message.
  • message — a human-readable description (may change wording over time).
  • fields — present only on validation errors; maps each invalid field to a reason.
  • On forbidden_plan, the error also includes requiredPlan and feature.

Status codes

HTTPcodeMeaningWhat to do
400bad_requestMalformed request.Fix the request.
401unauthenticatedMissing/invalid/revoked token.Check the Authorization header.
402forbidden_planWorkspace lacks API access.Upgrade to Studio/Agency.
403forbidden_scopeRole can't perform this action.Use a token with a higher role.
404not_foundRecord doesn't exist or isn't visible to you.Verify the id and access.
409conflictBlocked by state.See below.
422validation_errorInvalid input (or missing Idempotency-Key).Inspect fields.
429rate_limitedToo many requests.Respect Retry-After.
500internalSomething went wrong on our side.Retry with backoff; contact support if it persists.

When you'll see 409 conflict

The API refuses actions that would corrupt your data:

Handling errors well

Switch on error.code

Treat code as the contract. Don't pattern-match on message.

Surface fields on 422

Show the per-field reasons back to the user or log them — they tell you exactly what to fix.

Retry only the right codes

Retry 429 (after Retry-After) and 500 (with backoff). Don't retry 4xx validation/permission errors — fix the request instead.

Was this page helpful?

On this page