Deriv API
Documentation
Options Setup

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.

Typical Workflow

  1. Create an Options trading account using POST /trading/v1/options/accounts.
  2. Request a WebSocket URL via POST /trading/v1/options/accounts/{accountId}/otp.
  3. Connect directly to the WebSocket URL returned.
  4. Start trading operations through the WebSocket connection.

Available Endpoints

Authentication

All authenticated endpoints require the Deriv-App-ID header and an Authorization: Bearer YOUR_AUTH_TOKEN header.

OAuth2 Scopes

EndpointScope
GET /trading/v1/options/accountstrade
POST /trading/v1/options/accountsaccount_manage
POST /.../reset-demo-balancetrade
POST .../{accountId}/otptrade
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:

2xx Success
200 OK — Request successful (existing account or OTP generated)
201 Created — New resource created successfully
4xx/5xx Errors
400 Bad Request — Invalid parameters or request body
401 Unauthorized — Invalid or missing authentication
403 Forbidden — Access denied
404 Not Found — Resource not found
500 Internal Server Error — Server-side error
504 Gateway Timeout — Upstream service timeout

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

Click to open live chat support. Get instant help from our support team.