palbaseDocs

Palbase Auth API · API

POST/admin/test-users

Create test users

Creates test users, all or none, and returns their credentials once: passwords and totp keys are never retrievable afterwards. Either send users (each of the kind it says: an address and password of its own or made, passwordless, unverified, a phone with its fixed code, a fixed email code, a second factor) or a count of users to create with generated credentials; users wins when both are present. At most 1000 per request. Test users skip the breach check and the minimum password length, and are not counted as active users. Their mail and texts are kept in their test inbox (GET /notify/test-users/{user_id}/messages): a phone is texted nothing, a generated address (…@test.invalid) is mailed nothing, a real address is mailed as well. with_tokens also returns an access token per user. 409 user_exists when an email is already taken; 409 test_user_cap_exceeded when the batch would exceed the project's test-user cap (its test users and its unused sign-up addresses). Send an Idempotency-Key to make the call safe to retry.

Called by your server, with the project's secret key.

Headers

Idempotency-Keystring · optionalMakes the creation safe to send again. A retry with the same key and the same request gets the first answer back (marked Idempotent-Replayed: true) instead of creating twice; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.

Request body

countinteger · optionalHow many test users to create with generated credentials. Ignored when users is not empty.
usersobject[] · optionalTest users to create, each of the kind it says (AdminTestUserSpec).
with_tokensboolean · optionalAlso return an access token for each user. Default false.
curl
curl -X POST "https://<your-ref>.palbase.studio/admin/test-users" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"count":0,"users":[{"email":"user@example.com","email_otp":"string","email_verified":false,"mfa":"totp","otp":"string","password":"string","passwordless":false,"phone":"string"}],"with_tokens":false}'

Responses

201The created test users and their credentials

400Validation failed or required field missing

401Missing, invalid, or expired credentials

403Not permitted with this key; or the project is the platform's own (`owner_only`): every change on its admin surface — any account's address, password, factors, sessions or roles, an account made or imported, a sign-in minted, a setting — is its owner's or its operator's alone. The request carries, besides the project's key, the owner's access token (X-Palbase-Owner; a passkey sign-in of the last 15 minutes, else 401 `insufficient_user_authentication`) or the operator's token (X-Palbase-Operator). Its key reads.

409A user with that e-mail exists, or minting this many would exceed the project's test-user cap (`test_user_cap_exceeded`).

413A request carrying an Idempotency-Key has a body over 1 MiB (request_too_large)

422The Idempotency-Key was already used with a different request (idempotency_key_reused)

503Downstream dependency unavailable (typically HIBP / breach service)

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation AdminCreateTestUsers of auth's contract.