Esc

↑↓ move↵ openIndex · Pagefind
Rate limits · pagination · errors

Generous, predictable, and easy to back off.

Limits are per token. Go over and you get a 429 with Retry-After telling you how many seconds to wait. Lists page with plain headers. Errors are one small JSON shape.

LiveCurrent defaults · subject to change

Limits

These are the defaults today. We may change them as we learn how people use the API. Running a nightly sync that needs more? Tell us and we'll look at it with you.

  • Requests
    6,000 per 60 seconds per token
    Sliding window, every method counts. Each client address also has a much higher ceiling checked before the token, so floods are cut off early.
  • Token requests
    5 per minute per username per IP
    POST /oauth/token. Slows down password guessing.
  • Page size
    per_page up to 1,000 (default 100)
    Some lists cap lower. Follow the Link header.

Headers

A 429 from /rest carries Retry-After in seconds plus RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset; a 429 from /oauth/token carries only Retry-After. Successful responses carry no RateLimit-* headers, so back off when you see a 429 instead of counting.

429 responsehttp
HTTP/1.1 429 Too Many Requests
Retry-After: 4
RateLimit-Limit: 6000
RateLimit-Remaining: 0
RateLimit-Reset: 4
Content-Type: application/json

{ "errors": ["Rate limit exceeded. Please retry later."] }

Back off, then retry

On 429 or 5xx, wait Retry-After seconds (or back off exponentially with jitter) and try again. Retry reads freely.

To retry a write safely, send an Idempotency-Key header and retry with the same key, token, path and body. Project and company write endpoints replay the stored 2xx response for 24 hours, return 422 if the request changed and 409 while the first one is still running. See Idempotency keys.

Accounting create and payment routes keep their own keys for 30 days and return 409 for a changed body or caller. AR and some payment actions use their documented request_key contract. A write sent without a key may create another record on retry: look for the record before sending it again.

Retry helper
async function call(url, init, tries = 5) {
  for (let i = 0; i < tries; i++) {
    const res = await fetch(url, init);
    if (res.status !== 429 && res.status < 500) return res;
    const wait = Number(res.headers.get("Retry-After")) || 2 ** i;
    await new Promise(r => setTimeout(r, (wait + Math.random()) * 1000));
  }
  throw new Error("gave up after retries");
}
// Without an Idempotency-Key, a write is not idempotent: before resending a POST that timed out,
// GET the list and check whether it landed.

Pagination

List endpoints take page (from 1) and per_page (default 100, up to 1,000). The body is a plain JSON array. The paging details live in the headers:

  • Total
    How many rows match, across all pages.
  • Per-Page
    The page size the server used.
  • Link
    URLs for first, prev, next and last. Follow rel="next" until it's gone.
Page 2 of the RFI loghttp
curl -i "https://app.os.construction/rest/v1.0/projects/{project_id}/rfis?page=2&per_page=100" \
  -H "Authorization: Bearer $OS_ACCESS_TOKEN"

HTTP/1.1 200 OK
Total: 236
Per-Page: 100
Link: <…/rfis?page=1&per_page=100>; rel="first",
      <…/rfis?page=1&per_page=100>; rel="prev",
      <…/rfis?page=3&per_page=100>; rel="next",
      <…/rfis?page=3&per_page=100>; rel="last"

[ { "id": 101, "number": "101", "subject": "…" }, … ]
Walk every pageJavaScript
async function* all(url, headers) {
  let next = url;
  while (next) {
    const res = await call(next, { headers });
    yield* await res.json(); // the body is a plain array
    next = res.headers.get("Link")?.match(/<([^>]+)>;\s*rel="next"/)?.[1];
  }
}

Errors

Every response carries an x-request-id header. Include it when you report a problem.

Errors come back as { "errors": ["message"] }. Validation failures are a 422 with the messages keyed by field instead. The token endpoint is the one exception: it uses the OAuth shape, covered under Authentication.

  • 400
    Bad request, or a body that isn't valid JSON
  • 401
    Missing, invalid or expired token
  • 403
    The user, or the token's scopes, can't use this tool or record
  • 404
    Not found, or not visible to you
  • 409
    The record's state doesn't allow this right now
  • 422
    Validation failed. Errors are keyed by field
  • 429
    Too many requests. See Retry-After
  • 500
    Server error. Safe to retry reads
Error bodieshttp
HTTP/1.1 404 Not Found
{ "errors": ["The RFI you requested could not be found."] }

HTTP/1.1 422 Unprocessable Entity
{ "errors": { "rfi.subject": ["can't be blank"] } }

Ask the OS

Reading this page

Ask anything about this page. Answers use what you're reading as context.

Suggested

    AI · may be imperfect · sample data where shown

    Open file