Skip to main content

Analytics API

The Analytics API allows GPU operators to export analytics data for a given time range. This API provides detailed insights into your GPU operations, including performance metrics, usage statistics, and other operational data.

Authentication

All API requests require authentication using a Bearer token. You can generate an API key from the Inference.net Dashboard under the API Keys page.
Include your API token in the Authorization header of all requests: Authorization: Bearer YOUR_API_TOKEN

Base URL

https://relay.inference.net/api/v1

Interactive API Documentation

You can explore and test the Analytics API using our interactive Swagger documentation:

Swagger API Documentation

Interactive API documentation with a live testing interface

Endpoints

Export Operator Analytics

Export analytics data for your GPU operations within a specified time range.

Endpoint

POST /operator/analytics

Request

Headers
{
  "Authorization": "Bearer YOUR_API_TOKEN",
  "Content-Type": "application/json"
}
Request Body
The maximum time range for a single request is 15 days. Please limit requests to 1-3 days for best results.
{
  "startDate": "2024-01-01T00:00:00Z",
  "endDate": "2024-01-31T23:59:59Z"
}
Parameters
ParameterTypeRequiredDescription
startDatestringYesStart date for the analytics period (ISO 8601 format)
endDatestringYesEnd date for the analytics period (ISO 8601 format)
All date fields must be provided in ISO 8601 format (e.g., 2024-01-15T10:30:00Z)

Response

Success Response (200 OK) The response will contain your operator analytics data for the specified time range. The exact structure of the response will include:
  • Performance metrics
  • Usage statistics
  • GPU utilization data
  • Request/response metrics
  • Revenue and earnings data (if applicable)
{
  "status": 200,
  "data": {
    // Analytics data structure
  }
}
Error Responses
Status CodeDescription
400Invalid request parameters - Check your date format and ensure all required fields are provided
401Unauthorized - Invalid or missing API token
403Forbidden - You don’t have permission to access this resource
500Internal server error - Please try again later or contact support

Code Examples

cURL

curl -X POST https://relay.inference.net/api/v1/operator/analytics \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "startDate": "2024-01-01T00:00:00Z",
    "endDate": "2024-01-31T23:59:59Z"
  }'

JavaScript/TypeScript

const response = await fetch(
  "https://relay.inference.net/api/v1/operator/analytics",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      startDate: "2024-01-01T00:00:00Z",
      endDate: "2024-01-31T23:59:59Z",
    }),
  }
);

const analytics = await response.json();
console.log(analytics);

Python

import requests
import json
from datetime import datetime

url = "https://relay.inference.net/api/v1/operator/analytics"
headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Content-Type": "application/json"
}

data = {
    "startDate": "2024-01-01T00:00:00Z",
    "endDate": "2024-01-31T23:59:59Z"
}

response = requests.post(url, headers=headers, json=data)
analytics = response.json()
print(analytics)

Date Format Guidelines

The Analytics API uses ISO 8601 date format for all date/time parameters. This ensures consistent handling of dates across different time zones.

Format Pattern

YYYY-MM-DDTHH:MM:SSZ

Examples

  • 2024-01-15T00:00:00Z - January 15, 2024 at midnight UTC
  • 2024-03-20T14:30:00Z - March 20, 2024 at 2:30 PM UTC
  • 2024-12-31T23:59:59Z - December 31, 2024 at 11:59:59 PM UTC
For the best results, we recommend only querying short time ranges (e.g. 1 day, 3 days) in each request.

Getting Your API Key

To use the Analytics API, you’ll need an API key:
  1. Log in to the Inference.net Dashboard
  2. Navigate to the API Keys section
  3. Click Generate New API Key
  4. Copy your API key and store it securely

Support

If you encounter any issues or have questions about the Analytics API: