# Postman collection

The public [Self Agent ID Postman workspace](https://www.postman.com/self-labs/self-agent-id/overview) holds the "Self Agent ID API" collection: 44 requests with real production responses saved as examples.

## Get started (~3 min)

1. **Fork** the collection into your own workspace, so you can edit variables.
2. **Run Query → Agent details.** Expect `200` with agent 5 on Celo Sepolia: `isVerified: true`.
3. **Set `humanAddress`** on the collection's Variables tab to your wallet (it owns the agent NFT in `linked` mode).
4. **Run the Registration folder in order:**
   1. **Start a registration session (linked)** (or **(wallet-free)**, which needs no wallet).
   2. Open `deepLink` on your phone, or open `scanUrl` (a QR PNG) and scan it with the Self app. On testnet, use a [mock passport](/docs/self-enterprise/guides/using-mock-passports/).
   3. **Poll a registration** every few seconds until `stage` is `completed`. `agentId` is saved for you.
   4. **Export the generated agent key** within 30 minutes. Store it as a secret.

:::tip
Everything in **Query** and **Discovery** runs as-is: the defaults point at agent 5, a verified agent on Celo Sepolia.
:::

## Variables

Edit them on the collection's Variables tab. `chainId` and `network` must agree.

| Variable                             | Default                             | Notes                                                                               |
| ------------------------------------ | ----------------------------------- | ----------------------------------------------------------------------------------- |
| `baseUrl`                            | `https://agent-api.self.xyz`        | Point it at your own deployment if you run one                                      |
| `chainId` / `network`                | `11142220` / `testnet`              | Celo Mainnet is `42220` / `mainnet`                                                 |
| `agentId` / `agentAddress`           | `5` / agent 5's address             | `agentId` is set automatically when a poll reports `completed`                      |
| `humanAddress`                       | An example wallet                   | Set it to your wallet before a `linked` registration                                |
| `wallet` / `nullifier`               | Agent 5's address / agent 5's human | Inputs for the wallet and nullifier scans                                           |
| `registryAddress`                    | Celo Sepolia registry               | The mainnet address is in the variable's description                                |
| `sessionToken`                       | Empty                               | Set automatically from every session start and status response                      |
| `qrToken`                            | Empty                               | Set automatically from `scanUrl`                                                    |
| `ed25519Pubkey`                      | RFC 8032 test vector                | Replace with your agent's Ed25519 public key (64 hex, no `0x`)                      |
| `challengeHash` / `ed25519Signature` | Set automatically / empty           | Sign the 32 raw bytes of `challengeHash`, paste the 128-hex signature               |
| `visaTimestamp` / `visaSignature`    | `0` / empty                         | Paste the values you signed ([below](#sign-a-visa-request))                         |
| `refreshAgentId`                     | `72`                                | Agent 72 has a stored verification config, so refresh works (agent 5 returns `400`) |
| `mcpApiKey`                          | Empty                               | Only for privileged MCP tools on a deployment you run                               |

## Session tokens

- Every session start and status poll saves the newest `sessionToken` for you. Keep sending `{{sessionToken}}`.
- The token rotates on every poll. Export with the token from the poll that saw `completed`.
- Earlier tokens of the same session stay valid until they expire (30 minutes), so treat every token as a secret. Don't share a forked collection with live tokens in it.

## Folders

| Folder       | Requests                                                                                                               |
| ------------ | ---------------------------------------------------------------------------------------------------------------------- |
| Registration | Start (`linked`, `wallet-free`, `ed25519`), poll, re-fetch QR, export, Ed25519 challenge and check, QR images          |
| Lifecycle    | Deregister, identify and proof refresh: start and poll each, plus the shareable refresh link                           |
| Query        | Agent details, sybil view, proof status, strength score, agent card, agents of a wallet or a human                     |
| Visa         | Visa reads (single, batch, by wallet) and the signed writes: claim, migrate, request review                            |
| Discovery    | Root, health, discovery documents, `llms.txt`, agent cards, A2A, MCP (`initialize`, `tools/list`, `self_lookup_agent`) |

A collection-level test fails any `5xx` response.

## Sign a visa request

Postman can't sign. Make the EIP-191 signature outside Postman with the agent's key or the NFT owner's key, for example with Foundry's `cast`:

```bash
TS=$(( $(date +%s) * 1000 ))
MSG=$(printf 'Self Agent ID visa request\naction: claim\nchainId: 11142220\nagentId: 5\ntargetTier: 1\ntimestamp: %s' "$TS")
echo "$TS"
cast wallet sign --private-key "$AGENT_KEY" "$MSG"
```

Paste the timestamp into `visaTimestamp` and the signature into `visaSignature`, then send within 5 minutes. Each signature works once. The message format and limits are in [Visa writes](/docs/agent-id/rest-api/#visa-writes).

## Prefer another client?

Import [`openapi.yaml`](https://github.com/selfxyz/self-agent-id/blob/main/openapi.yaml) (OpenAPI 3.1) into Insomnia, Bruno or a client generator.

## Next

- [REST API](/docs/agent-id/rest-api/): every endpoint, field and error code
