Postman · APIsbeginner

Postman Collection (v2.1)

A Postman Collection v2.1 with a variable-driven base URL, bearer auth and two example requests — ready to import and run.

postmanapicollectionhttptesting

Preview

{
  "info": {
    "name": "Example API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.example.com/v1"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{authToken}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "List items",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{baseUrl}}/items",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "items"
          ]
        }
      }
    },
    {
      "name": "Create item",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"Widget\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/items",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "items"
          ]
        }
      }
    }
  ]
}

AI actions

Documentation

Purpose

Group related HTTP requests with shared variables and auth so a team can import and run an API in seconds.

When to use

Sharing an API with teammates, building a smoke-test suite, or documenting request/response examples.

Required fields

  • info — collection name and the v2.1 schema URL
  • item — the array of requests (or folders of requests)

Optional fields

  • variable — collection-level variables like {{baseUrl}}
  • auth — shared authentication for all requests
  • event — pre-request and test scripts

Best practices

  • Drive hostnames through {{baseUrl}} so environments swap cleanly.
  • Set auth at the collection level and inherit it per request.
  • Add test scripts to assert status codes and response shape.

Security considerations

  • Store tokens in Postman environment variables, not in the collection JSON.
  • Never commit a collection containing real bearer tokens to git.