OKX API Frequently Asked Questions (FAQ)

ยท

What does the passphrase refer to?

The passphrase is the password you entered when requesting an API key. You must remember it yourself. If forgotten, it cannot be recovered, requiring you to create a new API key.

To trade on the demo disk API, follow these steps:

  1. Log in to your OKX account
  2. Navigate to Trading > Demo Trading
  3. Access Personal Center > Create Demo Account API Key
  4. Start demo trading

๐Ÿ‘‰ Learn how to secure your API keys

Will the API key expire?

Activity is counted when:

Can orders be placed in USDT or currency units via the API?

No. For contract orders:

Price movement formula:
(Current price - 24h opening price) / 24h opening price ร— 100%

๐Ÿ‘‰ Master contract trading strategies

Why does "51000 Parameter posSide error" occur?

First check your account mode (posMode):

Verify via account settings interface.

How to get contract specifications?

Use the instrument information interface to retrieve:

What is the instId format?

Examples:

All letters must be capitalized.

Why do TP/SL trigger price errors (51046-49) occur?

Trigger price rules:

What causes "50102 Timestamp expired" error?

Solution:

  1. Call system time interface
  2. Synchronize local time with server (UTC+8)
  3. Maintain <30 second time difference

Why "50101 APIKey environment mismatch"?

Cause:

Account mode error (51010)

Adjust via:

Order quantity error (51121)

Orders must be multiples of minSz (minimum order size). Retrieve minSz from product interface.

Whitelist withdrawal error (58207)

Requirements:

  1. Add withdrawal address via web interface
  2. Complete Visa verification for unverified addresses

Timeout error (50004)

Typically occurs during:

If receiving 50004:


FAQ Section

How often should I rotate my API keys?

We recommend rotating keys every 90 days for security.

Can I use the same API key for multiple accounts?

No, each account requires unique API credentials.

What's the rate limit for API calls?

Standard accounts: 20 requests/second. Higher tiers available for institutional users.

How do I troubleshoot authentication failures?

  1. Verify timestamp synchronization
  2. Check API key permissions
  3. Confirm IP whitelisting (if enabled)

Where can I find API documentation?

Complete documentation is available in the developer portal.

Is there a sandbox environment for testing?

Yes, use demo API keys with x-simulated-trading:1 header.