Choose authentication according to where the caller runs: on your server or in a user's browser. The choice also determines whose permissions apply.

| Caller | Authentication | Scope |
| --- | --- | --- |
| Your server or scheduled job | Account API key | Resource Read / Write / Delete grants plus endpoint-specific restrictions |
| External Web application | User session through the [browser SDK](browser-apps) | Signed-in User's Account, role, and group scope |

## Call from a server

An owner creates an [API key](../settings/apikeys) and grants the required resource permissions. For a Machine-list reader, start with Read permission for `machines`.

```http
GET /api/1/machines?limit=20&offset=0
Host: now.obniz.com
Authorization: Bearer <Account API Token>
```

Use the host for your Now environment. Store the token as a server-side secret. Do not include it in browser JavaScript, HTML, or URLs.

## User roles and API-key grants

The User roles `owner`, `member`, and `guest` are separate from an API key's Read / Write / Delete grants. Browser searches remain within the User's group visibility. Changing search conditions cannot expand that scope.

API-key grants do not make every endpoint accessible. Some management APIs require an owner's User session.

## Look up endpoint details

After choosing authentication, use the [Now API reference](https://now.obniz.com/api/1/docs/?lang=en) to check each endpoint's parameters, response schema, and required permissions. The [site records guide](../investigation/site-records), for example, explains the retrieval flow with JSON examples and links to individual API operations.

If you use a dedicated Now environment, open `/api/1/docs/?lang=en` on that host. The reference describes the API served by that environment, so check the same environment your application calls.

## Respond to errors

| Result | Check |
| --- | --- |
| 401 | Token validity or login state |
| 403 | Required grants, feature enablement, and IP restrictions |
| 404 | Target ID and selected Account; inaccessible targets can also return 404 |
| 402 | Available usage quota for the feature |
| Network error | Check whether the mutation completed before sending it again |

Do not add unrelated Write or Delete grants to resolve an authentication error. First check which authentication method the endpoint accepts.
