You can curate your public collection's developer experience for your API consumers by setting up authentication and authorization, variables and environments, and scripts and tests.
A collection with a great developer experience invites your API consumers to fork and use your APIs. It also gets them to their first 200 OK response in the fewest steps as possible.
Important: Protect your sensitive data. Don't include API keys or similar data in your workspace. Use Postman Vault instead.
Postman recommends you set up Guided Auth with OAuth 2.0 for your domain. Once you set it up, and an API consumer uses an endpoint on your domain, Postman will prompt them to authenticate through Guided Auth. This is the fastest way to authenticate and creates the best developer experience for your API consumers.
If needed, Postman supports a variety of authorization types, which you can also set up for your users.
To learn more, see API authentication and authorization in Postman.
From the Postman header, select Team > Team Settings and then Guided Auth. Enter a name for your API, its base URL, and select OAuth 2.0. You must verify your domain and enter your API's authentication and authorization details.
You can also select one of the other authorization types.
To learn more, see Set up Guided Auth for public APIs in Postman.
If you're not ready to set up Guided Auth, you can set up authorization for your collection. All requests in the collection inherit the authorization details you set up.
Open your collection's Authorization tab and select an Auth Type. Enter your API's authorization details. When your API consumers fork your collection, they'll complete the remainder of the details.
To learn more, see Add API authorization details to requests in Postman.
You can create variables in your workspace to improve the developer experience for your API consumers. For example, you can create a variable for an API consumer's API key and use the variable throughout your requests. An API consumer can later update the variable's value with their API key in one place.
You can set up variables for different scopes, such as your collection or an environment.
Note: API consumers can't fork your global variables. Don't use them in your public workspace. Use collection and environment variables instead.
To learn more, see Reuse data with variables and environments in Postman.
To create a collection variable, open your collection's Variables tab. Then, select Add new variable.
To learn more, see Store and reuse values using variables.
An environment is a set of variables specific to a context. For example, you can create two environments, one for your sandbox environment and one for production. Then, you can create variables where you expect the value to be different for each environment, such as an API key. When your API consumer switches environments, the value switches for them.
To create an environment, from the Postman sidebar, select Environments. Then, select
Create new environment. To create an environment variable, select Add new variable.
To learn more, see Group sets of variables in Postman using environments.
If an API consumer forks your collection and you've pinned an environment to it, by default, the API consumer also forks your pinned environment.
To pin your environment to your collection, open your collection. From the Postman workbench, select the environment selector. Then, hover over the environment and select Pin to collection. Repeat for each collection and environment combination.
To learn more, see Pin environments to collections.
You can use pre-request and post-response scripts to enhance your API consumer's developer experience. You can write scripts to automate tasks, transform data, add conditional logic, and give your API consumers immediate feedback, such as how to address errors.
For example, you can write a script that formats dates to the API's expected format, or validates whether a response's key-value pair is present. If your API uses access tokens, you can write a script that takes the token from a response and uses it in later requests.
To learn more, see Test APIs and write scripts in Postman.
Open a request, folder, or collection and select the Scripts tab. Then, select Pre-request or Post-response and write your script.
To learn more, see Use scripts to add logic and tests to Postman requests.
Last modified: 2025/03/28