Skip to main content

1. Register a User

Create a new user and receive default Ethereum + TRON wallets.
curl -X POST https://crypto.westminister.tech/api/v1/users/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "phone_number": "+254712345678",
    "first_name": "John",
    "last_name": "Doe",
    "password": "your-secure-password",
    "role": "customer",
    "kyc_status": "pending"
  }'
Response includes user and wallets with initialized balances.

2. Authenticate

Use login (or login-pin if you set a PIN) to get an access token:
curl -X POST https://crypto.westminister.tech/api/v1/users/login-pin \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "pin": "123456"
  }'
Save the access_token and refresh_token from the response.

3. Call Protected Endpoints

Use the access token for authenticated requests:
curl -X GET "https://crypto.westminister.tech/api/v1/auth/user/email/user@example.com" \
  -H "Authorization: Bearer <your_access_token>"

4. Create an Order (On-Ramp)

Create an order to buy USDT with KES:
curl -X POST https://crypto.westminister.tech/api/v1/auth/orders \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "<customer_uuid>",
    "vendor_id": "<vendor_uuid>",
    "offer_id": "<offer_uuid>",
    "usdt_amount": "100.00",
    "fiat_amount": "14100.00",
    "fiat_currency": "KES",
    "wallet_address": "<your_wallet_address>",
    "payment_method": "mpesa",
    "order_type": "ON_RAMP_BUY",
    "expires_at": "2025-12-31T23:59:59Z"
  }'

5. Initiate Payment

Trigger M-Pesa STK push for the order:
curl -X POST https://crypto.westminister.tech/api/v1/auth/orders/payment \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": "<order_uuid>",
    "phone_number": "254712345678"
  }'

Next Steps

Authentication

Understand refresh tokens and PIN-based login