Skip to main content

API Key Types

ApiKeyCreds

API key credentials for authenticating with the CLOB.
interface ApiKeyCreds {
  key: string;
  secret: string;
  passphrase: string;
}
key
string
required
The API key
secret
string
required
The API secret for signing requests
passphrase
string
required
The passphrase associated with the API key

Example

const credentials: ApiKeyCreds = {
  key: "your-api-key",
  secret: "your-api-secret",
  passphrase: "your-passphrase"
};

ApiKeyRaw

Raw API key response format.
interface ApiKeyRaw {
  apiKey: string;
  secret: string;
  passphrase: string;
}
apiKey
string
required
The API key
secret
string
required
The API secret
passphrase
string
required
The passphrase

ReadonlyApiKeyResponse

Response containing a read-only API key.
interface ReadonlyApiKeyResponse {
  apiKey: string;
}
apiKey
string
required
The read-only API key

ApiKeysResponse

Response containing multiple API key credentials.
interface ApiKeysResponse {
  apiKeys: ApiKeyCreds[];
}
apiKeys
ApiKeyCreds[]
required
Array of API key credentials

BuilderApiKey

Builder API key credentials.
interface BuilderApiKey {
  key: string;
  secret: string;
  passphrase: string;
}
key
string
required
Builder API key
secret
string
required
Builder API secret
passphrase
string
required
Builder API passphrase

BuilderApiKeyResponse

Response containing builder API key information.
interface BuilderApiKeyResponse {
  key: string;
  createdAt?: string;
  revokedAt?: string;
}
key
string
required
Builder API key
createdAt
string
Timestamp when the key was created
revokedAt
string
Timestamp when the key was revoked (if applicable)

Header Types

SimpleHeaders

Basic header type for HTTP requests.
type SimpleHeaders = Record<string, string | number | boolean>;
A simple key-value mapping for HTTP headers where values can be strings, numbers, or booleans.

L1PolyHeader

Layer 1 authentication headers using EIP712 signature verification.
interface L1PolyHeader extends SimpleHeaders {
  POLY_ADDRESS: string;
  POLY_SIGNATURE: string;
  POLY_TIMESTAMP: string;
  POLY_NONCE: string;
}
POLY_ADDRESS
string
required
Ethereum address of the signer
POLY_SIGNATURE
string
required
EIP712 signature
POLY_TIMESTAMP
string
required
Timestamp of the request
POLY_NONCE
string
required
Nonce for the request

Example

const headers: L1PolyHeader = {
  POLY_ADDRESS: "0x123...",
  POLY_SIGNATURE: "0xabc...",
  POLY_TIMESTAMP: "1735689600",
  POLY_NONCE: "1"
};

L2PolyHeader

Layer 2 authentication headers using API key verification.
interface L2PolyHeader extends SimpleHeaders {
  POLY_ADDRESS: string;
  POLY_SIGNATURE: string;
  POLY_TIMESTAMP: string;
  POLY_API_KEY: string;
  POLY_PASSPHRASE: string;
}
POLY_ADDRESS
string
required
Ethereum address of the API key owner
POLY_SIGNATURE
string
required
HMAC signature of the request
POLY_TIMESTAMP
string
required
Timestamp of the request
POLY_API_KEY
string
required
API key
POLY_PASSPHRASE
string
required
API key passphrase

Example

const headers: L2PolyHeader = {
  POLY_ADDRESS: "0x123...",
  POLY_SIGNATURE: "signature_abc",
  POLY_TIMESTAMP: "1735689600",
  POLY_API_KEY: "your-api-key",
  POLY_PASSPHRASE: "your-passphrase"
};

L2WithBuilderHeader

Layer 2 headers with additional builder API key authentication.
interface L2WithBuilderHeader extends L2PolyHeader {
  POLY_BUILDER_API_KEY: string;
  POLY_BUILDER_TIMESTAMP: string;
  POLY_BUILDER_PASSPHRASE: string;
  POLY_BUILDER_SIGNATURE: string;
}
POLY_BUILDER_API_KEY
string
required
Builder API key
POLY_BUILDER_TIMESTAMP
string
required
Builder timestamp
POLY_BUILDER_PASSPHRASE
string
required
Builder API passphrase
POLY_BUILDER_SIGNATURE
string
required
Builder HMAC signature

L2HeaderArgs

Arguments for constructing Layer 2 headers.
interface L2HeaderArgs {
  method: string;
  requestPath: string;
  body?: string;
}
method
string
required
HTTP method (GET, POST, DELETE, etc.)
requestPath
string
required
API endpoint path
body
string
Request body as a string (for POST/PUT requests)

Example

const headerArgs: L2HeaderArgs = {
  method: "POST",
  requestPath: "/orders",
  body: JSON.stringify({ order: {...} })
};

Signature Types

SignatureType

Enumeration of supported signature types.
enum SignatureType {
  EOA,              // ECDSA EIP712 signatures signed by EOAs
  POLY_PROXY,       // EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
  POLY_GNOSIS_SAFE  // EIP712 signatures signed by EOAs that own Polymarket Gnosis safes
}
EOA
number
ECDSA EIP712 signatures signed by Externally Owned Accounts
POLY_PROXY
number
EIP712 signatures signed by EOAs that own Polymarket Proxy wallets
POLY_GNOSIS_SAFE
number
EIP712 signatures signed by EOAs that own Polymarket Gnosis safes

Example

import { SignatureType } from "@polymarket/clob-client";

const sigType = SignatureType.EOA;

EIP712 Types

EIP712TypedData

Complete EIP712 typed data structure for signing.
interface EIP712TypedData {
  types: EIP712Types;
  domain: EIP712Object;
  message: EIP712Object;
  primaryType: string;
}
types
EIP712Types
required
Type definitions for the typed data
domain
EIP712Object
required
Domain separator information
message
EIP712Object
required
The message to be signed
primaryType
string
required
The primary type being signed

EIP712Types

Type definitions for EIP712 typed data.
interface EIP712Types {
  [key: string]: EIP712Parameter[];
}
Mapping of type names to their field definitions.

EIP712Parameter

Field definition for EIP712 types.
interface EIP712Parameter {
  name: string;
  type: string;
}
name
string
required
Field name
type
string
required
Field type (e.g., “string”, “uint256”, “address”)

EIP712Object

Generic EIP712 object.
interface EIP712Object {
  [key: string]: EIP712ObjectValue;
}

type EIP712ObjectValue = string | number | EIP712Object;
A flexible object structure for EIP712 messages, domains, and nested objects.

MessageTypes

Message type definitions including EIP712Domain.
interface MessageTypes {
  [additionalProperties: string]: MessageTypeProperty[];
  EIP712Domain: MessageTypeProperty[];
}
EIP712Domain
MessageTypeProperty[]
required
Required EIP712Domain type definition

MessageTypeProperty

Property definition for message types.
interface MessageTypeProperty {
  name: string;
  type: string;
}
name
string
required
Property name
type
string
required
Property type

User Status Types

BanStatus

User ban status information.
interface BanStatus {
  closed_only: boolean;
}
closed_only
boolean
required
Whether the user can only close existing positions (cannot open new ones)

Example

const status: BanStatus = {
  closed_only: false
};

Build docs developers (and LLMs) love