Skip to main content

Overview

The Passports service manages AgentPassportCredentials — W3C VC 2.0 credentials that bind agent identity, human delegation, and spending limits for machine payment flows.

Issue

Issue a new AgentPassportCredential for an agent with an active grant.
passport, err := client.Passports.Issue(ctx, grantex.IssuePassportParams{
    AgentID:              "ag_01HXYZ...",
    GrantID:              "grnt_01HXYZ...",
    AllowedMPPCategories: []string{"inference", "compute"},
    MaxTransactionAmount: grantex.TransactionAmount{Amount: 50, Currency: "USDC"},
    PaymentRails:         []string{"tempo"},
    ExpiresIn:            "24h",
})
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Passport ID: %s\n", passport.PassportID)
fmt.Printf("Encoded: %s\n", passport.EncodedCredential)
fmt.Printf("Expires: %s\n", passport.ExpiresAt)

Parameters

ParameterTypeRequiredDescription
AgentIDstringYesGrantex agent ID (ag_...).
GrantIDstringYesActive grant ID (grnt_...).
AllowedMPPCategories[]stringYesMPP categories: inference, compute, data, etc.
MaxTransactionAmountTransactionAmountYesMax per-transaction amount with currency.
PaymentRails[]stringNoPayment networks (default: ["tempo"]).
ExpiresInstringNoExpiry duration (e.g., "24h"). Max: "720h".
ParentPassportIDstringNoParent passport ID for delegated sub-agent passports.

Response (IssuedPassportResponse)

FieldTypeDescription
PassportIDstringurn:grantex:passport:<ulid>
Credentialmap[string]interface{}Full AgentPassportCredential JSON.
EncodedCredentialstringBase64url-encoded credential for headers.
ExpiresAtstringISO 8601 expiry timestamp.

Errors

CodeHTTPCause
INVALID_AGENT400Agent not found or not owned by developer.
INVALID_GRANT400Grant not found, revoked, or not owned by agent.
SCOPE_INSUFFICIENT400Grant missing required payments:mpp:* scopes.
AMOUNT_EXCEEDS_BUDGET400Max amount exceeds remaining budget allocation.
INVALID_EXPIRY422Expiry exceeds 720 hours.

Get

Retrieve a passport by ID. Returns the current status.
record, err := client.Passports.Get(ctx, "urn:grantex:passport:01HXYZ...")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Status: %s\n", record.Status) // "active" | "revoked" | "expired"

Parameters

ParameterTypeRequiredDescription
passportIDstringYesThe passport URN identifier.

Response (GetPassportResponse)

FieldTypeDescription
StatusstringCurrent status: active, revoked, or expired.

Revoke

Revoke a passport immediately. Flips the StatusList2021 bit so offline verifiers see the revocation.
result, err := client.Passports.Revoke(ctx, "urn:grantex:passport:01HXYZ...")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Revoked: %v\n", result.Revoked)     // true
fmt.Printf("Revoked at: %s\n", result.RevokedAt) // "2026-03-20T03:14:15.261Z"

Parameters

ParameterTypeRequiredDescription
passportIDstringYesThe passport URN identifier.

Response (RevokePassportResponse)

FieldTypeDescription
RevokedboolAlways true on success.
RevokedAtstringISO 8601 revocation timestamp.

List

List passports with optional filters. The API returns a bare JSON array.
passports, err := client.Passports.List(ctx, &grantex.ListPassportsParams{
    AgentID: "ag_01HXYZ...",
    Status:  "active",
})
if err != nil {
    log.Fatal(err)
}
for _, p := range passports {
    fmt.Printf("%s expires %s\n", p.PassportID, p.ExpiresAt)
}

Parameters

ParameterTypeRequiredDescription
AgentIDstringNoFilter by agent ID.
GrantIDstringNoFilter by grant ID.
StatusstringNoFilter by status: active, revoked, or expired.

Response

Returns []IssuedPassportResponse. See Issue above for the struct fields.