API Design

Postman Collection JSON Example

A real-world JSON example of a Postman Collection v2.1 — folders, requests, and variables. Copy-ready for understanding the collection format or generating one programmatically.

{
  "info": {
    "_postman_id": "8f3a2b1c-4d5e-6f70-8a9b-0c1d2e3f4a5b",
    "name": "JSONKit API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Users",
      "item": [
        {
          "name": "Get User",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{accessToken}}"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/users/:id",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "users",
                ":id"
              ],
              "variable": [
                {
                  "key": "id",
                  "value": "usr_9k2mXpQr4t"
                }
              ]
            }
          }
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.example.com/v1"
    },
    {
      "key": "accessToken",
      "value": ""
    }
  ]
}

Field Reference

info._postman_idrequiredstringA unique UUID identifying this collection — regenerated when a collection is duplicated, not when it's exported/imported
itemrequiredarrayNested tree of folders and requests — an item with its own item array is a folder; one with a request object is an actual API call
request.url.variableoptionalarrayPath variables (like :id) declared separately from the raw URL string, so Postman can render them as editable fields
variableoptionalarrayCollection-level variables (like {{baseUrl}}) usable in any request within the collection via double-curly syntax

Variants

With a Test ScriptRequests can carry pm.test() assertions that run automatically after the response arrives.
{
  "name": "Get User",
  "request": {
    "method": "GET",
    "url": "{{baseUrl}}/users/usr_9k2mXpQr4t"
  },
  "event": [
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "pm.test('Status is 200', () => pm.response.to.have.status(200));"
        ]
      }
    }
  ]
}

Common Use Cases

  • Generating a Postman collection programmatically from an OpenAPI spec or route list
  • Understanding the collection JSON format to build a custom import/export tool
  • Sharing a versioned, git-trackable API test suite instead of Postman's cloud sync
postmanapi testingcollectionRESTdeveloper tools

Validate or format this JSON

One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.

Frequently Asked Questions

Collection variables (shown here) travel with the collection file itself and are the same for anyone who imports it; environment variables live in a separate Postman Environment file and let the same collection run against different base URLs (dev/staging/prod) without editing the collection.

Yes — if you already have an OpenAPI/Swagger spec, Postman can import it directly and generate a collection with one request per documented endpoint, which is usually far less work than hand-building one from scratch.

Folders let you organize by resource or workflow (Users, Orders, Auth) and also allow folder-level settings — like a shared auth header or a pre-request script — to apply to every request inside without repeating it.

Related JSON Examples