Skip to content

Create a seed user

POST
/admin/seed/users

Creates a user for seed data or tests, with an optional password and join date. If a user with exactly that username already exists, you get that user back with a 200 instead, and their details and password aren’t changed.

Leave out password, or send an empty one, and the user can’t sign in with a password; a password you do send is stored hashed. usergroup defaults to 2, the regular legacy group. This endpoint doesn’t give the user any role.

A new user gets a federation encryption key, and so does an existing user who doesn’t have one yet, so a 200 can still change something. A new user also gets an admin.seed.user_created audit event, written on a best-effort basis after the user is saved.

It’s for seed and test tooling, not everyday user management. You need system.admin; the endpoint works on any instance, not only demo ones.

object
username
required

Must be unique; matching is exact, so case matters. If a user with this username exists, the request returns them instead of creating one.

string
>= 1 characters <= 50 characters
fullname
string
nullable <= 100 characters
email

Must be a valid address, or the request gets a 400. Only the address part is stored, so Ana <ana@example.com> is saved as ana@example.com.

string format: email
nullable
password

A password for the new user, stored hashed. Leave it out, or send null or an empty string, to create a user who can’t sign in with a password.

string
nullable
usergroup

The legacy permission group, 2 if you leave it out. Older parts of the app read it; it doesn’t give the user a role or capabilities.

integer format: int64
nullable
approved

Whether the account is approved. Defaults to true.

boolean
default: true
created_at

When the user joined. Defaults to now.

string format: date-time
nullable

A user with this username already exists. You get their ref; their details aren’t changed.

object
ref
required

The user’s ref. Pass it as author_user_ref when seeding their comments.

integer format: int64
username
required
string
already_existed
required

True if the username already existed (status 200), false for a new user (status 201).

boolean

User created.

object
ref
required

The user’s ref. Pass it as author_user_ref when seeding their comments.

integer format: int64
username
required
string
already_existed
required

True if the username already existed (status 200), false for a new user (status 201).

boolean

Malformed request

object
error
required

Human-readable error summary

string
Example
the request could not be completed

Authentication required, missing, or invalid

object
error
required

Human-readable error summary

string
Example
the request could not be completed
Example
{
"error": "authentication required: sign in and retry with a valid session or API token"
}

Authenticated but missing required capabilities

object
error
required

Human-readable error summary

string
Example
the request could not be completed