Bulk Import Users
const url = 'https://api.spartanauth.com/api/v1/sectors/example/users/bulk-import';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"users":[{"email":"example","name":"example","givenName":"example","familyName":"example","emailVerified":true,"hashedPassword":"example","passwordHashAlgorithm":"example","sendInvite":true,"phoneNumber":"example","locale":"example","address":{"formatted":"example","streetAddress":"example","locality":"example","region":"example","postalCode":"example","country":"example"},"nickname":"example","gender":"example","birthdate":"example","zoneinfo":"example","website":"example","picture":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.spartanauth.com/api/v1/sectors/example/users/bulk-import \ --header 'Content-Type: application/json' \ --data '{ "users": [ { "email": "example", "name": "example", "givenName": "example", "familyName": "example", "emailVerified": true, "hashedPassword": "example", "passwordHashAlgorithm": "example", "sendInvite": true, "phoneNumber": "example", "locale": "example", "address": { "formatted": "example", "streetAddress": "example", "locality": "example", "region": "example", "postalCode": "example", "country": "example" }, "nickname": "example", "gender": "example", "birthdate": "example", "zoneinfo": "example", "website": "example", "picture": "example" } ] }'Imports a list of users into a sector in a single request. Each record may include a full OIDC profile, an optional pre-hashed password with its algorithm, and an optional flag to send an invite email. Processing is best-effort — per-user results are returned for each entry regardless of individual failures. Requires the caller to be an admin of the sector or the default sector.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body
Section titled “Request Body ”object
BulkImportUser represents a single user record in a bulk import request.
object
Required: email address used as the user’s login identifier.
Full display name (e.g. “Jane Smith”).
Given (first) name.
Family (last) name.
Whether the email address is already verified in the source system.
Pre-hashed credential from the source system (optional). Must be supplied together with password_hash_algorithm. Currently only “bcrypt” hashes can be verified at login; hashes with other algorithms are stored but login will fail until the algorithm is added to the verification pipeline. In that case, set send_invite=true so the user receives an invite email to set a new password.
Algorithm used to produce hashed_password (e.g. “bcrypt”, “argon2id”, “scrypt”). Required when hashed_password is non-empty.
When true, send an invite email to this user after the profile is created. Ignored when hashed_password is also set (the account is immediately usable).
Additional OIDC standard profile fields.
object
Example generated
{ "users": [ { "email": "example", "name": "example", "givenName": "example", "familyName": "example", "emailVerified": true, "hashedPassword": "example", "passwordHashAlgorithm": "example", "sendInvite": true, "phoneNumber": "example", "locale": "example", "address": { "formatted": "example", "streetAddress": "example", "locality": "example", "region": "example", "postalCode": "example", "country": "example" }, "nickname": "example", "gender": "example", "birthdate": "example", "zoneinfo": "example", "website": "example", "picture": "example" } ]}Responses
Section titled “ Responses ”A successful response.
object
Per-user results in the same order as the input list.
BulkImportUserResult is the per-user outcome included in BulkImportUsersResponse.
object
The email address from the submitted BulkImportUser record.
Subject identifier assigned to the created profile (empty on error or skip).
One of: “created”, “skipped” (email already exists), “error”.
Human-readable error description when status is “error”.
Summary counts.
Example generated
{ "results": [ { "email": "example", "sub": "example", "status": "example", "errorMessage": "example" } ], "total": 1, "created": 1, "skipped": 1, "errors": 1}default
Section titled “default ”An unexpected error response.
object
object
Example generated
{ "code": 1, "message": "example", "details": [ { "@type": "example" } ]}