Skip to main content
The snippets below are the client the rest of this space imports. Save the file under the name in the first comment line; later pages show the import line rather than repeating the auth code.

Token response

Branch on expires_in, not on a constant.

GET /v1/whoami response

whoami returns your clearing-member firm, not your participant firm. Your end users live under the participant firm. Do not build a participant ID from this value — it raises a security alert against your own account. Read Firms, participants and accounts before you use this response for anything.The complete field list for this response is not yet published; branch only on ep3_account_firm_name.
API reference: private_key_jwt flow. Opens on the public documentation site in a new tab. Where it disagrees with this page, this page is authoritative for the partner surface.

The gRPC channel and the per-call metadata

Most of this space is gRPC, so the same module publishes one channel helper and one metadata helper. Every gRPC snippet on every later page imports these two and nothing else: The channel carries TLS and nothing else. Authorization travels in the per-call metadata, so one channel serves calls for many participants. The metadata helper sets:
It calls access_token() on every invocation, and access_token() re-mints at expires_in minus 30 seconds — so a long-lived channel never carries a stale token. Build metadata per call, never once at start-up. x-participant-id is a per-call argument, not a client setting, because the same client makes calls at all three scopes: account-scoped reads require it, CreateVendorOrder does not use it, and CashMovementService must not receive it. Pass the participant ID only where the table on Firms, participants and accounts says to. Legacy drop-copy and balance-ledger examples that build metadata with only authorization return 403 as published. The gRPC targets are the real ones — grpc-api.preprod.polymarketexchange.com:443 and grpc-api.prod.polymarketexchange.com:443. The form grpc-preprod.polymarketexchange.com on the legacy environments page does not resolve.

curl cannot speak gRPC

There is no REST equivalent for most of this surface, so the command-line tab on later pages is grpcurl, not curl. Two things it needs:
  • -H flags for the metadata, one per header: -H "authorization: Bearer ${TOKEN}" and, on account-scoped calls, -H "x-participant-id: ${PARTICIPANT_ID}".
  • -import-path and -proto pointing at your local proto copy. Server reflection is entitlement-gated and returns PermissionDenied: method not permitted without the grant, so -use-reflection fails for most partners. See Protos and SDKs.
token.sh above is the token source: it prints the access token on stdout, so every grpcurl snippet in this space starts with TOKEN="$(./token.sh)". It re-mints on every run, which is correct for a shell one-liner and wrong for a service — use one of the three long-running clients in a process that stays up.
[VERIFY] Fully-qualified service and method names are not published for most of this surface, and reflection cannot list them for you without the entitlement.Read them out of the proto copy your integration lead sent you.

Next

Firms, participants and accounts