API version v1

Public API

Authentication

The Authorization header, key check, and error codes

Every request to the public API is authenticated with a company key. The key goes in the Authorization header with the Bearer scheme:

Authorization: Bearer rv_live_<prefix>_<secret>

There are no cookies or user sessions here: company_id is derived from the key, so you never pick a company manually.

Checking a key

To confirm a key works and see its scopes, call /me:

curl https://api.rentevio.ru/api/public/v1/me \
  -H "Authorization: Bearer rv_live_…"
{
  "success": true,
  "data": {
    "company_id": "1e3e7bd5-…",
    "scopes": ["equipment:read", "projects:read"],
    "api_key_id": "01a14109-…"
  }
}

/me needs no specific scope — any valid key can call it. Handy for a post-deploy smoke check.

Mutation headers

  • Authorization — always required.
  • Idempotency-Key — for POST, PATCH, DELETE. Repeating a request with the same value does not create a duplicate, so it is safe to retry after a network failure.

Error codes

Errors arrive in the {"success": false, "error": {…}} envelope, where error_code is a stable machine key:

error_codeHTTPWhen
UNAUTHORIZED401key missing, invalid, revoked or expired
FORBIDDEN403the key lacks the required scope
VALIDATION400malformed body or query parameters
NOT_FOUND404resource not found or owned by another company
CONFLICT409the operation conflicts with current state
RATE_LIMITED429the key exceeded its rate limit
UPSTREAM_ERROR502internal service error, retry later

Example:

{
  "success": false,
  "error": {
    "code": 403,
    "error_code": "FORBIDDEN",
    "message": "insufficient scope"
  }
}

401 and 403 mean different things: 401 is "key rejected", 403 is "key accepted but not allowed". Handle them separately so you never show a client the wrong cause.

Next — versioning: how the API treats backward compatibility.

NextVersioning
Was this helpful?