Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.grantex.dev/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Machine Payments Protocol (MPP) defines how AI agents pay for services via HTTP 402 flows and streaming sessions. MPP solves payment mechanics but has a structural gap: no identity layer. When an agent makes an MPP payment, the source field is a wallet address — no human name, no organization, no authorization chain. For low-value API calls this is fine. For B2B procurement and regulated transactions, it’s a compliance blocker. Grantex fills this gap with the AgentPassportCredential — a W3C VC 2.0 credential that binds agent identity, human delegation, spending limits, and payment categories into a single offline-verifiable document.
The @grantex/mpp package provides both agent-side middleware (attach passports to outgoing requests) and merchant-side verification (validate passports on incoming requests) in a single package.

How It Works

┌──────────────────────────────────────────────────────────────────┐
│  1. Human issues AgentPassportCredential via Grantex             │
│     → W3C VC 2.0 with Ed25519 proof, StatusList2021 revocation  │
│     → Contains: agentDID, humanDID, orgDID, categories, limits  │
└─────────────────────────┬────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────┐
│  2. Agent makes MPP request to merchant                          │
│     → Authorization: Payment <mpp-token>                         │
│     → X-Grantex-Passport: <base64url-encoded-vc>                │
└─────────────────────────┬────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────┐
│  3. Merchant verifies passport in <50ms (offline-capable)        │
│     → Checks signature, expiry, categories, amount limits        │
│     → Returns VerifiedPassport with full identity chain           │
└─────────────────────────┬────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────┐
│  4. Merchant fulfills request — knows exactly who authorized it  │
│     → Audit entry: passportId, agentDID, humanDID, amount        │
└──────────────────────────────────────────────────────────────────┘

AgentPassportCredential Structure

The credential follows the W3C Verifiable Credentials Data Model v2.0:
FieldTypeDescription
@contextstring[]["https://www.w3.org/ns/credentials/v2", "https://grantex.dev/contexts/mpp/v1"]
typestring[]["VerifiableCredential", "AgentPassportCredential"]
idstringurn:grantex:passport:<ulid>
issuerstringdid:web:grantex.dev
validFromstringISO 8601 issuance timestamp
validUntilstringISO 8601 expiry (max 30 days)
credentialSubject.idstringAgent DID (did:grantex:ag_...)
credentialSubject.humanPrincipalstringDID of the authorizing human
credentialSubject.organizationDIDstringOrg DID (did:web:<domain>)
credentialSubject.grantIdstringUnderlying Grantex grant ID
credentialSubject.allowedMPPCategoriesstring[]Permitted MPP service categories
credentialSubject.maxTransactionAmountobject{ amount: number, currency: string }
credentialSubject.paymentRailsstring[]Payment networks (e.g., ["tempo"])
credentialSubject.delegationDepthnumberFrom grant delegation chain
credentialStatusobjectStatusList2021 revocation entry
proofobjectEd25519Signature2020

MPP Category Scopes

Each MPP category maps to a Grantex scope. The agent’s grant must include the corresponding scope:
MPP CategoryGrantex Scope
inferencepayments:mpp:inference
computepayments:mpp:compute
datapayments:mpp:data
storagepayments:mpp:storage
searchpayments:mpp:search
mediapayments:mpp:media
deliverypayments:mpp:delivery
browserpayments:mpp:browser
generalpayments:mpp:general

Trust Registry

The trust registry is a public endpoint that maps organization DIDs to verified trust records:
curl https://api.grantex.dev/v1/trust-registry/did:web:grantex.dev
{
  "organizationDID": "did:web:grantex.dev",
  "verifiedAt": "2026-03-20T03:11:31.447Z",
  "verificationMethod": "soc2",
  "trustLevel": "soc2",
  "domains": ["grantex.dev"]
}
Trust levels: basic (self-declared), verified (DNS-TXT proof), soc2 (SOC 2 audit verified).

Verification Error Codes

CodeDescription
PASSPORT_EXPIREDCredential validUntil has passed
PASSPORT_REVOKEDStatusList2021 bit is set
INVALID_SIGNATUREEd25519/RS256 signature verification failed
UNTRUSTED_ISSUERIssuer DID not in the trusted issuers list
CATEGORY_MISMATCHPassport categories don’t cover the required service
AMOUNT_EXCEEDEDPassport max amount below required threshold
MISSING_PASSPORTNo X-Grantex-Passport header provided
MALFORMED_CREDENTIALInvalid base64url encoding or missing VC fields

API Endpoints

MethodEndpointAuthDescription
POST/v1/passport/issueAPI keyIssue an AgentPassportCredential
GET/v1/passport/:idAPI keyRetrieve passport by ID
POST/v1/passport/:id/revokeAPI keyRevoke passport (flips StatusList2021 bit)
GET/v1/trust-registry/:orgDIDNoneLook up org trust record (public)
GET/v1/trust-registryAPI keyList all trust records (admin)

SDK Support

The PassportsClient / PassportsService is available across all three SDKs:
SDKAccessSince
TypeScript (@grantex/sdk)client.passports.issue(...)0.3.3
Python (grantex)client.passports.issue(...)0.3.3
Go (grantex-go)client.Passports.Issue(ctx, ...)0.1.3

Next Steps