REST API

Getting up and running with Superwise REST APIs

All Superwise APIs are protected and secured with bearer token authentication. The bearer tokens let us know who is trying to retrieve the APIs and whether they have permission to consume them. Each token is valid for 24 hours and is implemented using the JWT standard.

👍

HTTPS (SSL)

All Superwise endpoints can only be used over HTTPS to ensure maximum security.

To generate a bearer token using an API call, send a POST request to the Superwise authentication endpoint and include your client_id and secret in the body. To learn more about how to create/retrieve your client_id and secret visit here.

See the full list of API endpoints and try it out live with your tokens by visiting our API reference guide.

📘

Superwise SDK and bearer tokens

If you are working with the Superwise SDK, you don't need to create bearer tokens as the SDK automatically generates and refreshes them behind the scenes.

API usage example

Here's an example of the authentication process where we generate a new bearer token and then use it to consume one of the platform's REST endpoints.

import requests

url = "https://auth.superwise.ai/identity/resources/auth/v1/api-token"

payload = {
    "clientId": "REPLACE-WITH-YOUR-CLIENT-ID",
    "secret": "REPLACE-WITH-YOUR-SECRET"
}
headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
jwt = response.json()['accessToken']

print(jwt)

In the example below, we'll call the Superwise Incidents endpoint and get the list of all open incidents for a specific client.

url = "https://portal.superwise.ai/{CUSTOMER-NAME}/monitor/v1/incidents"

headers = {
    "Accept": "application/json",
    "Authorization": f"Bearer {jwt}"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

📘

Notebook example

If you would like to review a notebook that demonstrates how to use Superwise API's to consume it's model metrics, visit here


Did this page help you?