Tech / Dev

Postman Collection Example

Generate a Postman v2.1 collection with full CRUD (GET list, GET one, POST, PUT, DELETE) ready to import.

Instant🔒In your browserNo signup
Live

What is a Postman collection?

A Postman collection is a group of organized requests you can run individually, in sequence, or from CI with Newman. It's the most widely used format for sharing APIs internally and for QA teams to build regression suites without touching code.

Variables and environments

Use variables like {{baseUrl}} and {{token}} instead of hardcoding. Then define a "dev" environment with baseUrl=https://api-dev... and a "prod" with the real URL. Switching is a click. Variables you don't want to commit (passwords) go as empty "Initial Value" and local "Current Value".

JSON structure

v2.1 has info, item (requests or folders), variable and auth. Each request defines method, URL, headers and body. Folders group by feature: /users, /orders, /auth.

Automated tests

In the Tests tab you can write JS: pm.test("status 200", function() { pm.response.to.have.status(200); });. Postman runs the script after every request. Combined with Newman, it gives you an executable integration suite from GitHub Actions.

Auth: bearer, basic, OAuth2

Configure auth at the collection or request level. For JWT, use Bearer Token with the {{token}} variable. For OAuth2, Postman has a wizard that fetches the token and stores it in a variable. For Basic, Postman base64-encodes automatically.

Pre-request scripts

Useful for refreshing tokens, generating dynamic payloads or setting timestamps. For example, on a POST, generate a body with a fresh UUID each time: pm.environment.set("orderId", crypto.randomUUID());.

Newman: the collection in CI

Newman is Postman's CLI runner. newman run my-collection.json -e dev.json runs the full collection and reports results. In GitHub Actions or GitLab CI, this gives you smoke tests against staging on every deploy.

Documentation from the collection

Postman auto-generates public documentation from the collection. Describe each request in the Description field and add response examples. External teams hit a URL with every endpoint and can try them inline.

FAQ

How do I import the collection?

File > Import > Raw text, paste the JSON, and it's created automatically.

What is v2.1?

The current Postman format, supporting variables, scripts and auth.

Insomnia or Bruno?

Both import v2.1 with minor script adjustments.

Was this generator useful?