Skip to main content

Authorization

Fluidstack provides two authentication methods for facilitating programmatic/external access to metrics: API Keys and OAuth Client Credentials.

Both methods are opt-in, please reach out via standard support channels if you are interested in any of the options outlined in this page.

API Key

Fluidstack can provision static API keys that can be used to facilitate access to Fluidstack metrics from your internal Grafana instances. This API key can be used to configure a datasource you can add to your self-managed Grafana instance for use against your pre-existing dashboards.

Adding a Fluidstack datasource to your internal Grafana instance

You can configure a Grafana datasource to use your API key in two ways:

Via the Grafana UI

  1. Navigate to Configuration > Data Sources > Add data source
  2. Configure the following settings:
    • Type: Prometheus
    • Prometheus Server URL: https://metrics.fluidstack.io/read
    • Authorization: None
    • HTTP headers:
      • Header: Authorization
      • Value: Bearer $SECRET_API_KEY

Via grafana.ini

Add the following configuration to your grafana.ini file:

- name: Fluidstack
type: prometheus
access: proxy
url: https://metrics.fluidstack.io/read
isDefault: false
version: 1
editable: false
uid: fluidstack
jsonData:
httpHeaderName1: 'Authorization'
secureJsonData:
httpHeaderValue1: "Bearer $SECRET_API_KEY"

OAuth Client Credentials

Fluidstack also supports OAuth 2.0 Client Credentials flow for programmatic access to the Prometheus Metrics API.

This method is ideal for applications and services that need to authenticate without user interaction.

Obtaining Your Credentials

Contact Fluidstack to receive your OAuth credentials:

  • client_id - Your unique client identifier
  • client_secret - Your client secret (keep this secure)

Getting an Access Token

Use your client credentials to obtain a JWT access token from the Auth0 authorization server:

curl --request POST \
--url https://oauth.fluidstack.io/oauth/token \
--header 'content-type: application/json' \
--data '{
"client_id":"<client_id>",
"client_secret":"<client_secret>",
"audience":"https://metrics.fluidstack.io",
"grant_type":"client_credentials"
}'

The response will contain the access token details:

{
"access_token": "<access_token>",
"expires_in": 86400,
"token_type": "Bearer"
}

The token is valid for 24 hours (86400 seconds).

Making API Calls

Use the access token to make Prometheus-compatible API calls to the Fluidstack metrics server:

curl --request GET \
--url https://metrics.fluidstack.io/read/api/v1/query?query=DCGM_FI_DEV_FB_TOTAL \
--header 'authorization: Bearer <access_token>'

Replace <access_token> with the token received from the authorization server.

Prometheus API Endpoints

The Fluidstack metrics API supports standard Prometheus HTTP API endpoints:

  • Instant queries: /api/v1/query?query=<promql>
  • Range queries: /api/v1/query_range?query=<promql>&start=<timestamp>&end=<timestamp>&step=<duration>
  • Label values: /api/v1/label/<label_name>/values
  • Series metadata: /api/v1/series?match[]=<series_selector>

For more information on the Prometheus HTTP API, see the Prometheus documentation.