Esc

↑↓ move↵ openIndex · Pagefind
Authentication

Tokens that act as you.

Trade a user's email and password for a two-hour access token. Every call runs with that user's company and project permissions, and nothing more.

LiveOAuth 2.0 token endpoint

Get a token

POST /oauth/token with the password grant. The body can be JSON or form-encoded. You get back an access token and a refresh token. We only store hashes of them, so this response is the one time you see them.

If the user has an authenticator app enrolled, add "mfa_code": "123456" (or an unused recovery code). Without it the grant returns invalid_grant.

access_token

Access token

Send it as a Bearer token. Lasts 7,200 seconds (two hours).

refresh_token

Refresh token

Lasts 14 days. Single use: it trades in for a new pair with the same scopes.

mfa_code

MFA code

Required when the user has an authenticator app. A six-digit code or an unused recovery code.

Request a tokencurl
curl -X POST https://app.os.construction/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "password",
    "username": "you@yourcompany.com",
    "password": "your-password",
    "scope": "rfis:read rfis:write"
  }'
200 responsejson
{
  "access_token": "9f2c41…64 hex characters",
  "token_type": "Bearer",
  "expires_in": 7200,
  "refresh_token": "a71e0b…64 hex characters",
  "created_at": 1792502999,
  "scope": "rfis:read rfis:write"
}

Send it

Put the token in the Authorization header on every request, over HTTPS. Add OS-Company-Id with your company ID where the reference lists it: GET /rest/v1.0/projects and direct file uploads read it, and sending it everywhere is harmless.

Keep access and refresh tokens server-side. Never ship them in a browser bundle or a mobile app.

Signed in already? Your workspace has interactive API docs with a Try-it panel under Company → Developer.

Authenticated requestcurl
curl https://app.os.construction/rest/v1.0/projects/{project_id} \
  -H "Authorization: Bearer $OS_ACCESS_TOKEN" \
  -H "OS-Company-Id: $OS_COMPANY_ID"

Refresh and revoke

Before the access token expires, send the refresh token with grant_type=refresh_token. You get a new pair with the same scopes, and the old pair stops working. Each refresh token works once.

DELETE /oauth/revoke with either token kills the pair. It answers 200 even for a token it doesn't know, so it can't be used to test whether a token is valid. You can also send the token as Authorization: Bearer instead of in the body. Changing the account password, or turning MFA on or off, revokes every password-grant token the user holds; partner app and MCP connections are revoked from Account → Connected apps.

Refresh, then revokecurl
# Swap the refresh token for a new pair. The old pair stops working.
curl -X POST https://app.os.construction/oauth/token \
  -d grant_type=refresh_token \
  -d refresh_token=$OS_REFRESH_TOKEN

# Revoke a pair with either half. Always answers 200.
curl -X DELETE https://app.os.construction/oauth/revoke \
  -d token=$OS_REFRESH_TOKEN
# {"revoked":true}

Scopes

Ask for scopes when you request a token, space-separated. Each scope is a tool and a mode: <tool>:read covers GET, <tool>:write covers POST, PATCH, PUT and DELETE. A scoped token can only call the tools it names.

Leave scope out and ordinary routes use the user's full access. Sensitive accounting actions still require the explicit accounting:step_up scope. Either way, the user's project membership and permission template (none, read only, standard or admin for each tool) still apply. A scope narrows access. It never adds any.

The Accounting module uses company accounting grants, including entity or project restrictions and permissions for each action. Project Financials access does not grant access to company books. Request accounting:read and, only when needed, accounting:write; those scopes cover the module's apps but never bypass independent approval or payment release controls. Add accounting:step_up only for an integration that must perform protected actions such as payment release, bank-detail changes or access administration. Each use is audited, and the user's configured MFA requirement still applies.

  • rfis:read
    List and read RFIs
  • rfis:write
    Create, update, forward and close RFIs
  • submittals:read
    List and read submittals
  • daily_log:write
    Create and edit daily log entries
  • budget:read
    Budget line items, views and snapshots
  • commitments:read
    Subcontracts, purchase orders and their invoices
  • change_orders:write
    Potential change orders and change order packages
  • webhooks:write
    Create, change and test webhook subscriptions
  • accounting:read
    Read company accounting apps, ledger and reports within the user’s accounting grant
  • accounting:write
    Write accounting documents and workflow actions within the user’s accounting permissions

