API Key Authentication

All requests to the Provider API require an API key passed via the X-API-Key header.
curl -H "X-API-Key: ps_live_abc123def456" \
  https://api.perps.studio/v1/perps/hyperliquid/markets

Getting an API Key

1

Sign Up

Create an account at portal.perps.studio.
2

Navigate to API Keys

Go to Settings > API Keys in your dashboard.
3

Generate a Key

Click Create API Key. Your key will be shown once — store it securely.
API keys grant full access to your account. Never expose them in client-side code, public repositories, or logs.

Key Format

API keys follow this format:
PrefixEnvironment
ps_live_Production
ps_test_Testnet only
Test keys can only access /v1/testnet/ endpoints. Live keys can access both production and testnet endpoints.

Error Responses

If authentication fails, you will receive a 401 Unauthorized response:
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Missing X-API-Key header"
  }
}
ScenarioError Message
Missing headerMissing X-API-Key header
Invalid keyInvalid API key
Expired keyAPI key has expired

Provider-Specific Auth (Trading)

Reading market data only requires an API key. However, placing orders, canceling orders, and modifying positions require provider-specific wallet authentication.

Hyperliquid (EIP-712)

Hyperliquid uses EIP-712 typed data signing. You need to:
  1. Create an API wallet (agent) approved by your main wallet
  2. Sign order payloads with the agent private key
  3. Include the signature in the request body
// Order body includes wallet auth fields
const body = {
  symbol: "BTC",
  side: "buy",
  type: "limit",
  size: "0.1",
  price: "42000",
  // Wallet auth
  wallet: "0xYourMainWallet",
  signature: "0x...", // EIP-712 signature
  nonce: Date.now(),
};
See the Place First Trade guide for a complete walkthrough of wallet setup and order signing.

Aster DEX (EIP-712)

Aster uses a similar EIP-712 signing flow but with its own domain and type definitions. The Provider API normalizes the signing interface, so the request body shape is identical to Hyperliquid.

Polymarket (HMAC)

Polymarket uses HMAC-based authentication for trading. You need API credentials (key, secret, passphrase) from your Polymarket account.
const body = {
  tokenId: "71234",
  side: "buy",
  size: "100",
  price: "0.65",
  // Polymarket auth
  apiKey: "your-poly-api-key",
  apiSecret: "your-poly-secret",
  passphrase: "your-passphrase",
};

WebSocket Authentication

WebSocket connections authenticate via the X-API-Key query parameter or header during the initial handshake.
const ws = new WebSocket(
  "wss://api.perps.studio/ws/v1/perps?apiKey=ps_live_abc123def456"
);
See WebSockets for full connection details.