Account & Billing API

Endpoints for account details, usage, credit purchases, registration, and health checks.

Get account details

GET /account

Retrieve the authenticated user’s account information, plan details, usage counters, and credit balance.

curl https://api.oneshotemail.com/v1/account \
  -H "Authorization: Bearer osm_live_your_key"

Response: 200 OK

{
  "user_id": "usr_a1b2c3d4e5f6",
  "email": "developer@example.com",
  "plan": "solo",
  "usage": {
    "receive": { "used": 142, "limit": 10000 },
    "send": { "used": 23, "limit": 1000 }
  },
  "credits_remaining": 450,
  "billing_cycle_ends": "2026-04-07T00:00:00Z"
}

Response fields:

FieldTypeDescription
user_idstringYour unique account identifier.
emailstringYour account email address.
planstringCurrent plan: free, solo, team, enterprise, max.
usage.receive.usedintReceive addresses created this billing period.
usage.receive.limitintMonthly receive allocation for your plan.
usage.send.usedintSend addresses created this billing period.
usage.send.limitintMonthly send allocation for your plan.
credits_remainingintAvailable credits for overage use.
billing_cycle_endsstringISO 8601 timestamp when the current billing cycle resets.

Purchase credits

POST /account/credits

Initiate a credit purchase via Stripe Checkout. Returns a URL that the user should be redirected to (or opened in a browser) to complete payment.

curl -X POST https://api.oneshotemail.com/v1/account/credits \
  -H "Authorization: Bearer osm_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"amount": 500}'

Request body:

FieldTypeRequiredDescription
amountintYesNumber of credits to purchase.

Available packs: 100, 500, 2000. If the requested amount does not match a pack size, the API selects the closest pack that covers the requested amount.

Response: 200 OK

{
  "checkout_url": "https://checkout.stripe.com/c/pay/cs_live_a1b2c3..."
}

Open the checkout_url in a browser to complete the purchase. After successful payment, credits are added to your account automatically via Stripe webhook.

Error responses

StatusCodeDescription
400VALIDATION_ERRORInvalid amount.
401UNAUTHORIZEDMissing or invalid API key.
403FORBIDDENAccount not yet approved (free tier queue).

Register (free tier)

POST /account/register

Register a new account and join the free tier queue. Accounts may be auto-approved (for .edu emails and known company domains) or placed in a queue.

curl -X POST https://api.oneshotemail.com/v1/account/register \
  -H "Content-Type: application/json" \
  -d '{"email": "developer@example.com"}'

Request body:

FieldTypeRequiredDescription
emailstringYesYour email address.

Response: 202 Accepted (queued)

{
  "status": "queued",
  "queue_position": 47,
  "message": "You're on the list! We'll email you when your account is ready."
}

Response: 201 Created (auto-approved)

{
  "api_key": "osm_live_aBcDeFgHiJkLmNoPqRsT...",
  "message": "You're in! Save this API key -- you won't see it again."
}

The API key is shown once. If you lose it, you will need to regenerate it from account settings.

Auto-approval criteria

Accounts are automatically approved (skip the queue) when:

  • The email domain is .edu (educational institution).
  • The email domain is on the configured company domain allowlist.
  • The account was referred by an existing paid user.

Health check

GET /health

Check the API health status. This endpoint does not require authentication.

curl https://api.oneshotemail.com/v1/health

Response: 200 OK

{
  "status": "ok",
  "region": "ap-southeast-2",
  "version": "1.2.3"
}

Response fields:

FieldTypeDescription
statusstring"ok" when the service is healthy.
regionstringAWS region serving this request.
versionstringCurrent API version deployed.

Use this endpoint for:

  • Monitoring and uptime checks.
  • Verifying connectivity before running a test suite.
  • Confirming the API is reachable from your CI/CD environment.