> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobula.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Auth Signature

> Build EIP-712 typed data for authenticating with the Polymarket CLOB API. Sign the returned data and submit to Auth Derive to obtain API credentials.

<Warning>**Alpha** — This endpoint is part of the Prediction Markets API, currently in early access. May change without notice.</Warning>

### Request Body

<ParamField body="address" type="string" required>
  The wallet address to authenticate.
</ParamField>

<ParamField body="nonce" type="number" default={0}>
  Optional nonce for the authentication message. Use `0` for first-time auth or increment for key rotation.
</ParamField>

### Response

<ResponseField name="data" type="object">
  EIP-712 typed data to sign.

  <Expandable title="ClobAuthTypedData">
    <ResponseField name="domain" type="object">
      EIP-712 domain.

      <Expandable title="Domain">
        <ResponseField name="name" type="string">Always `"ClobAuthDomain"`.</ResponseField>
        <ResponseField name="version" type="string">Domain version (e.g., `"1"`).</ResponseField>
        <ResponseField name="chainId" type="number">Chain ID (137 for Polygon).</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="types" type="object">EIP-712 type definitions for `ClobAuth`.</ResponseField>
    <ResponseField name="primaryType" type="string">Always `"ClobAuth"`.</ResponseField>

    <ResponseField name="message" type="object">
      Message to sign.

      <Expandable title="Message">
        <ResponseField name="address" type="string">Wallet address.</ResponseField>
        <ResponseField name="timestamp" type="string">Epoch timestamp in seconds.</ResponseField>
        <ResponseField name="nonce" type="string">Nonce value.</ResponseField>
        <ResponseField name="message" type="string">Attestation message: `"This message attests that I control the given wallet"`.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="hostname" type="string">Server node identifier.</ResponseField>
<ResponseField name="took" type="number">Request processing time in milliseconds.</ResponseField>

### Usage Example

```bash theme={null}
curl -X POST "https://api.mobula.io/api/2/pm/auth/build" \
  -H "Content-Type: application/json" \
  -d '{ "address": "0xYourWalletAddress", "nonce": 0 }'
```

### Integration Example

```typescript theme={null}
import { signTypedData } from 'viem/accounts';

// 1. Build auth typed data
const res = await fetch('https://api.mobula.io/api/2/pm/auth/build', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ address: walletAddress, nonce: 0 })
});
const { data: typedData } = await res.json();

// 2. Sign it with your wallet
const signature = await signTypedData({
  ...typedData,
  privateKey: '0x...'
});

// 3. Derive credentials using the signature
const deriveRes = await fetch('https://api.mobula.io/api/2/pm/auth/derive', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    address: walletAddress,
    signature,
    timestamp: typedData.message.timestamp,
    nonce: 0
  })
});
const { data: credentials } = await deriveRes.json();
// credentials = { apiKey, apiSecret, apiPassphrase }
```


## OpenAPI

````yaml POST /2/pm/auth/build
openapi: 3.0.0
info:
  version: 1.0.0
  title: Mobula API
  description: >-
    Documentation of the Mobula API


    **Demo API**: The default server (demo-api.mobula.io) is a demo API with
    rate limits.

    For production use, please use api.mobula.io with an API key from
    https://admin.mobula.io
servers:
  - url: https://demo-api.mobula.io/api/
    description: Demo API (rate limited, for testing only)
  - url: https://api.mobula.io/api/
    description: Production API (requires API key)
security: []
tags:
  - name: V2 - Token
    description: Token details, price, security, ATH, and holder data
  - name: V2 - Market Data
    description: Market details, OHLCV history, and lighthouse metrics
  - name: V2 - Trades
    description: Token trades, enriched trades, and trade filters
  - name: V2 - Wallet
    description: Wallet positions, activity, trades, analysis, and labels
  - name: V2 - Assets
    description: Cross-chain asset details and price history
  - name: V2 - Swap
    description: Swap quoting and execution
  - name: V2 - Perps
    description: Perpetual futures quoting, execution, and positions
  - name: V2 - Bridge
    description: Cross-chain bridge quoting and intent status (Alpha Preview)
  - name: V2 - DeFi
    description: Bonding pools and pulse data
  - name: V2 - Search
    description: Universal fast search
  - name: V2 - Blockchains
    description: System metadata and chain listings
  - name: V1 - Market Data
    description: Market prices, history, sparklines, pairs, and multi-data
  - name: V1 - Wallet
    description: Wallet portfolio, transactions, history, and NFTs
  - name: V1 - Token
    description: First buyers
  - name: V1 - Trades
    description: Market trades by pair
  - name: V1 - Metadata
    description: Token metadata, categories, trendings, and news
  - name: V1 - Assets
    description: List all assets
  - name: V1 - Search
    description: Search for assets, tokens, and pairs
  - name: V1 - DeFi
    description: Bonding pool pulse data
  - name: V1 - Blockchains
    description: Blockchain listings, pairs, and stats
  - name: V1 - Webhooks
    description: Webhook management
  - name: V1 - Feed
    description: Custom feed creation
paths:
  /2/pm/auth/build:
    post:
      tags:
        - V2 - Prediction Markets
      summary: Build the ClobAuth EIP-712 typed data for L1 credential derivation
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                address:
                  type: string
                  minLength: 1
                nonce:
                  type: integer
                  nullable: true
                  minimum: 0
                  maximum: 9007199254740991
                  default: 0
              required:
                - address
      responses:
        '201':
          description: Prediction Markets response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    nullable: true
                    description: >-
                      See the per-endpoint reference for the exact response
                      shape.
                  hostname:
                    type: string
                  took:
                    type: number
                required:
                  - hostname
                  - took

````