Overview
Thegrants sub-client provides operations on grant records: retrieving, listing, revoking, delegating to sub-agents, and verifying grant tokens online.
grants.get()
Retrieve a single grant by its ID.Parameters
The grant ID to retrieve.
Response: Grant
Unique grant identifier.
The agent that holds this grant.
The agent’s decentralized identifier.
The user who authorized the grant.
The developer organization.
Granted scopes.
Grant status:
'active', 'revoked', or 'expired'.ISO 8601 timestamp when the grant was issued.
ISO 8601 timestamp when the grant expires.
ISO 8601 timestamp when the grant was revoked (only present if
status is 'revoked').grants.list()
List grants with optional filters.Parameters
Filter by agent ID.
Filter by principal (user) ID.
Filter by status:
'active', 'revoked', or 'expired'.Page number (1-indexed).
Number of grants per page.
Response: ListGrantsResponse
Array of grant objects.
Total number of grants matching the filters.
Current page number.
Number of grants per page.
grants.revoke()
Revoke a grant by its ID. This immediately invalidates the grant and any associated tokens.Parameters
The grant ID to revoke.
Response
Returnsvoid.
grants.delegate()
Create a delegated grant for a sub-agent. This implements the delegation chain described in SPEC section 9. The parent agent passes its grant token, and the sub-agent receives a new grant token with scopes that are a subset of the parent’s.Parameters
The parent agent’s grant token JWT.
The ID of the sub-agent to delegate to.
The scopes to delegate. Must be a subset of the parent grant’s scopes.
Duration for the delegated grant (e.g.
'1h', '30m'). Cannot exceed the parent grant’s remaining lifetime.Response
The delegated grant token (RS256 JWT) for the sub-agent.
The delegated grant’s record ID.
The delegated scopes.
ISO 8601 expiry timestamp.
grants.verify()
Verify a grant token online and return aVerifiedGrant with full claim details. The SDK decodes the token returned by the API to populate all fields.
Parameters
The grant token JWT to verify.
Response: VerifiedGrant
Returns a VerifiedGrant object with all decoded claims. See Offline Verification for the full field reference.