Skip to main content

Prerequisites

  • A valid Onion Finance API Key
  • No SDK or Node.js setup required (all calls use the API)

Client Authentication

1

1. Request OTP

email
string
required
Email address that will receive the one-time passcode.
name
string
Optional display name for the client.
curl -X POST https://api.useonion.xyz/v1/client-auth/otp \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "name": "Optional Name"
  }'
message
string
Always “OTP sent” when successful.
2

2. Verify OTP

email
string
required
Email used in the previous step.
otp
string
required
Six-digit OTP code.
curl -X POST https://api.useonion.xyz/v1/client-auth/verify \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "otp": "123456"
  }'
token
string
required
JWT used in the x-client-auth header.
3

3. Check Auth Status

x-client-auth
string
required
JWT from the verify step.
curl -X GET https://api.useonion.xyz/v1/client-auth/status \
  -H "x-client-auth: <JWT_TOKEN>"
id
string
required
Client UUID.
email
string
required
Client email.
name
string
Optional display name.
createdAt
string
ISO-8601 timestamp.
updatedAt
string
ISO-8601 timestamp.
4

4. Logout

x-client-auth
string
required
JWT from the verify step.
curl -X POST https://api.useonion.xyz/v1/client-auth/logout \
  -H "x-client-auth: <JWT_TOKEN>"
success
boolean
Returns true when the client is logged out.

Example: List Transactions

curl -X GET https://api.useonion.xyz/v1/transactions \
  -H "x-api-key: sk_live_..."