Create a Run in Postman button

Create a Run in Postman button to instantly bring your Postman collections into your user's environment. The Run in Postman button Run in Postman button enables users to fork collections. You can embed the button in your website or a README to let developers interact with your API more quickly.

You can create the Run in Postman button from API specification formats like OpenAPI and RAML. First, convert the file to a collection by importing it into Postman or by generating a collection from your API.

Create a Run in Postman button

To enable sharing, creating the Run in Postman button requires that your collection is located in a public workspace. If the collection is present in a public workspace, you can directly embed the copied code where you would like the button to display. If the collection is present in a team or a personal workspace, share the collection to a public workspace to create the Run in Postman button.

To create the button, do the following:

  1. Select Collections in the sidebar and select the collection you want to share.

  2. Select Share icon Share.

  3. Select the Via Run in Postman tab.

  4. Choose a live or static button:

    • Live button - This button uses JavaScript, HTML, and CSS, so you can customize the button for a website. You can also access the Run in Postman API to dynamically create and update environments.

    To create a live button, you need to share the collection to a public workspace. If you don't have a public workspace to share to, you can create a new one using the modal. For users on Enterprise plans, you need to have a Community Manager role to create a new public workspace.

    • Static button - This button uses Markdown, so you can display it in a README, blog, or other Markdown document.
  5. You can optionally include an environment to embed with your collection. Select the Add an environment dropdown list and choose the environment.

  6. Select Copy icon Copy Code.

    Create a Run in Postman button modal

    Your embed code will include your collection's ID. In the examples below, :collection_id is a placeholder for that ID and :collection_url is a placeholder for url. If you choose to include an environment in your button, the code will also have the environment parameter.

  7. Embed the code where you would like the button to display.

    Run in Postman

Sample code snippets for the Run in Postman button

The following is an example of code to embed in Markdown format.

[<img src="https://run.pstmn.io/button.svg" alt="Run In Postman" style="width: 128px; height: 32px;">](https://god.gw.postman.com/run-collection/:collection_id)

The following is an example of code to embed in HTML format.

<div class="postman-run-button"
data-postman-action="collection/fork"
data-postman-var-1=":collection_id"
data-postman-collection-url=":collection_url"></div>
<script type="text/javascript">
  (function (p,o,s,t,m,a,n) {
    !p[s] && (p[s] = function () { (p[t] || (p[t] = [])).push(arguments); });
    !o.getElementById(s+t) && o.getElementsByTagName("head")[0].appendChild((
      (n = o.createElement("script")),
      (n.id = s+t), (n.async = 1), (n.src = m), n
    ));
  }(window, document, "_pm", "PostmanRunObject", "https://run.pstmn.io/button.js"));
</script>

Use a Run in Postman button

Select the Run in Postman button to open the page where you can fork the collection to your workspace. Forking the collection into your workspace will enable you to contribute to the source collection using pull requests. You can also view the collection in a public workspace if you like and even import a copy of the collection using the links present on the screen. All collections shared with the new Run in Postman buttons come with fork counts, that help you and your consumers understand how developers use the API.

Fork collection for run in postman

Live Run in Postman buttons are automatically updated with changes in the original collection, so your consumers always get the most recent version of your collection without publishers having to manually update the collection's link.

Last modified: 2024/05/07