Skip to main content

Auth

At this moment, we are offering Starbloom at a private beta capacity. If you are interested in exploring Starbloom as your data infrastructure, please reach out to us at [email protected].

Auth/Limits

For historical data, non-authenticated requests and authenticated requests are rate-limited differently. To get higher rate limits, please contact the Starbloom Team to obtain an API key.

Rate Limit (req/s)Burst (req/s)
Non-authenticated00
Authenticated100200
  • Rate limits are subject to change while Starbloom is in public beta.
  • A 429 will be returned when the rate limit is violated.
  • The limits on the API are based on IPs for non-authenticated requests, and API keys for authenticated requests.

Auth​

Historical​

Authenticated requests to the REST API need to include the following headers:

  1. Authorization:Bearer <apikey>
  2. Origin: <your_registered_url>

When making the request from within a web browser, the Origin header is set automatically and cannot be overridden. When making the request from a backend service, the Origin header needs to be set to the value that corresponds with the api-key. Please note that <your_registered_url> must include https:// before your domain.

Examples​

# using auth header
curl -H 'Authorization: Bearer <api_key>' "https://api.starbloom.ai/api/v1/data/starbloom.uniswapv2.0_0_0.pair_Swap"
# OR using query param
curl "https://api.starbloom.ai/api/v1/data/starbloom.uniswapv2.0_0_0.pair_Swap?api_key=<api_key>"

// javascript
const url = "https://api.starbloom.ai/api/v1/data/starbloom.uniswapv2.0_0_0.pair_Swap"
const res = await fetch(url, {
headers: {
"Authorization": `Bearer ${config.apiToken}`,
// Origin header is automatically set and cannot be overridden on client
// side, however this is necessary when calling from Nodejs on serverside
"Origin": config.Origin,
}
}).then(res => res.json())
# python

import requests
from requests.structures import CaseInsensitiveDict

url = "https://api.starbloom.ai/api/v1/data/starbloom.uniswapv2.0_0_0.pair_Swap"

headers = CaseInsensitiveDict()
headers["Accept"] = "application/json"
headers["Authorization"] = "Bearer {token}"
headers["Origin"] = "{origin}"


resp = requests.get(url, headers=headers)

Realtime​

Realtime data is only available to clients with an API key. Authenticated requests to the realtime API must include an API key in the URL path.

# terminal
# First, make a websocket connection
wscat -c "wss://stream.starbloom.ai/ws/v1?api_key=<api_key>"
# Then, subscribe to your favorite stream
> {"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": {"topics": ["starbloom.uniswapv2.0_0_0.factory_PairCreated"]}}
// javascript
let socket = new WebSocket("wss://stream.starbloom.ai/ws/v1?api_key=<api_key>");

socket.onmessage = function(event) {
console.log(`${event.data}`);
};

let command = {"jsonrpc": "2.0", "id": 1, "method": "subscribe", "params": {"topics": ["starbloom.uniswapv2.0_0_0.factory_PairCreated"]}}
socket.send(JSON.stringify(command));

Alternatively, you may connect using SSE:

# using auth header
curl -H 'Authorization: Bearer <api_key>' "https://stream.starbloom.ai/sse/v1?topics=starbloom.uniswapv2.0_0_0.pair_Swap"
# OR using query param
curl "https://stream.starbloom.ai/sse/v1?topics=starbloom.uniswapv2.0_0_0.pair_Swap?api_key=<api_key>"

Next Steps​

  • Call some API endpoints in the APIs doc