---
title: "Get agent context"
method: GET
path: "/agent/context"
tags: ["AgentContext"]
---

# Get agent context

`GET /agent/context`

## Request

- Base URL: `https://plainrouter.com/api/v1`
- URL: `https://plainrouter.com/api/v1/agent/context`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://plainrouter.com/oauth2/authorize`, token URL `https://plainrouter.com/oauth2/token`, scopes: `mcp:use`)

Read the authenticated agent and authorized account. With no active account, returns null and connection next steps.

## Query parameters

- `account_id` integer
- `workspace_id` integer

## Response `200`

Agent identity and account context.

- object
  - `meta_connected` boolean, required
  - `agent` object, required
    - `id` string, required
    - `name` string, required
    - `scopes` string[], required
    - `authentication` 'personal_access_token' | 'oauth2', required
  - `platform_ad_account` object, nullable, required
    - `id` integer, required
    - `external_id` string, required
    - `name` string, required
    - `platform` string, required
    - `currency` string, nullable, required
    - `timezone` string, nullable, required
    - `workspace` object, required
      - `id` integer, required
      - `name` string, required
  - `next_steps` string[]: Present only when meta_connected is false.

## Other responses

- `400`: Malformed URL encoding.
- `401`: Missing, invalid, expired or revoked token, inactive binding, insufficient agent permission, or a management API key.
- `403`: The accessible workspace scope or operation is unauthorized, or an ambiguous workspace selection was omitted.
- `404`: Workspace is nonexistent, inaccessible or noncanonical.
- `422`: Invalid account ID, mismatched account binding, or ambiguous active accounts.
- `429`: The shared API rate limit is exceeded.

---

[API](https://skmtc.dev/plainrouter/apis/plainrouter-conversion-api.md) · [All operations](https://skmtc.dev/plainrouter/apis/plainrouter-conversion-api/llms.txt) · [OpenAPI document](https://skmtc.dev/plainrouter/apis/plainrouter-conversion-api/revisions/d071d4f4f05c?raw)
