How It Works
The relayer acts as a transaction sponsor:- Your app creates a transaction
- The user signs it with their private key
- Your app sends it to Polymarket’s relayer
- The relayer submits it onchain and pays the gas fee
- The transaction executes from the user’s wallet
Gasless transactions require authentication with Builder API Keys or Relayer API Keys.
What Is Covered
Polymarket pays gas for all operations routed through the relayer:| Operation | Description |
|---|---|
| Wallet deployment | Deploy Safe or Proxy wallets for new users |
| Token approvals | Approve contracts to spend USDC.e or outcome tokens |
| CTF operations | Split, merge, and redeem positions |
| Transfers | Move tokens between addresses |
Authentication
The relayer supports two authentication methods. Choose the one that fits your use case.Using Builder API Keys
Builder API Keys are for Builder Program members. They authenticate via HMAC-SHA256 signed headers and are required to use the relayer SDKs. All requests must include these headers:| Header | Description |
|---|---|
POLY_BUILDER_API_KEY | Your Builder API key |
POLY_BUILDER_TIMESTAMP | Unix timestamp |
POLY_BUILDER_PASSPHRASE | Your Builder passphrase |
POLY_BUILDER_SIGNATURE | HMAC-SHA256 signature |
BuilderConfig.
Using Relayer API Keys
Relayer API Keys are for market makers and anyone who needs a simpler alternative. You can create them from Settings > API Keys on the Polymarket website. Include these headers with your requests:| Header | Description |
|---|---|
RELAYER_API_KEY | Your Relayer API key |
RELAYER_API_KEY_ADDRESS | The address that owns the key |
If you want to use the Relayer API Key directly without the SDK, see the Relayer API Reference.
Prerequisites
Before using the relayer, you need:| Requirement | Source |
|---|---|
| Builder API credentials or Relayer API key | Builder Profile or Settings > API Keys |
| User’s private key or signer | Your wallet integration |
| USDC.e balance | For trading (not for gas) |
The below section is for the Builder SDKs only. If you want to use the Relayer API Key directly without the SDK, see the Relayer API Reference.
Installation
Client Setup
Initialize the relayer client with your signing configuration:- Local Signing
- Remote Signing
Use local signing when your backend handles all transactions securely.
Wallet Types
Choose a wallet type when initializing the client:| Type | Deployment | Best For |
|---|---|---|
| Safe | Call deploy() before first transaction | Most builder integrations |
| Proxy | Auto-deploys on first transaction | Magic Link users |
Executing Transactions
Use theexecute method to send transactions through the relayer:
Token Approval
Approve contracts to spend tokens:Redeem Positions
Exchange winning tokens for USDC.e after market resolution:Batch Transactions
Execute multiple operations atomically in a single call:Transaction States
Track transaction progress through these states:| State | Terminal | Description |
|---|---|---|
STATE_NEW | No | Transaction received by relayer |
STATE_EXECUTED | No | Submitted onchain |
STATE_MINED | No | Included in a block |
STATE_CONFIRMED | Yes | Finalized successfully |
STATE_FAILED | Yes | Failed permanently |
STATE_INVALID | Yes | Rejected as invalid |
Contract Addresses
See Contract Addresses for all Polymarket smart contract addresses on Polygon.Resources
- Builder Relayer Client (TypeScript)
- Builder Relayer Client (Python)
- Builder Signing SDK (TypeScript)
- Builder Signing SDK (Python)