Options Setup
Manage Options trading accounts and establish WebSocket connections for real-time trading.
Overview
The Options Setup APIs allow you to create and manage Options trading accounts using REST endpoints. These endpoints handle account creation, balance management, and WebSocket authentication setup.
REST API
Deriv-App-ID header.OpenAPI Specification
View the complete OpenAPI 3.1.0 specification for detailed schema definitions and examples:
Typical Workflow
- Create an Options trading account using
POST /trading/v1/options/accounts - Get OTP token for WebSocket authentication using
POST /trading/v1/options/accounts/{accountId}/otp - Connect to WebSocket using the OTP token at
/trading/v1/options/ws/demoor/trading/v1/options/ws/real - Start trading operations through the WebSocket connection
Available Endpoints
/trading/v1/options/accountsView documentation →/trading/v1/options/accountsView documentation →/trading/v1/options/accounts/{account_id}/reset-demo-balanceView documentation →/trading/v1/options/accounts/{accountId}/otpView documentation →/trading/v1/options/ws/demoView documentation →/trading/v1/options/ws/realView documentation →/trading/v1/options/ws/publicView documentation →Authentication
All Options Setup endpoints require the Deriv-App-ID header to identify your application, plus OAuth2 authentication with the appropriate scope.
OAuth2 Scopes
Each endpoint requires a specific OAuth2 scope:
| Endpoint | Scope |
|---|---|
GET /trading/v1/options/accounts | trade |
POST /trading/v1/options/accounts | admin |
POST /.../{account_id}/reset-demo-balance | trade |
POST /.../{accountId}/otp | trade |
Example Request
curl -X POST https://api.derivws.com/trading/v1/options/accounts \
-H "Deriv-App-ID: YOUR_APP_ID" \
-H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"currency": "USD", "group": "row", "account_type": "demo"}'Response Status Codes
The API uses standard HTTP status codes to indicate success or failure:
Error Response Format
All error responses follow a consistent structure with an errors array and metadata:
{
"errors": [
{
"status": 400,
"code": "ValidationError",
"message": "currency field is required"
}
],
"meta": {
"endpoint": "/accounts",
"method": "POST",
"timing": 23
}
}Error codes include: ValidationError,FieldIsRequired,Unauthorized,NotFound