Options Setup REST
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: YOUR_APP_ID header and an Authorization: Bearer YOUR_OAUTH_TOKEN token for authenticated endpoints.OpenAPI Specification
View the complete OpenAPI 3.1.0 specification for detailed schema definitions and examples:
OpenAPI Spec →Typical Workflow
- Create an Options trading account using
POST /trading/v1/options/accounts. - Request a WebSocket URL via
POST /trading/v1/options/accounts/{accountId}/otp. - Connect directly to the WebSocket URL returned.
- Start trading operations through the WebSocket connection.
Available Endpoints
/trading/v1/options/accounts/trading/v1/options/accounts/trading/v1/options/accounts/{account_id}/reset-demo-balance/trading/v1/options/accounts/{accountId}/otp/trading/v1/options/ws/publicAuthentication
All authenticated endpoints require the Deriv-App-ID header and an Authorization: Bearer YOUR_AUTH_TOKEN header.
OAuth2 Scopes
1curl -X POST https://api.derivws.com/trading/v1/options/accounts \
2 -H "Deriv-App-ID: YOUR_APP_ID" \
3 -H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
4 -H "Content-Type: application/json" \
5 -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:
1{
2 "errors": [
3 {
4 "status": 400,
5 "code": "ValidationError",
6 "message": "currency field is required"
7 }
8 ],
9 "meta": {
10 "endpoint": "/accounts",
11 "method": "POST",
12 "timing": 23
13 }
14}Error codes include: ValidationError, FieldIsRequired, Unauthorized, UnauthorizedAccess, AccessDenied, AccountNotFound, BadInputRequest, RateLimit, InternalServerError
Any other questions? Get in touch