Skip to main content
POST
/
2
/
pm
/
auth
/
build
Build auth typed data
curl --request POST \
  --url https://demo-api.mobula.io/api/2/pm/auth/build \
  --header 'Content-Type: application/json' \
  --data '
{
  "address": "<string>",
  "nonce": 0
}
'
{
  "data": {
    "domain": {
      "name": "<string>",
      "version": "<string>",
      "chainId": 123
    },
    "types": {},
    "primaryType": "<string>",
    "message": {
      "address": "<string>",
      "timestamp": "<string>",
      "nonce": "<string>",
      "message": "<string>"
    }
  },
  "hostname": "<string>",
  "took": 123
}

Request Body

address
string
required
The wallet address to authenticate.
nonce
number
default:0
Optional nonce for the authentication message. Use 0 for first-time auth or increment for key rotation.

Response

data
object
EIP-712 typed data to sign.
hostname
string
Server node identifier.
took
number
Request processing time in milliseconds.

Usage Example

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

Integration Example

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 }

Body

application/json
address
string
required
nonce
number
default:0

Response

200 - application/json

Auth typed data

data
object
hostname
string
took
number