Skip to content

Latest commit

 

History

History
150 lines (116 loc) · 3.09 KB

File metadata and controls

150 lines (116 loc) · 3.09 KB
title Auth And Onboarding
description Curl examples for dashboard auth, merchant selection, and merchant onboarding.

Auth And Onboarding

Sign Up

curl --location "$BASE_URL/auth/signup" \
  --header "Content-Type: application/json" \
  --data '{
    "email": "operator@example.com",
    "password": "StrongPass#123",
    "merchant_id": "merchant_demo"
  }'

Login

curl --location "$BASE_URL/auth/login" \
  --header "Content-Type: application/json" \
  --data '{
    "email": "operator@example.com",
    "password": "StrongPass#123"
  }'

Response contains a dashboard JWT:

{
  "token": "eyJ...",
  "user_id": "user_123",
  "email": "operator@example.com",
  "merchant_id": "merchant_demo",
  "role": "admin",
  "merchants": []
}

Current User

curl "$BASE_URL/auth/me" \
  --header "$AUTH_HEADER"

List User Merchants

curl "$BASE_URL/auth/merchants" \
  --header "$AUTH_HEADER"

Switch Merchant

curl --location "$BASE_URL/auth/switch-merchant" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{ "merchant_id": "merchant_demo" }'

Create Merchant From Dashboard

curl --location "$BASE_URL/onboarding/merchant" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{ "merchant_name": "Demo Merchant" }'

Logout

curl --location "$BASE_URL/auth/logout" \
  --header "$AUTH_HEADER" \
  --request POST

Verify Email

Public route — the link sent by the signup email-verification flow calls this with the token from the email.

curl "$BASE_URL/auth/verify-email?token=vf_9f21a6c0..."
{ "message": "Email verified successfully." }

Change Password

curl --location "$BASE_URL/auth/change-password" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{
    "current_password": "StrongPass#123",
    "new_password": "EvenStrongerPass#456"
  }'
{ "message": "Password updated successfully." }

Team Management

Invite and manage members on the authenticated merchant account. Inviting requires the caller's JWT to carry the admin role.

List Members

curl "$BASE_URL/merchant/members" \
  --header "$AUTH_HEADER"
[
  { "user_id": "user_123", "email": "operator@example.com", "role": "admin" },
  { "user_id": "user_456", "email": "teammate@example.com", "role": "member" }
]

Invite A Member

curl --location "$BASE_URL/merchant/members/invite" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{ "email": "teammate@example.com", "role": "member" }'

role is optional and defaults to "member"; the only other accepted value is "admin".

{
  "email": "teammate@example.com",
  "is_new_user": true,
  "password": "TempPass#8821",
  "role": "member"
}

password is only present when the invite creates a brand-new user account — share it out of band so they can log in and change it. Inviting an email that's already a user omits password and just adds the membership.