> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentcard.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Postman collection

> Run the entire v2 API from your machine — download, set two variables, and go.

A ready-made Postman collection that runs all three v2 flows end to end —
connect, KYC, and wallet funding. Each request captures what the next one
needs — the platform token, the connect id, the user id, the funding session
id — so you can run them top to bottom without copy-pasting.

<CardGroup cols={2}>
  <Card title="Download collection" icon="download" href="/assets/agentcard-v2.postman_collection.json">
    agentcard-v2.postman\_collection.json
  </Card>

  <Card title="Download environment" icon="download" href="/assets/agentcard-v2.postman_environment.json">
    agentcard-v2.postman\_environment.json
  </Card>
</CardGroup>

## Set it up

<Steps>
  <Step title="Import both files">
    In Postman, **Import** → drop in the collection and the environment.
  </Step>

  <Step title="Select the environment">
    Pick **Agentcard v2** in the environment dropdown (top right).
  </Step>

  <Step title="Add your credentials">
    Set `client_id` and `client_secret` on the environment to your Agentcard
    credentials. A sandbox client runs in sandbox; a production client runs in
    production.
  </Step>

  <Step title="Get a token">
    Run **Get platform token** once. It captures `access_token`, which every
    other request reuses automatically.
  </Step>
</Steps>

## Run the flows

**Connect** — run in order:

1. **Start (email)** — sends the code, saves `connect_id`.
2. **Verify** — set `verify_code` to the code the user got, then run. Saves
   `user_id` and the connection tokens.
3. **Consent** — records the authorization.
4. **Refresh** — rotates the connection token.

<Note>
  In sandbox the code is always `111111` — the environment ships with
  `verify_code` preset to it, so **Verify** works with no change.
</Note>

**KYC** — set `id_image_base64` on the environment to a base64-encoded ID image,
then run **Upload front** → **Upload back**. Follow the status the back upload
returns: submit **Submit information** if it asks, then poll **Get status**.

**Wallet funding** — run in order (needs a connected `user_id` from the Connect
flow):

1. **Start phone verification** — sends the funding code. Skip 1–2 if the
   response is `already_verified`.
2. **Verify the phone code** — set `verify_code` to the code the user got.
3. **Create funding session** — returns the Apple Pay / Google Pay
   `checkout_url` (logged to the console) and saves `funding_session_id`.
4. **Get funding session** — poll until `status` is `completed`.
5. **Get wallet** — the balance reflects the deposit.

## Run it headless

Test the whole thing from the command line with
[Newman](https://github.com/postmanlabs/newman), Postman's runner:

```bash theme={null}
npm install -g newman

newman run agentcard-v2.postman_collection.json \
  -e agentcard-v2.postman_environment.json \
  --folder "Connect — user authentication"
```

## Variables

| Variable                                                                      | Set it?        | What it is                                                           |
| ----------------------------------------------------------------------------- | -------------- | -------------------------------------------------------------------- |
| `base_url`                                                                    | Preset         | `https://api.agentcard.sh`. Change only if you're pointed elsewhere. |
| `client_id`                                                                   | **You**        | Your Agentcard client id.                                            |
| `client_secret`                                                               | **You**        | Your Agentcard client secret.                                        |
| `user_email` / `user_phone`                                                   | **You**        | The user to connect.                                                 |
| `verify_code`                                                                 | Sandbox preset | The code the user entered (`111111` in sandbox).                     |
| `id_image_base64`                                                             | **You**        | Base64 ID image for the KYC flow.                                    |
| `access_token`, `connect_id`, `user_id`, `connection_*`, `funding_session_id` | Captured       | Filled in automatically as you run the requests.                     |
