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
Authorization: Bearer YOUR_TOKEN) plus the Deriv-App-ID: YOUR_APP_ID header when using PAT authentication (Authentication).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/demo/trading/v1/options/ws/real/trading/v1/options/ws/publicAuthentication
Authenticated endpoints require an Authorization: Bearer YOUR_AUTH_TOKEN header. When authenticating with a Personal Access Token (PAT), the Deriv-App-ID header is also required (see Authentication).
OAuth2 Scopes
1curl -X POST https://api.derivws.com/trading/v1/options/accounts \
2 -H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
3 -H "Content-Type: application/json" \
4 -d '{"currency": "USD", "group": "row", "account_type": "demo"}'
5# Add -H "Deriv-App-ID: YOUR_APP_ID" when authenticating with a Personal Access Token (PAT).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 }
11}Error codes include: ValidationError, FieldIsRequired, Unauthorized, UnauthorizedAccess, AccessDenied, AccountNotFound, BadInputRequest, RateLimit, InternalServerError
Any other questions? Get in touch