Auth API reference

Auth API · Consumer-Auth

post/{app_slug}/v1/auth/request-password-resetAuth

Mint a password-reset code (PAK-required)

Mints a fresh 6-digit password-reset code for the EndUser owning the named contact. Body must contain exactly one of `email` / `phone` — the contact must be verified (otherwise an attacker who registered an unverified contact could push a reset on another user's account, were the per-app email uniqueness ever breached). The reset itself is account-scoped (revokes all sessions, replaces password) — the contact only acts as the lookup key. PAK-required: `auth.user.password-reset.create`. Returns `{ code, expires_at }` on success, `{}` on no-match (uniform shape prevents enumeration). Issuing a reset code invalidates any previously issued, unconsumed reset code for the account — only the most recent one is accepted. Renamed from /auth/request-reset.

Path parameters

app_slug*string

Slug of the app.

Request body

emailstring

Email contact value to target. Set this OR `phone`, not both.

Example: "jane@example.com"

phonestring

Phone contact value (any format the customer normalised; recommended E.164). Set this OR `email`, not both.

Example: "+15551234567"

Response · 201 `{ code, expires_at }` when the contact matches a verified account; `{}` otherwise.

code*string

Plaintext 6-digit code. Returned when the contact matches an EndUser in this app and the precondition is satisfied (contact unverified, for verification; contact verified, for reset). Otherwise the response is `{}` (no code) — same shape on both branches to prevent enumeration.

Example: "123456"

expires_at*string

Code expiry, ISO 8601. Codes live for 10 minutes.

Example: "2026-05-09T17:30:00.000Z"

Example

Request

POST https://api.auth.productcraft.co/{app_slug}/v1/auth/request-password-reset
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "email": "jane@example.com",
  "phone": "+15551234567"
}

Response

{
  "code": "123456",
  "expires_at": "2026-05-09T17:30:00.000Z"
}