{
  "info": {
    "name": "TOKOPAY Public API",
    "_postman_id": "b1f0c0de-0000-4a00-9000-tokopaydocs01",
    "description": "Official Postman collection for the TOKOPAY public API — the endpoints documented at /docs.\n\nAUTH\nSend your tenant API key (ws_live_...) as `Authorization: Bearer <key>` (applied automatically by this collection from the {{apiKey}} variable). The key is also accepted via the `X-API-Key: <key>` header.\n\nGETTING STARTED\n1. Set the `baseUrl` variable to your deployment host.\n2. Put your key in the `apiKey` variable.\n3. Run 'Networks & tokens > List networks', then 'Users > Create user', then 'Wallets > Create wallet' — ids are captured into variables automatically so the rest of the requests just work.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{apiKey}}", "type": "string" }]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.tokopay.io", "description": "Your deployment host (e.g. http://localhost:3000)" },
    { "key": "apiKey", "value": "ws_live_REPLACE_ME", "description": "Tenant API key (ws_live_...)" },
    { "key": "userId", "value": "", "description": "Captured from Create user" },
    { "key": "walletId", "value": "", "description": "Captured from Create wallet" },
    { "key": "networkId", "value": "", "description": "Captured from List networks" },
    { "key": "tokenId", "value": "", "description": "Captured from List tokens" },
    { "key": "contract", "value": "0x0000000000000000000000000000000000000000", "description": "Token / NFT contract address" },
    { "key": "toAddress", "value": "0x000000000000000000000000000000000000dEaD", "description": "Recipient address" },
    { "key": "tenantSlug", "value": "your-slug" }
  ],
  "item": [
    {
      "name": "Users",
      "item": [
        {
          "name": "Create user",
          "event": [
            { "listen": "test", "script": { "type": "text/javascript", "exec": [
              "const j = pm.response.json();",
              "if (j.id) pm.collectionVariables.set('userId', j.id);",
              "pm.test('201 created', () => pm.response.code === 201);"
            ] } }
          ],
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"externalId\": \"your-user-123\",\n  \"label\": \"alice@app.com\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/users", "host": ["{{baseUrl}}"], "path": ["api","v1","users"] },
            "description": "Provision an end user. A unique encrypted HD seed is generated automatically. Requires Write permission."
          }
        },
        {
          "name": "List users",
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/api/v1/users", "host": ["{{baseUrl}}"], "path": ["api","v1","users"] },
            "description": "List your end users. Requires Read permission."
          }
        }
      ]
    },
    {
      "name": "Networks & tokens",
      "item": [
        {
          "name": "List networks",
          "event": [
            { "listen": "test", "script": { "type": "text/javascript", "exec": [
              "const j = pm.response.json();",
              "if (j.networks && j.networks.length) pm.collectionVariables.set('networkId', j.networks[0].id);",
              "pm.test('200 OK', () => pm.response.code === 200);"
            ] } }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": { "raw": "{{baseUrl}}/api/v1/networks", "host": ["{{baseUrl}}"], "path": ["api","v1","networks"] },
            "description": "Enabled chains you can derive wallets on. Use a network id when creating wallets."
          }
        },
        {
          "name": "List tokens",
          "event": [
            { "listen": "test", "script": { "type": "text/javascript", "exec": [
              "const j = pm.response.json();",
              "if (j.tokens && j.tokens.length) pm.collectionVariables.set('tokenId', j.tokens[0].id);"
            ] } }
          ],
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/tokens?network={{networkId}}",
              "host": ["{{baseUrl}}"], "path": ["api","v1","tokens"],
              "query": [{ "key": "network", "value": "{{networkId}}", "description": "Chain id, chain key, or EVM numeric chainId" }]
            },
            "description": "Registry tokens available for transfers on a network."
          }
        }
      ]
    },
    {
      "name": "Wallets",
      "item": [
        {
          "name": "Create wallet",
          "event": [
            { "listen": "test", "script": { "type": "text/javascript", "exec": [
              "const j = pm.response.json();",
              "if (j.wallet && j.wallet.id) pm.collectionVariables.set('walletId', j.wallet.id);",
              "pm.test('201 created', () => pm.response.code === 201);"
            ] } }
          ],
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"userId\": \"{{userId}}\",\n  \"chainId\": \"{{networkId}}\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets", "host": ["{{baseUrl}}"], "path": ["api","v1","wallets"] },
            "description": "Derive an address for a user on a chain (EVM or Solana). Requires Write permission."
          }
        },
        {
          "name": "List wallets",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/wallets?userId={{userId}}",
              "host": ["{{baseUrl}}"], "path": ["api","v1","wallets"],
              "query": [{ "key": "userId", "value": "{{userId}}" }]
            },
            "description": "List wallets, optionally filtered by user. Requires Read permission."
          }
        },
        {
          "name": "Native balance",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/wallets/balance?walletId={{walletId}}",
              "host": ["{{baseUrl}}"], "path": ["api","v1","wallets","balance"],
              "query": [{ "key": "walletId", "value": "{{walletId}}" }]
            },
            "description": "Native coin balance for a wallet."
          }
        },
        {
          "name": "Token balance",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/wallets/token-balance?walletId={{walletId}}&contract={{contract}}",
              "host": ["{{baseUrl}}"], "path": ["api","v1","wallets","token-balance"],
              "query": [
                { "key": "walletId", "value": "{{walletId}}" },
                { "key": "contract", "value": "{{contract}}", "description": "ERC-20 contract (EVM)" }
              ]
            },
            "description": "ERC-20 / SPL token balance."
          }
        }
      ]
    },
    {
      "name": "Transactions",
      "item": [
        {
          "name": "Send native",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"walletId\": \"{{walletId}}\",\n  \"to\": \"{{toAddress}}\",\n  \"amount\": \"0.01\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets/send", "host": ["{{baseUrl}}"], "path": ["api","v1","wallets","send"] },
            "description": "Send native coin. Response includes the transaction hash. Requires Write permission."
          }
        },
        {
          "name": "Transfer token",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"walletId\": \"{{walletId}}\",\n  \"to\": \"{{toAddress}}\",\n  \"amount\": \"1.5\",\n  \"tokenId\": \"{{tokenId}}\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets/transfer-token", "host": ["{{baseUrl}}"], "path": ["api","v1","wallets","transfer-token"] },
            "description": "Transfer ERC-20 / SPL. Use tokenId (listed) or contract+decimals (custom EVM) / mint (custom Solana). Requires Write permission."
          }
        },
        {
          "name": "Transfer NFT",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"walletId\": \"{{walletId}}\",\n  \"to\": \"{{toAddress}}\",\n  \"contract\": \"{{contract}}\",\n  \"tokenId\": \"1\",\n  \"standard\": \"ERC721\"\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets/transfer-nft", "host": ["{{baseUrl}}"], "path": ["api","v1","wallets","transfer-nft"] },
            "description": "Transfer ERC-721 / ERC-1155. Requires Write permission."
          }
        },
        {
          "name": "Contract call",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": { "mode": "raw", "raw": "{\n  \"walletId\": \"{{walletId}}\",\n  \"to\": \"{{contract}}\",\n  \"abi\": [\"function mint(address,uint256)\"],\n  \"method\": \"mint\",\n  \"args\": [\"{{toAddress}}\", 1]\n}" },
            "url": { "raw": "{{baseUrl}}/api/v1/wallets/contract-call", "host": ["{{baseUrl}}"], "path": ["api","v1","wallets","contract-call"] },
            "description": "Arbitrary contract call. Requires Contract permission AND the tenant raw-contract feature."
          }
        },
        {
          "name": "List transactions",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/transactions?limit=50",
              "host": ["{{baseUrl}}"], "path": ["api","v1","transactions"],
              "query": [
                { "key": "limit", "value": "50" },
                { "key": "walletId", "value": "{{walletId}}", "disabled": true }
              ]
            },
            "description": "Recent transactions with hash + status. Requires Read permission."
          }
        }
      ]
    },
    {
      "name": "Per-user sign-in (Google)",
      "item": [
        {
          "name": "Start Google sign-in",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/auth/google?tenant={{tenantSlug}}",
              "host": ["{{baseUrl}}"], "path": ["api","auth","google"],
              "query": [{ "key": "tenant", "value": "{{tenantSlug}}" }]
            },
            "description": "Browser redirect flow. Send your users here; on return they are provisioned with a seed and a login is recorded. Best opened in a browser rather than Postman."
          }
        }
      ]
    }
  ]
}
