Bulk User Import
Import up to 1,000 users per batch with legacy bcrypt or modern Argon2id password hashes. Transparent upgrade to Argon2id upon next sign-in.
Importing users from another platform#
When migrating from Supabase, Firebase, Auth0, or a custom authentication database, users expect their existing passwords to keep working without a global password reset.
Aurabase provides a high-throughput bulk import endpoint (POST /v1/auth/admin/users/import) capable of ingesting up to 1,000 users per request. The operation returns an itemized status report so invalid records do not block the rest of the batch.
Supported password hashes and transparent upgrade#
The import endpoint supports the following password hashing algorithms:
| Algorithm | Identifiers | Behavior |
|---|---|---|
| Argon2id | $argon2id$v=19$m=... | Verified directly using OWASP parameters. |
| bcrypt | $2a$, $2b$, $2y$ | Verified on login and transparently re-encoded to Argon2id upon first successful authentication. |
If no password_hash is provided for a user, the account is created without a password. The user can authenticate using Magic Links, Email/SMS OTP, or a password reset link.
Bulk import endpoint#
Requires administrator authorization (service_role key).
curl -X POST "$AURABASE_URL/v1/auth/admin/users/import" \
-H "apikey: $AURABASE_SERVICE_ROLE_KEY" \
-H "Authorization: Bearer $AURABASE_SERVICE_ROLE_KEY" \
-H "Content-Type: application/json" \
-d '{
"users": [
{
"email": "alice@example.com",
"email_verified": true,
"password_hash": "$2b$12$e8kPM4QJ8a2x4K7hM0uL.OeQ7f...",
"name": "Alice Johnson",
"user_metadata": { "department": "Engineering" }
},
{
"email": "bob@example.com",
"email_verified": false,
"password_hash": "$argon2id$v=19$m=65536,t=3,p=4$..."
}
]
}'
Response (200 OK)
The response details the total number of records processed along with an itemized report:
{
"data": {
"created": 2,
"skipped": 0,
"errors": 0,
"report": [
{
"index": 0,
"email": "alice@example.com",
"status": "created",
"id": "e3b0c442-98fc-1c14-9afb-f4c599684824"
},
{
"index": 1,
"email": "bob@example.com",
"status": "created",
"id": "7d2b5129-3bdf-48bc-8919-4b684df69921"
}
]
}
}
If an email already exists in the project, it is marked as skipped rather than raising a fatal error.
TypeScript SDK#
Use authAdmin.importUsers():
import { createClient } from '@aurabase/aurabase-js'
const aura = createClient(process.env.AURABASE_URL!, process.env.AURABASE_SERVICE_ROLE_KEY!)
const usersToImport = [
{
email: 'user1@example.com',
emailVerified: true,
passwordHash: '$2b$12$e8kPM4QJ8a2x4...',
name: 'User One',
userMetadata: { plan: 'pro' },
},
{
email: 'user2@example.com',
emailVerified: false,
passwordHash: '$argon2id$v=19$m=65536,t=3,p=4$...',
name: 'User Two',
},
]
const { data, error } = await aura.authAdmin.importUsers(usersToImport)
if (error) {
console.error('Import failed:', error.message)
} else {
console.log(`Import summary: ${data.created} created, ${data.skipped} skipped, ${data.errors} errors`)
for (const item of data.report) {
if (item.status === 'error') {
console.warn(`Row ${item.index} (${item.email}) error: ${item.error}`)
}
}
}
Import via Aurabase Studio#
You can also import users directly through the web interface:
- Navigate to Authentication › Users in your project dashboard.
- Click the Import users button in the top toolbar.
- Choose JSON or CSV format. You can click Insert sample to inspect the expected schema.
- Paste your data and click Start Import.
- Inspect the batch summary and row-by-row status report.