# REST API

RADIUSaaS exposes a REST API that allows you to automate most actions that would otherwise have to be performed through the RADIUSaaS Admin Portal UI.

{% hint style="warning" %}
Before executing any API call that leads to a configuration change, ensure you fully understand the implications. Incorrect use of the API may break the configuration of your service.
{% endhint %}

## Authentication

To authenticate a call to the REST API, populate an HTTP `Authorization` header with each request. This header must contain a valid [access token](https://docs.radiusaas.com/admin-portal/settings/permissions#access-tokens):

```
Authorization: Bearer
               <Access Token>
```

## API Reference

The API documentation contains a complete Swagger-based API reference for each API endpoint including

* available HTTP methods,
* HTTP response codes,
* JSON schemas / form data for request (bodies),
* JSON schemas of response bodies, and
* Request-response examples for some endpoints.

{% hint style="info" %}
It is not possible to trigger API calls directly through the API Reference.
{% endhint %}

<figure><img src="https://1222554226-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSWU1DQ4UGkqER7uGNUOm%2Fuploads%2FyrjaWH8wAIOQrsCLO9IP%2Fimage.png?alt=media&#x26;token=1c649dc2-b62e-494e-a640-d1042e4bb754" alt=""><figcaption></figcaption></figure>

## Scenarios

### Manage Username/Password Accounts for BYOD or Guest Access

The REST API can be used to automate the management of username/password accounts for BYOD or guest access scenarios.&#x20;

This may include the automatic provisioning of (WiFi) credentials during on-boarding of new students, tenants in a co-working space, ... as well as the automatic retirement of those accounts.

An example on how to use the REST API to provision a username/password account can be found in your API Reference under the **User** endpoints.

### Implement External Monitoring

To monitor the service availability and uptime of your RADIUSaaS instance with an external system, or to monitor expiry of your RADIUS Server Certificate, please refer to the following guide:

{% content-ref url="rest-api/external-monitoring" %}
[external-monitoring](https://docs.radiusaas.com/other/rest-api/external-monitoring)
{% endcontent-ref %}

## cURL Examples

In general, there are two different content types for the REST API, either form data or JSON. You can find out which media type is required in the API documentation.&#x20;

If you are not familiar with the curl syntax, you can find two examples here:

#### JSON

```bash
curl -X "METHOD" "https://YOURNAME.radius-as-a-service.com/api/ROUTE/PATH" \
    -H 'Authorization: Bearer ACCESS_TOKEN' \
    -H 'Content-Type: application/json' \
    -d $'{
            NEEDED JSON DATA. Have a look at the documentation
        }'
```

#### Form Data

```bash
curl -X "METHOD" "https://YOURNAME.radius-as-a-service.com/api/ROUTE/PATH" \
    -H 'Authorization: Bearer ACCESS_TOKEN' \
    -F 'KEY=VALUE'\
    -F 'KEY=VALUE'
```


---

# 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.radiusaas.com/other/rest-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.
