Skip to main content

API Reference (v1)

Welcome to the Sleet.gg API documentation!

Overview

Sleet.gg uses InstantDB to store and query data. The API is a very light wrapper around the InstantDB API.

Base URL

https://sleet.gg/api/v1

Authentication

Currently, the API supports guest access for read-only operations. Full authentication with API keys and user-specific access will be available soon.

Endpoints

Query Endpoint

POST /query

Execute database queries to retrieve data from the Sleet.gg platform.

Request

  • Method: POST
  • Content-Type: application/json
  • Body: InstantDB query object

Response

  • Success: 200 OK with query results
  • Error: 400 Bad Request with error details

Example Usage

curl -X POST https://sleet.gg/api/v1/query \
-H "Content-Type: application/json" \
-d '{
"tournaments": {
"$": {
"limit": 10
}
}
}'

Query Structure

The query endpoint uses InstantDB's InstaQL query syntax. You can read more about it here.

The DB schema is available here.

Examples

Get tournaments:

{
"tournaments": {}
}

Get events in a tournament:

{
"events": {
"$": {
"where": {
"tournament.id": "tournament-id"
}
}
}
}

Get teams and profiles of an event:

{
"teams": {
"$": {
"where": {
"event.id": "event-id"
}
},
"profiles": {}
}
}

Error Handling

InstantDB returns errors to help you debug your queries.

Example Query Error (400):

{
"error": {
"type": "validation-failed",
"message": "Validation failed for query",
"hint": {
"data-type": "query",
"input": {
"events": {
"$": {
"wrong": "query"
}
}
},
"errors": [
{
"expected": "supported-options?",
"in": [
"events",
"$"
],
"message": "We only support `where`, `order`, `limit`, `offset`, `before`, and `after` clauses."
}
]
},
"trace-id": "67ec1d4acbfc7105f5f4583ecc254d91"
}
}

Support

Ask any questions in the Discord. We're happy to help!