Skip to main content
Use this page when the TypeScript, React, or Rust SDKs are not the right fit. You have two integration paths:

Python REST

This example uses Python with Monaco’s REST API. Public market data does not require authentication; trading and account routes require a Monaco client ID plus a wallet-authorized ed25519 session key.

Prerequisites

You’ll need a secp256k1 private key for an Ethereum-compatible wallet and a Monaco clientId.

Market Data

No authentication is required to read trading pairs.

Authenticate

Monaco authenticates with a wallet-authorized ed25519 session key. Generate a keypair locally, have the wallet sign a challenge that commits to it, then sign every authenticated request with the session key. No tokens are issued.

Sign Requests

This guide uses legacy signing, where every authenticated request carries X-Monaco-PublicKey, X-Monaco-Timestamp, and X-Monaco-Signature, and the signature covers METHOD\npath?query\ntimestamp_ms\nSHA256_hex(body). Monaco also accepts RFC 9421 HTTP message signatures over the same session key; a Python client can implement either, but never both on one request. Serialize the body yourself so the bytes you hash are exactly the bytes you send:

Place and Cancel an Order

The API keeps idempotencyKey optional. Raw REST callers and generated Python bindings must supply their own keys for retry protection. Create and retain the key before serialization or signing. Persist the prepared payload and key before sending if recovery must survive a process restart.
For a lost create response, pass the same order_request to signed_request again, which produces a fresh signature. Use a distinct key for every batch-create item, generated before signing the batch. Generated protobuf clients use the field name idempotency_key; populate it before SerializeToString() and retain the message for recovery. Protection lasts 24 hours after acceptance and retries do not extend it. Do not retry an unresolved submission after expiry. These examples do not retry automatically. A GTC order rests on the book until filled or cancelled. See Order Management for other time-in-force options.

Generate gRPC Clients with BSR

Monaco publishes protobuf definitions to the Buf Schema Registry. Use BSR when you want generated gRPC clients in Go, Python, C++, Java, C#, Kotlin, Swift, Ruby, PHP, TypeScript, or another supported language.

Install Buf

Create buf.gen.yaml

Use the Monaco BSR module as the input and select plugins for your target language.
Browse the BSR plugin catalog for other targets and swap the remote plugins into the same shape.

Generate

The generated code is written to the out: directories you configured.

REST Clients from OpenAPI

If you prefer REST in a language other than Python, generate a client from Monaco’s OpenAPI spec. The spec is generated from the same protobuf contracts and powers the REST API Reference, which is the source of truth for routes, request bodies, responses, and authentication headers.