> For the complete documentation index, see [llms.txt](https://docs.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alternativepayments.io/getting-started/3rd-party-tools/rewst.md).

# Rewst

Many MSPs use **Rewst** to automate workflows across PSA tools, billing systems, and third-party platforms. To enable automated invoice payments and customer operations via **Alternative Payments**, you’ll need to authenticate and interact with our API directly through Rewst using HTTP Request blocks.

This guide walks you through how to **authenticate with the Alternative Payments API** inside Rewst, so you can securely trigger additional API calls from your workflows.

<figure><img src="/files/xrDrHPlcFHTSWZunjqCU" alt=""><figcaption></figcaption></figure>

***

## :notebook\_with\_decorative\_cover:How It Works

Rewst supports HTTP requests through its workflow automation engine, allowing you to interact directly with external APIs like Alternative Payments.

To integrate with our API:

* **Authenticate using OAuth 2.0:** This authentication method is used to obtain secure, server-to-server access without user interaction.
* **Obtain an access token:** Upon successful authentication, the API returns an `access_token` that is valid for a limited time.
* **Authorize future requests:** Use this token in the `Authorization` header (`Bearer` format) to securely access other endpoints.
* **Follow standard REST practices:** All API interactions are based on REST conventions, using JSON payloads, HTTP methods, and header-based authentication.

***

## :sparkles:Step-by-Step### :closed\_lock\_with\_key: Step 1: Authenticate using HTTP Request Block

1. In your **Rewst workflow**, click **+** to add a new **HTTP Request** block.
2. Set **Request method** to `POST`.
3. Set **URL** to:

<table><thead><tr><th width="180.22222900390625">Environment</th><th>URL</th></tr></thead><tbody><tr><td><strong>Demo</strong></td><td><code>https://public-api.demo.alternativepayments.io/oauth/token</code></td></tr><tr><td><strong>Production</strong></td><td><code>https://public-api.alternativepayments.io/oauth/token</code></td></tr></tbody></table>

<figure><img src="/files/5npkj9PS8qDVIq0jrBsW" alt=""><figcaption></figcaption></figure>

\
In the **Body** section, use:

```
grant_type=client_credentials
```

<figure><img src="/files/nDN1CsI1HG2MG3jlEuyd" alt=""><figcaption></figcaption></figure>

Set the following **Headers**:

<table><thead><tr><th width="159.77783203125">Header</th><th>Value</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td><code>application/x-www-form-urlencoded</code></td></tr><tr><td><code>Authorization</code></td><td><code>Basic </code><strong><code>your_base64_credentials</code></strong></td></tr></tbody></table>

<figure><img src="/files/2vnJx0Q9OhLzrQvroLEn" alt=""><figcaption></figcaption></figure>

#### :key: Base64 Credentials

To generate the **base64** credentials:

* Format your credentials as `clientId:clientSecret`

  <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>You can find your <code>clientId</code> and <code>clientSecret</code> in the <strong>Partner Dashboard</strong> under the <a data-mention href="/pages/6sbv7bokaxdRfklInL3v">/pages/6sbv7bokaxdRfklInL3v</a> section.</p></div>
* Go to [https://www.base64encode.org](https://www.base64encode.org/).
* Paste the string and click **Encode**.\\

**Example**

<figure><img src="/files/bkIHTkrOYfXpqPhkHLpg" alt=""><figcaption></figcaption></figure>

Copy the result:

<figure><img src="/files/NDHy8I3B1nrYbx8qs8uT" alt=""><figcaption></figcaption></figure>

and paste it in the Authorization header as:

```
Basic base64_encoded_value
```

***

### 🧪 Step 3: Test the Request

1. Click **Test** in the HTTP Request block.
2. Then click **View Result**.

✅ If successful, you will receive a JSON response containing:

<pre class="language-json"><code class="lang-json"><strong>{
</strong>  "access_token": "xxxxx",
  "token_type": "Bearer",
  ...
}
</code></pre>

Copy the `access_token`.

***

### 🔁 Step 4: Use the Token in Future Requests

For any additional API calls (e.g., Listing customers, fetching invoices), include Authorization as a header:

```
Authorization: Bearer access_token
```

<figure><img src="/files/fxx9UNFFjg0LjSufGO2V" alt=""><figcaption></figcaption></figure>

#### **📌 Example endpoint:**

**Request**

```
GET https://public-api.demo.alternativepayments.io/customers
```

**Response**

<figure><img src="/files/P8YGW9PQHLIX8QUcBi6Y" alt=""><figcaption></figcaption></figure>

***

## :map:Flow

<figure><img src="/files/kqtIcoNGK8eis9QkHBuX" alt=""><figcaption></figcaption></figure>


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alternativepayments.io/getting-started/3rd-party-tools/rewst.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
