Skip to main content
The Gigabrain REST API provides programmatic access to the Intelligence Collective for automated market analysis. It is architected for seamless integration with trading bots, terminal applications, custom scripts, and backend services.

Base URL

https://api.gigabrain.gg/v1

Authentication

Include your API key in the Authorization header with every request:
curl -X GET "https://api.gigabrain.gg/v1/sessions" \
  -H "Authorization: Bearer YOUR_API_KEY"

How to Get Your API Key

Sign in and go to Profile → API Keys to generate your key. Copy the full key as-is.

Authentication Methods

Option 1: Authorization Header (Recommended)
Authorization: Bearer YOUR_API_KEY
Option 2: X-API-Key Header
X-API-Key: YOUR_API_KEY

Rate Limits

  • Per minute: 30 requests
  • Per day: 1,000 requests

Rate Limit Headers

Every response includes headers showing your current usage:
X-RateLimit-Limit-Minute: 30
X-RateLimit-Remaining-Minute: 29
X-RateLimit-Reset-Minute: 2026-01-07T13:21:00.000Z
X-RateLimit-Limit-Day: 1000
X-RateLimit-Remaining-Day: 999
X-RateLimit-Reset-Day: 2026-01-08T00:00:00.000Z

Rate Limit Exceeded

When you exceed a limit, you’ll receive a 429 response:
{
  "statusCode": 429,
  "message": "Rate limit exceeded",
  "retryAfter": 45,
  "resetAt": "2026-01-07T13:21:00.000Z"
}
The response includes a Retry-After header with the number of seconds to wait.

Response Format

All endpoints return a consistent JSON structure:

Success Response

{
  "session_id": "uuid",
  "message": "BTC is currently trading at $45,234...",
  "timestamp": "2026-01-07T12:00:00Z"
}

Error Response

{
  "statusCode": 400,
  "message": "Invalid request parameters",
  "error": "Bad Request"
}

HTTP Status Codes

StatusCodeMeaning
200-Success
400-Bad request - check your parameters
401INVALID_API_KEYAPI key is invalid or revoked
404-Resource not found
429RATE_LIMIT_EXCEEDEDRate limit exceeded
500API_ERRORServer error

Endpoints

POST /chat

Send a message to Gigabrain’s Intelligence Collective and receive AI-powered market analysis. Request:
curl -X POST https://api.gigabrain.gg/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What is the price of BTC?",
    "stream": false
  }'
Parameters:
ParameterTypeRequiredDefaultDescription
messagestringYes-Your query to the Intelligence Collective
streambooleanNofalseEnable streaming response
Response:
{
  "session_id": "550e8400-e29b-41d4-a716-446655440000",
  "message": "BTC is currently trading at $45,234. The 4H chart shows...",
  "timestamp": "2026-01-07T12:00:00Z"
}

GET /sessions

Retrieve your chat session history. Request:
curl -X GET "https://api.gigabrain.gg/v1/sessions?limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"
Parameters:
ParameterTypeRequiredDefaultDescription
limitintegerNo10Number of sessions to return
Response:
{
  "sessions": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "created_at": "2026-01-07T12:00:00Z",
      "messages_count": 5
    }
  ]
}

Code Examples

Python

import requests
import os

API_KEY = os.getenv("GIGABRAIN_API_KEY")
BASE_URL = "https://api.gigabrain.gg/v1"

response = requests.post(
    f"{BASE_URL}/chat",
    headers={
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    },
    json={"message": "What is the price of ETH?"}
)

print(response.json())

JavaScript (Node.js)

const API_KEY = process.env.GIGABRAIN_API_KEY;
const BASE_URL = "https://api.gigabrain.gg/v1";

const res = await fetch(`${BASE_URL}/chat`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    message: "What is the price of ETH?",
  }),
});

console.log(await res.json());

cURL

curl -X POST https://api.gigabrain.gg/v1/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Analyze BTC 4H chart"}'

Error Handling

401 Unauthorized

Invalid or revoked API key.
{
  "statusCode": 401,
  "message": "Invalid or revoked API key"
}
Solution: Check your API key is correct and active in your profile settings.

429 Too Many Requests

Rate limit exceeded.
{
  "statusCode": 429,
  "message": "Rate limit exceeded",
  "retryAfter": 45,
  "resetAt": "2026-01-07T13:21:00.000Z"
}
Solution: Wait for the time specified in retryAfter (seconds) or resetAt (timestamp) before making another request.

500 Internal Server Error

Server error occurred.
{
  "error": {
    "message": "Internal server error",
    "type": "api_error"
  },
  "session_id": "550e8400-e29b-41d4-a716-446655440000"
}
Solution: Retry your request. If the issue persists, contact support with the session_id.

Best Practices

  1. Secure Your API Key
    • Never expose in client-side code or public repositories
    • Use environment variables to store keys
    • Rotate keys periodically
  2. Handle Rate Limits
    • Monitor rate limit headers in responses
    • Implement exponential backoff when hitting limits
    • Cache responses when appropriate
  3. Error Handling
    • Always handle API errors gracefully
    • Implement retry logic for transient errors (500, 503)
    • Log session_id for debugging and support requests
  4. Optimize Requests
    • Batch related queries when possible
    • Use streaming for real-time responses
    • Implement request timeouts

Support

Need help? We’re here for you: When contacting support, include:
  • Your API key (first 10 characters only)
  • Session ID from error responses
  • Request/response examples

Ready to build? Get your API key from your Profile and start integrating!