Auth API reference

Auth API · End-Users

post/v1/apps/{app_id}/end-users/importAuth

Queue a bulk end-user import. Body is NDJSON — one JSON object per line. Returns 202 with a job id; poll `GET .../import/:jobId` for progress and the per-row error report.

Row fields: `email` (required), `username`, `display_name`, `role`, `tenant_slugs` (array), `external_id`, `metadata`, `email_verified`, and `password_hash` + `password_hash_algorithm`. `password_hash_algorithm` is `argon2id` or `bcrypt`. **argon2id** hashes are accepted at any parameters. **bcrypt** hashes (`$2a$`, `$2b$`, `$2y$` — Auth0, PHP `password_hash`, Spring, node `bcrypt`, Devise / Rails, Laravel, Django) are accepted at any valid cost (4-31), verified on the user's first signin and replaced by an argon2id hash of the same password in that request, so the user keeps their password and never notices. Signin pads a bcrypt verify up to the argon2id floor, so at cost 10 and below an imported account cannot be told apart by timing; at cost 11 and above the verify is slower than the floor and answers when it finishes — a small timing difference on migrated accounts only, gone after each one's first signin. A re-run is idempotent: rows match on `external_id` first, then the primary email, and update rather than duplicate. An existing password, an already-verified address and an existing member's role are never overwritten — see the module docs for why each one.

Path parameters

app_id*string

Id of the app.

Headers

Idempotency-Keystring

Stripe-style idempotency key. A retried import without one queues a SECOND job over the same file; the rows themselves are idempotent (matched on `external_id` then email) but the duplicate job muddies the report. 24h TTL.

Response · 202 Import queued. Poll the job for progress.

id*string

Unique identifier of the import job.

app_id*string

The Auth app the import job belongs to.

status*object

`succeeded` means the job ran to completion, not that every row landed — read `failed_count`.

total_rows*number

Rows in the uploaded file.

processed_rows*number

Rows processed so far.

created_count*number

Rows that created a new user.

updated_count*number

Rows that updated an existing user.

failed_count*number

Rows that failed; see `errors`.

errors*array

First 500 per-row failures. `failed_count` stays exact.

error_message*string

Set when the JOB itself aborted, as opposed to a row failing.

created_at*string · date-time

When the import job was created (ISO 8601).

started_at*string · date-time

When the job started running (ISO 8601), or `null` while queued.

finished_at*string · date-time

When the job finished (ISO 8601), or `null` while it runs.

Example

Request

POST https://api.auth.productcraft.co/v1/apps/{app_id}/end-users/import
Authorization: Bearer YOUR_TOKEN

Response

{
  "id": "string",
  "app_id": "string",
  "status": {},
  "total_rows": 0,
  "processed_rows": 0,
  "created_count": 0,
  "updated_count": 0,
  "failed_count": 0,
  "errors": [
    {
      "line": 0,
      "error": "string"
    }
  ],
  "error_message": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "started_at": "2026-01-01T00:00:00.000Z",
  "finished_at": "2026-01-01T00:00:00.000Z"
}