Get the caller's context - Spacefast Docs

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.

AuthorizationBearer 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

AuthorizationBearer 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_tokenAPI 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

scopesstring | string[]

consumerstringrequired

default: "markdown"

Allowed:cursor``mcp``markdown

Responses

200Response for status 200

$schemastring

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

dataobjectrequired

Show propertiesHide properties

consumerstringrequired

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

scopesstring[]required

Section keys included in markdown, in reading order.

markdownstringrequired

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

truncatedboolean

True when the consumer budget dropped sections.

omittedScopesstring[]

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

credentialobject

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

Show propertiesHide properties

kindstringrequired

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

authorizationIdstring

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

subjectobject

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

Show propertiesHide properties

typestringrequired

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

idstringrequired

userIdstring

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

ownerPrincipalobject

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

Show propertiesHide properties

typestringrequired

Allowed:team``external

idstringrequired

teamsobject

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

teamIdsstring[]required

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

min items 1 · max items 100

object

object

grantIdstring

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

authorizationLevelstring

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

expiresAtstring

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

capabilitiesobject

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

enabledbooleanrequired

degradedbooleanrequired

grantIdstringrequired

authorizationLevelstringrequired

grantedScopesstring[]required

reasonstring

operationsobject[]required

Show propertiesHide properties

Array of object

operationstringrequired

actionstringrequired

availablebooleanrequired

reasonstringrequired

acceptableScopeSetsstring[][]required

missingScopesstring[]required

defaultError

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

$schemastring

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

typestringrequired

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

titlestringrequired

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

statusintegerrequired

HTTP status of the response, repeated in the body.

min -9007199254740991 · max 9007199254740991

detailstringrequired

What went wrong in this request.

codestringrequired

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

pointerstring

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

detailsobject

Machine-readable context keyed by the error code.

suggestionsstring[]

Recovery steps safe to show to a person.

nextstring[]

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

requestIdstringrequired

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