Skip to content

Cannot place CLOB orders programmatically with an email/Magic deposit-wallet account (POLY_1271) — API key L1 auth binds to EOA, not the deposit wallet #95

Description

@andreaardenti

Hi Polymarket team,

I'm building a trading bot on the CLOB and I'm blocked by what appears to be a known SDK/server bug affecting email/Magic deposit-wallet accounts (smart accounts using signature type POLY_1271 / type 3).

Account details

Deposit wallet (funder, holds the pUSD collateral): 0xedbD0485157A8dFE1cF6CDcbae4b80476D2c464D
Signing EOA (owner of the deposit wallet): 0x589E014f451cB5F0278851CCBeF170CF70a048f9
Signature type: 3 (POLY_1271)
SDK: @polymarket/clob-client-v2@1.0.8
What works

getBalanceAllowance correctly returns my collateral balance and allowances (with signature type 3).
Order creation/signing succeeds and reaches the API (EIP-1271 order signing is correct — order.signer = the deposit wallet).
The problem
Every order is rejected with:

"the order signer address has to be the address of the API KEY" (HTTP 400)
Root cause (confirmed empirically)
The API key is bound to the EOA (0x589E…), while for POLY_1271 the order signer is the deposit wallet (0xedbD…) — so they never match. I verified this both ways:

With POLY_ADDRESS = EOA → auth succeeds, but the order is rejected (signer ≠ API key).
With POLY_ADDRESS = deposit wallet → auth fails with "Unauthorized/Invalid api key" (401), because no API key exists for the deposit wallet.
The createApiKey / createOrDeriveApiKey L1 auth sends a plain ECDSA signature (not EIP-1271-wrapped), so the CLOB registers the key to the EOA and there's no way to obtain a key bound to the deposit wallet. This matches the open issue: #64

What I've already tried (all fail the same way)

Programmatic key derivation via the SDK (createOrDeriveApiKey).
Static API credentials generated from the web UI, placed in env.
Overriding the request POLY_ADDRESS header to the deposit wallet.
My question
How can an email/Magic deposit-wallet account obtain a CLOB API key that is bound to the deposit wallet (funder), so that POLY_1271 orders are accepted? Is there a supported workaround today (e.g., a specific endpoint, a UI flow, or a beta build), or is there an ETA for the EIP-1271-wrapped L1 auth fix?

Thanks a lot for your help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions