Skip to main content

Get

grant, err := client.Grants.Get(ctx, "grant-id")

List

result, err := client.Grants.List(ctx, &grantex.ListGrantsParams{
    AgentID: "agent-id",
    Status:  "active",
})
for _, g := range result.Grants {
    fmt.Printf("%s: %v\n", g.ID, g.Scopes)
}
Pass nil for no filters.

Revoke

err := client.Grants.Revoke(ctx, "grant-id")

Delegate

Create a delegated grant for a sub-agent with a subset of the parent grant’s scopes.
resp, err := client.Grants.Delegate(ctx, grantex.DelegateParams{
    ParentGrantToken: "parent-jwt-token",
    SubAgentID:       "sub-agent-id",
    Scopes:           []string{"read:email"},
    ExpiresIn:        "1h",
})
fmt.Printf("Delegated token: %s\n", resp.GrantToken)

Types

Grant

FieldTypeDescription
IDstringGrant ID
AgentIDstringAgent ID
AgentDIDstringAgent DID
PrincipalIDstringUser ID
DeveloperIDstringDeveloper ID
Scopes[]stringGranted scopes
Statusstring"active", "revoked", "expired"
IssuedAtstringISO 8601 timestamp
ExpiresAtstringISO 8601 timestamp
RevokedAt*stringISO 8601 timestamp (if revoked)

DelegateResponse

FieldTypeDescription
GrantTokenstringDelegated JWT
ExpiresAtstringISO 8601 expiry
Scopes[]stringDelegated scopes
GrantIDstringNew grant ID