> For the complete documentation index, see [llms.txt](https://docs.nalpeiron.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nalpeiron.com/zenmeter-docs/developers/postman-configuration.md).

# Postman Configuration

Configure Postman to send requests using the Zenmeter API.

To set up Postman, do the following:

1. Download the OpenAPI Specification document at the top of the [Zenmeter OpenAPI Description](https://api.nalpeiron.io/docs/zenmeter.html).
2. From the left navigation in the Nalpeiron Growth Platform, select **administration**.<br>

   <div align="left"><img src="broken://spaces/dIv59m1KSfB3sHCzuUZq/files/lG94iPSZTa5Iki86ceSL" alt="Select administration option"></div>
3. Select the left navigation again, and then select **API Credentials**.<br>
4. The **API Credentials** page appears. Select the **Management API** tab, and then select **Add API Client**.<br>
5. In the sidebar that appears, enter a memorable name for the **Client ID** (for example, "postman-config"), and then select **Save**, but don't close the sidebar.
6. Select **Download Postman environment configuration**. Now that you downloaded the API spec doc and the environment config doc, you perform the rest of the steps in Postman.
7. Launch Postman, and drag the API spec document you downloaded to the sidebar.<br>

   <div align="left"><img src="broken://spaces/dIv59m1KSfB3sHCzuUZq/files/9hTdMpfYRH2euEeDKb6g" alt="The file in a window, ready to be dragged to the sidebar."></div>
8. Select **OpenAPI 3.0 Specification with a Postman Collection**, and then select **Import**.<br>
9. In the sidebar, from the **Collections** area, select **Zenmeter Management API**. The screen changes, and tabs now appear in the workspace.
10. You now import your environment variables. Drag the environment configuration file you downloaded to the **Environments** area of the sidebar.

    <div align="left"><img src="broken://spaces/dIv59m1KSfB3sHCzuUZq/files/iObVSBUDwS4reUc8D9hz" alt="The file in a window, ready to be dragged to the sidebar."></div>
11. From the sidebar, in the **Environments** section, select the new environment. Several environment variables appear in the workbench, including `clientId` and `clientSecret`. Confirm that they appear.<br>

    <div align="left"><img src="broken://spaces/dIv59m1KSfB3sHCzuUZq/files/pbJAnmZeu4QGu772Anzz" alt="The environment variables."></div>
12. Use the environment selector in the toolbar to select the newly imported environment. Verify that the environment selector changed to reflect the new environment.<br>

    <div align="left"><img src="broken://spaces/dIv59m1KSfB3sHCzuUZq/files/5UVNnhHuCqLxYI5pJMrk" alt="Selecting the imported environment."></div>
13. From the sidebar, under **Collections**, select **Zenmeter Management API**.
14. From the workbench, select the **Scripts** tab, and then select **Before request**.<br>
15. Paste the following script into the text box:<br>

    ```javascript
    pm.environment.set("baseUrl", pm.environment.get("orionApiUrl"));

    var setAuthHeaders = () => {
        pm.request.headers.upsert({key: 'N-TenantId', value: pm.environment.get("tenantId") });
        pm.request.headers.upsert({key: 'Authorization', value: pm.environment.get("oauth_token") });
    };

    if (pm.environment.get("token_time") && pm.environment.get("token_time") > Date.now()) {
        setAuthHeaders();
        return;
    }

    var body = 'grant_type=client_credentials'
        + '&client_id=' + pm.environment.get("clientId")
        + '&client_secret=' + pm.environment.get("clientSecret");
    pm.sendRequest({
        url: pm.environment.get("oauth_url"),
        method: 'POST',
        header: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Accept': 'application/json'
        },
        body: {
            mode: 'raw',
            raw: body
        }
    }, function (err, res) {
        var response = res.json();
        pm.environment.set("oauth_token", 'Bearer ' + response.access_token);
        pm.environment.set("token_time", Date.now() + response.expires_in * 1000);

        setAuthHeaders();
    });
    ```
16. In the **Collections** area of the sidebar, expand **Zenmeter Management API** so that the endpoints are exposed. In the **products** folder, select **Get product list**.<br>
17. When the request appears in the workspace, select **Send**.<br>

    <div align="left"><img src="broken://spaces/dIv59m1KSfB3sHCzuUZq/files/F0kBQPgm5VBz12kDtCKD" alt="Request appears, with the beginning that needs to be edited"></div>

If everything works correctly, a 200 response appears at the bottom of your screen.

![A 200-level response appears](broken://spaces/dIv59m1KSfB3sHCzuUZq/files/5rkDPYiCxSGQb0h923yQ)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nalpeiron.com/zenmeter-docs/developers/postman-configuration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
