> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.astropods.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.astropods.com/_mcp/server.

# Act for a person with an OAuth app

An OAuth app that acts for a person calls the Astropods API with that person's access, capped by the scopes you grant the app. The person signs in once and approves the app. The app then holds an access token and a refresh token for them. Use one for a tool that reads an agent's traces, logs, or evaluations on someone's behalf.

## Create the app

Creating an app requires the `app:manage` permission on the account, which [account administrators](/access-control) hold.

#### Open the OAuth apps settings

Go to **Settings** > **OAuth apps** and create an app.

#### Choose the access

Select **User access**. Turn on **Public client** for a mobile, desktop, or browser app that can't keep a secret. A public client signs in with PKCE alone and holds no client secret.

#### Grant scopes

Grant `deployment:read` to read deployments. Scopes use the same permission names as roles.

#### Add redirect URIs

Add the URIs your app receives the sign-in on: `https`, or `http` on a loopback host such as `localhost`. A public client also accepts a custom scheme, such as `com.example.app:/callback`.

#### Copy the app's details

Copy the client ID, and the client secret for a confidential app. The app's row lists the authorization and token URLs.

## Get a token

The app uses the OAuth 2.0 authorization code grant with PKCE.

1. Send the person to `https://login.astropods.com/oauth2/authorize` with your `client_id`, `redirect_uri`, `state`, a PKCE `code_challenge`, and `scope=openid profile email offline_access`.
2. The person signs in and approves the app. The browser returns to your redirect URI with a `code`.
3. Exchange the code at `https://login.astropods.com/oauth2/token` with the PKCE verifier, and your client secret for a confidential app. The response holds an access token and a refresh token.
4. Send the access token as `Authorization: Bearer <token>`. When it expires, exchange the refresh token at the same token URL.

The `scope` parameter carries sign-in scopes only. What the app may do comes from the scopes on the app itself, so changing them in settings applies on the next request.

Call `GET /api/v1/me` to check a token. For a token from an app acting for a person, it returns the person, the app and its scopes, and the app's account while the person is still a member of it.

## Read a deployment

With the `deployment:read` scope, the app can call the deployment endpoints that read data with `GET`:

| Data                  | Endpoints                                                                                                                                                                     |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The deployment        | `GET /api/v1/deployments/{id}`, `/status`, `/runtime`, `/sizing`                                                                                                              |
| Traces                | `GET /api/v1/deployments/{id}/observability/traces`, `/traces/{traceId}`, `/traces/{traceId}/thread`, `/observations/{observationId}`, `/trace-users`, `/metrics`, `/summary` |
| Evaluations           | `GET /api/v1/deployments/{id}/trace-evaluations`, `/trace-evaluations/{traceId}`, `/evaluations/summary`, `/evaluations/overview`                                             |
| Logs and events       | `GET /api/v1/deployments/{id}/logs`, `/logs/stream`, `/events`                                                                                                                |
| Alerts                | `GET /api/v1/deployments/{id}/alerts`, `/alerts/history`, `/watchers`                                                                                                         |
| Usage                 | `GET /api/v1/deployments/{id}/usage`, `/insights`                                                                                                                             |
| Files                 | `GET /api/v1/deployments/{id}/files`, `/files/usage`, `/files/{fileKey}`, `/files/{fileKey}/content`                                                                          |
| Network and resources | `GET /api/v1/deployments/{id}/network/summary`, `/network/flows`, `/network/timeseries`, `/pods/{pod}/metrics`                                                                |
| Configuration         | `GET /api/v1/deployments/{id}/configmap/{name}`, `/secret/{name}/keys`                                                                                                        |

The app reads only what the person can read. A deployment the person can't see is hidden from the app too. The deployment must also belong to the account that owns the app, even when the person belongs to other accounts.

The app can't change a deployment. Every request that isn't a `GET` or `HEAD` on these endpoints is refused, including ones that change only the person's own settings, such as watching a deployment's alerts.

## Errors

| Status | Cause                                                                                                                                                                                                                                               |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `401`  | The token is invalid or expired, the app was deleted, or the endpoint doesn't accept an app acting for a person. Refresh the token, or have the person sign in again.                                                                               |
| `403`  | The token is valid, but the request isn't allowed: it changes a deployment or uses a method other than `GET` or `HEAD`, or the app doesn't hold the scope the endpoint needs (`deployment:read` for these endpoints). The `error` field says which. |
| `404`  | The deployment doesn't exist, belongs to another account than the app, or the person can't see it.                                                                                                                                                  |

## Revoke access

Delete the app to revoke its tokens. Every token issued for it, including tokens that haven't expired, is refused starting with the next request. A log stream that is already open (`GET /api/v1/deployments/{id}/logs/stream`) continues until it disconnects. Removing the person from the account ends the app's access to that account's deployments the same way.

## Next steps

* [Access control](/access-control) describes each permission.
* [API reference](/api-reference) lists every endpoint and its parameters.
* [Authentication](/authentication) covers signing in with the CLI.