Welcome to the Deribit API! This guide will help you make your first API call in minutes.
Deribit provides three different interfaces to access the API:
JSON-RPC over WebSocket (recommended) - Real-time, bidirectional communication
JSON-RPC over HTTP - Simple REST-like interface
FIX API - Financial Information eXchange protocol for institutional trading
All examples in this documentation use the test environment (test.deribit.com). To use production, change the URLs to www.deribit.com. Test and production environments are separate and require different accounts and API keys.
const WebSocket = require('ws');const ws = new WebSocket('wss://test.deribit.com/ws/api/v2');ws.on('open', function open() { // Authenticate ws.send(JSON.stringify({ "jsonrpc": "2.0", "method": "public/auth", "params": { "grant_type": "client_credentials", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" }, "id": 1 }));});ws.on('message', function incoming(data) { const response = JSON.parse(data); if (response.result && response.result.access_token) { console.log('Authenticated! Access token:', response.result.access_token); // Now you can make private method calls }});
Access Scopes
Learn more about API permissions and access scopes
4
Make Your First Requests
Public Data (No Auth)
Private Data (Auth Required)
WebSocket Subscriptions
Get Market Data
# Get all BTC futurescurl -X GET "https://test.deribit.com/api/v2/public/get_instruments?currency=BTC&kind=future"# Get ticker for BTC-PERPETUALcurl -X GET "https://test.deribit.com/api/v2/public/ticker?instrument_name=BTC-PERPETUAL"# Get order bookcurl -X GET "https://test.deribit.com/api/v2/public/get_order_book?instrument_name=BTC-PERPETUAL&depth=5"
Get Account Information
# Get account summarycurl -X GET "https://test.deribit.com/api/v2/private/get_account_summary?currency=BTC" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"# Get open orderscurl -X GET "https://test.deribit.com/api/v2/private/get_open_orders?currency=BTC" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Subscribe to Real-Time Data
const WebSocket = require('ws');const ws = new WebSocket('wss://test.deribit.com/ws/api/v2');ws.on('open', function open() { // Subscribe to multiple channels ws.send(JSON.stringify({ "jsonrpc": "2.0", "method": "public/subscribe", "params": { "channels": [ "book.BTC-PERPETUAL.100ms", "ticker.BTC-PERPETUAL.100ms", "trades.BTC-PERPETUAL.100ms" ] }, "id": 1 }));});ws.on('message', function incoming(data) { const message = JSON.parse(data); if (message.method === 'subscription') { console.log('Update:', message.params.channel, message.params.data); }});
5
Place a Test Order (Testnet Only)
Only use test.deribit.com for testing. Never test with real funds on production.
HTTP
WebSocket
# Place a limit buy order (testnet)curl -X GET "https://test.deribit.com/api/v2/private/buy" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d "instrument_name=BTC-PERPETUAL" \ -d "amount=10" \ -d "type=limit" \ -d "price=50000"