# Public API

The REST API offers programmatic access to various features, including catalog data, self-service actions, automations, and scorecards.

## Authentication <a href="#public-api-auth" id="public-api-auth"></a>

To use the REST API, users must first generate an API key. Without this key, all access to the REST API will be denied. Users can create API access keys on the `Plugins` page.

<figure><img src="https://1179008450-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1eBCWu9rFSzq3ahnNrmL%2Fuploads%2FMeXWFYzzP8asa8gGTdeh%2Fimage.png?alt=media&#x26;token=56e7e3c8-94cc-41a6-a66f-f403485b268f" alt="public api in plugins page"><figcaption></figcaption></figure>

Once on the `Plugins` page, select *View Details* for the **Public API** plugin and you will be able to generate an API key.

<figure><img src="https://1179008450-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1eBCWu9rFSzq3ahnNrmL%2Fuploads%2Fb9tjxpucbr11w7Ujxl6O%2Fimage.png?alt=media&#x26;token=67d94c81-4e13-4798-b59b-f46d9129a409" alt="generate api key"><figcaption></figcaption></figure>

{% hint style="info" %}
Tokens created via this process are valid for a duration of 10 years.&#x20;
{% endhint %}

{% hint style="warning" %}
Users are limited to one active token at any given time. **Generating a new token will automatically deactivate any previously issued token.**\
\
If you feel the need to have more than one token valid at each time, feel free to reach out to `support@rely.io`.
{% endhint %}

These keys act as credentials for authenticating access to Rely's REST API. To authenticate, include the key in the `Authorization` header of your API request. Format it as `Bearer {your_token_here}`, as shown in the example below.

```javascript
const response = await fetch('/api/v1/legacy/users/invite', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer YOUR_TOKEN_HERE",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "John Doe",
      "email": "john.doe@rely.io"
    }),
});
const data = await response.json();
```

## Examples

To see a functional example for interacting with Rely's public API checkout our guide for "[Enhancing Deployment Visibility through GitLab Pipelines and Rely.io’s Public API](https://docs.rely.io/guides-and-tutorials/enhancing-deployment-visibility-through-gitlab-pipelines-and-relys-api)".

## Troubleshooting

If you encounter any issues that you're unable to resolve on your own, please don't hesitate to contact our support team at `support@rely.io`.&#x20;

Additionally, if you would like to discuss a specific use-case you're targeting, feel free to [book a session with one of our experts](https://calendar.app.google/fHWH3to58EcSqLdh8) to brainstorm and gain further insights.


---

# Agent Instructions: 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.rely.io/public-api.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.