Examples. Tool names match the sections of the API reference.

Every scope the API checks

Generated from the route handlers: 61 capabilities. Each takes :read and :write; accounting:step_up is the one extra.

accounting · action_plans · activity · admin · analytics · approvals · automations · bidding · budget · change_events · change_orders · commitments · connectors · conversations · coordination_issues · correspondence · crm · daily_log · direct_costs · directory · documents · drawings · emails · equipment · expense_reports · forms · identity · incidents · inspections · jobs · locations · materials · meetings · migration · models · notifications · observations · payment_applications · permits · photos · portfolio · prequalification · prime_contracts · project_archive · punch_list · purchase_requests · reporting · rfis · rfqs · saved_views · schedule · specifications · submittals · tasks · timesheets · tm_tickets · transmittals · uploads · wbs · webhooks · workforce

Errors from the APIhttp
HTTP/1.1 401 Unauthorized
{ "errors": ["Authentication required. Provide a valid Bearer token."] }

HTTP/1.1 403 Forbidden
{ "errors": ["You do not have permission to perform this action."] }

Token errors

The token endpoint answers in the OAuth error shape. Everything under /rest uses { "errors": [...] }: a 401 means the token is missing, wrong or expired, and a 403 means the user or the token's scopes don't cover that tool or record.

  • 400 invalid_request
    A grant parameter is missing, is not a string, or the body is over 64 KB.
  • 400 unsupported_grant_type
    Use password or refresh_token.
  • 401 invalid_grant
    Wrong credentials, a wrong or missing MFA code, or an expired refresh token.
  • 429
    More than 5 attempts in a minute for one username from one IP. The body is { "errors": [...] } with a Retry-After header.
Errors from /oauth/tokenhttp
HTTP/1.1 401 Unauthorized
{ "error": "invalid_grant", "error_description": "Invalid credentials." }

HTTP/1.1 400 Bad Request
{ "error": "unsupported_grant_type", "error_description": "Unsupported grant_type." }

Service accounts Live

For unattended syncs, a company admin creates a service account under Company admin › Service accounts: a non-human account with an owner, project access through permission templates, and its own credentials. Use an API key (osc_sak_…) as the bearer, or an OAuth client secret with grant_type=client_credentials and client_id=sa_<id> for one-hour tokens. Secrets are shown once and stored hashed, always carry explicit scopes, expire within a year, rotate with an overlap window and can be revoked at once. An optional IP allowlist limits where a credential works, and every call is logged. Service accounts cannot sign in to the app, cannot be super admins and do not use a seat.

Partner apps Preview

Building a product other contractors connect? Register a public OAuth client (Company admin › Partner apps) and use the authorization code flow with PKCE (S256) against /oauth/authorize and /oauth/token with resource=https://app.os.construction/rest. Each person approves the scopes on a consent screen; refresh tokens rotate on every use and a reused one revokes the connection. /oauth/revoke and /oauth/introspect are available. People revoke apps under Account › Connected apps, and company admins can see and revoke every app their people connected. Apps are unverified until we review the publisher. We have not yet run a third-party app end to end in production, so tell us before you launch.

AI agent credentials Live

Agents propose; people approve. Hosted MCP connections, tokens requested with agent=true, and service accounts or partner apps marked as agents can read and create or draft work, but every approve, certify, post, pay, release, void, delete or permission change answers 403, even when the token's scopes include it. Each write endpoint declares whether it proposes, approves or administers, and agent calls are recorded with the person they act for so admins can review proposals and refusals under Company admin › API activity.

Talk to us →

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