Organize an API collection that a team can find things in

Every shared collection starts tidy. Six months later it has 300 requests, three folders called misc, two copies of the login request, and a request named DO NOT RUN. Structure is what decides whether a new teammate can find things, and whether tests built on the collection stay maintainable.

One collection per API

A collection is the unit that gets shared, synced to Git, mocked, run and exported. One collection per API (or per service) keeps those operations meaningful: the Billing API collection runs Billing's tests, syncs to Billing's repository, and its mock server mocks Billing.

Avoid collections per person ("Ann's requests") and per sprint ("Sprint 42"): both go stale and duplicate each other.

Folders by resource

Inside, mirror how people think about the API:

Output
๐Ÿ“ Billing API
  ๐Ÿ“‚ Auth
  ๐Ÿ“‚ Customers
  ๐Ÿ“‚ Invoices
    ๐Ÿ“‚ Line items
  ๐Ÿ“‚ Payments
  ๐Ÿ“‚ Webhooks
  ๐Ÿ“‚ Workflows
    ๐Ÿ“‚ Invoice to payment
    ๐Ÿ“‚ Refund flow

Resource folders hold one request per operation. Workflows holds ordered folders that run end to end, often reusing the same endpoints with different data. The runner runs subfolders first, then requests, in order, so a workflow folder runs top to bottom.

Keep nesting shallow. Two levels is usually enough; four levels means scrolling.

Settings at the right level

SettingWhere
Auth for most requestscollection
Public endpoints (no auth)a Public folder with No auth
Admin endpoints (another token)an Admin folder with its own auth
{{baseUrl}}, tokensenvironments
API version, page sizecollection variables
Request ids, signingcollection pre-request script
"No 5xx", "JSON responses"collection Tests tab

See setting auth, variables and scripts on a collection or folder.

Names

Request names are what people search for and what CI reports print. Use verbs and outcomes: Create invoice, Get invoice, Void invoice (already paid, rejected). See naming tests so failures explain themselves.

Docs where people look

The collection's Overview says how to get started: which environment to pick, how to get a test account, who owns the API. Each request's Docs tab says what the request is for and what it changes. See documenting requests with Markdown.

Scratch requests

Everyone sends throwaway requests while debugging. Keep them out of the shared collection: a personal collection for experiments, or simply don't save them. When a scratch request turns out to be useful, move it into the right folder with a proper name.

Tests build on this structure

A clean collection makes test suites cheap: a suite can follow a whole folder, so new requests in Invoices are tested automatically, and a rule package can take "every GET" for a smoke test. A messy collection makes every suite a hand-picked list.

Keep it tidy

  • Review collection changes like code. With Git sync, they arrive as pull requests.
  • Deleted something by mistake? It's in the trash for 30 days.
  • Before a big reorganization, tell the team: moving folders changes request paths, and CLI commands that use paths ("Invoices/Get invoice") need updating.