Skip to main content

Quick Start with the Client SDK

The recommended way to interact with the Cryptorobot.ai API is via the official @cryptorobot.ai/client npm package over WebSockets. This gives you real-time events, typed services, and automatic reconnection.
npm install @cryptorobot.ai/client
import { createClient } from '@cryptorobot.ai/client';

// Connect via WebSocket (recommended)
const client = createClient('https://api.cryptorobot.ai');

// Authenticate
await client.authenticate({
  strategy: 'local',
  email: 'you@example.com',
  password: 'your-password'
});

// Use typed services
const strategies = await client.service('strategies').find({
  query: { $limit: 10, $sort: { createdAt: -1 } }
});

// Listen for real-time events
client.service('traders/pods/events').on('created', (event) => {
  console.log('New pod event:', event);
});
The client SDK supports both WebSocket (recommended) and REST transports. WebSocket provides real-time event streaming and lower latency.

REST API

For direct HTTP access, use the base URL:
https://api.cryptorobot.ai

Authentication

All authenticated endpoints require one of:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Authorization: ApiKey cr_live_a1b2c3d4e5f6...

HTTP Methods

MethodService MethodDescription
GET /servicefindList resources (paginated)
GET /service/:idgetGet a single resource
POST /servicecreateCreate a new resource
PATCH /service/:idpatchPartially update a resource
DELETE /service/:idremoveDelete a resource

Common Query Parameters

ParameterTypeDescription
$limitintegerItems per page (default: 25, max: 100)
$skipintegerItems to skip for pagination
$sort[field]1 | -1Sort direction (1 = ascending, -1 = descending)
$select[]stringFields to include in response
field[$operator]variesFilter operator: $gt, $gte, $lt, $lte, $ne, $in, $nin

Response Format

Paginated List (Find)

{
  "total": 142,
  "limit": 25,
  "skip": 0,
  "data": [{ ... }, { ... }]
}

Single Resource (Get / Create / Patch)

{
  "_id": "507f1f77bcf86cd799439011",
  "field": "value",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}

Error

{
  "name": "NotAuthenticated",
  "message": "Invalid access token",
  "code": 401,
  "className": "not-authenticated"
}

Rate Limits

HeaderDescription
X-RateLimit-LimitMax requests per minute
X-RateLimit-RemainingRemaining in current window
X-RateLimit-ResetUnix timestamp when window resets
Retry-AfterSeconds to wait (429 responses only)

Endpoint Groups

Authentication

Login, logout, token management

Users

Profile, sessions, onboarding

Exchanges

Connections, balances, market data

Strategies

CRUD, backtesting, AI generation

Traders & Bots

Bot management, pods, events

Models & Signals

ML signals, subscriptions

Insights

Market data, ETF flows, news

Portfolio

Performance, trades, snapshots

Agents

AI agents and conversations

Payments

Subscriptions, payment methods

Events

Event log, triggers, notifications