Quick Tutorial
How to place an order within 5 minutes
Learn how to authenticate, sign, and send your first trading order using the Flipster API — all within five minutes.
Step 1. Get Your API Key
Before making any private requests, generate an API key from your Flipster account page. Each key contains a public key (api-key) and a secret key (used for HMAC signing).
Step 2. Set Up Authentication
Every private request must be signed using HMAC-based authentication. Include the following headers in each request:
api-key: <your_api_key>
api-expires: <unix_timestamp_of_expiration>
api-signature: <HMAC_SHA256_signature>import hmac
import hashlib
from urllib.parse import urlparse
def generate_api_key_signature(
secret: str,
method: str,
url: str,
expires: int,
data: bytes | None = None,
) -> str:
"""
Generate an HMAC-SHA256 signature for Flipster API requests.
Args:
secret: Your API secret key.
method: HTTP method (e.g., 'POST', 'GET').
url: Full request URL including query parameters.
expires: Unix timestamp (in seconds) when the request expires.
data: Optional request payload as bytes.
Returns:
Hex-encoded HMAC-SHA256 signature string.
"""
# 1. Normalize URL path and query string
parsed = urlparse(url)
path = parsed.path + (f"?{parsed.query}" if parsed.query else "")
# 2. Build message: method + path + expires + (optional body)
parts = [
method.upper().encode("utf-8"),
path.encode("utf-8"),
str(expires).encode("utf-8"),
]
if data:
parts.append(data)
message = b"".join(parts)
# 3. Compute HMAC-SHA256 signature
signature = hmac.new(
secret.encode("utf-8"),
message,
digestmod=hashlib.sha256
).hexdigest()
return signatureStep 3. Send a Sample Order
Use the /api/v1/trade/order endpoint to place a market order.
Here’s an example using curl:
That’s it!
In just a few minutes, you’ve:
Created an API key
Signed your request with HMAC
Placed and verified your first order
You’re now ready to build automated trading workflows with Flipster’s API.
Last updated