# Get the caller's context

Returns the Spacefast agent instructions as Markdown, filtered by `scopes` and sized for `consumer`, plus what the request’s credential is. Works with any credential or none. A credentialed call adds a `credential` block naming the credential and what it is bound to. A user-owned interactive agent grant also gets a `capabilities` map of the operations its scopes allow.

## GET`/v1/context`

### Authorization

Optional — this operation also accepts unauthenticated requests.

`Authorization`Bearer token · header

`Authorization: Bearer <key>` with the Space key (`sfc_` prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's `/_/__/<key>` sign-in URL.

or

`Authorization`Bearer token · header

`Authorization: Bearer <token>` with an API key (`sfa_` prefix), an OAuth access token, a session token, or a Space machine credential (`sfm_` prefix).

or

`__Host-better-auth.session_token`API key · cookie

Dashboard session cookie set at sign-in. An operation that lists only this scheme needs a person: API keys and machine credentials are refused. The same session token also works as `Authorization: Bearer`.

### Query parameters

`scopes`string | string[]

`consumer`stringrequired

default: "markdown"

Allowed:`cursor``mcp``markdown`

### Responses

#### 200Response for status 200

`$schema`string<uri>

Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.

`data`objectrequired

Show propertiesHide properties

`consumer`stringrequired

Client reading the instructions. Sets the size budget: `cursor` caps at 24,000 characters, `mcp` at 16,000, `markdown` is unbounded. Defaults to `markdown`.

default: "markdown"

Allowed:`cursor``mcp``markdown`

`scopes`string[]required

Section keys included in `markdown`, in reading order.

`markdown`stringrequired

Agent instructions as Markdown. The same text for every caller.

`truncated`boolean

True when the `consumer` budget dropped sections.

`omittedScopes`string[]

Section keys dropped to fit the budget. Present only when `truncated` is true.

`credential`object

The credential that authenticated this request and what it is bound to. Absent for an anonymous call.

Show propertiesHide properties

`kind`stringrequired

What the caller presented. `claim_token` is reported from the request alone: the Space key is checked against the Space it opens elsewhere, so nothing else about it is known here.

Allowed:`session``api_key``partner_token``oauth_client``runtime``internal``claim_token`

`authorizationId`string

The credential's own stable ID, such as the API key it came from. Absent for a browser session.

`subject`object

The account, team, or service whose authority this credential spends.

Show propertiesHide properties

`type`stringrequired

Allowed:`user``team``external``system`

`id`stringrequired

`userId`string

The person who created the credential. Attribution only: a machine credential acts as `subject`, not as this user.

`ownerPrincipal`object

The team or external customer that owns the credential. Absent when Spacefast owns it.

Show propertiesHide properties

`type`stringrequired

Allowed:`team``external`

`id`stringrequired

`teams`object

The teams the credential is scoped to. Absent when it carries no team scope of its own.

Show propertiesHide properties

One of:

object

`object`

object

`teamIds`string[]required

Teams the credential may act in. Each team appears once.

min items 1 · max items 100

object

`object`

`grantId`string

The grant this credential draws its authority from. Absent for browser sessions and Spacefast-owned credentials.

`authorizationLevel`string

Whose authority the grant spends: `user` the person who authorized it, `team` the team they authorized it for. Absent exactly when `grantId` is.

Allowed:`user``team`

`expiresAt`string

ISO 8601 timestamp for when the credential stops working. Absent when it never expires.

`capabilities`object

Operations the calling grant's scopes allow. Present only for a user-owned interactive agent grant. Advisory only; each route enforces its own authorization.

Show propertiesHide properties

`enabled`booleanrequired

`degraded`booleanrequired

`grantId`stringrequired

`authorizationLevel`stringrequired

`grantedScopes`string[]required

`reason`string

`operations`object[]required

Show propertiesHide properties

Array of `object`

`operation`stringrequired

`action`stringrequired

`available`booleanrequired

`reason`stringrequired

`acceptableScopeSets`string[][]required

`missingScopes`string[]required

## defaultError

Every 4xx and 5xx response is one RFC 9457 problem document served as `application/problem+json`.

`$schema`string<uri>

Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.

`type`stringrequired

URL of the documentation page for this error. Derived from `code`.

`title`stringrequired

Human-readable name of the error type. Derived from `code`.

`status`integerrequired

HTTP status of the response, repeated in the body.

min -9007199254740991 · max 9007199254740991

`detail`stringrequired

What went wrong in this request.

`code`stringrequired

Stable snake_case error code. Match on this, not on `detail`.

`pointer`string

RFC 6901 JSON Pointer to the request field or batch entry that failed, for example `/files/37/path`. Present on validation failures.

`details`object

Machine-readable context keyed by the error code.

`suggestions`string[]

Recovery steps safe to show to a person.

`next`string[]

Commands or API requests to run next, usable as written.

`requestId`stringrequired

ID of this request, from the `X-Request-Id` header or generated. Quote it when contacting support.
