Create User
POST
/api/v1/users
const url = 'https://api.spartanauth.com/api/v1/users';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"sectorID":"example","username":"example","password":"example","name":"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/users \ --header 'Content-Type: application/json' \ --data '{ "sectorID": "example", "username": "example", "password": "example", "name": "example" }'Creates a user as a member of the specified sector. Depending on the sector’s security settings, the user may be created with just a username and no password, in which case they would need to complete an invite flow or password setup flow before they can log in. Requires the caller to be an admin of the sector or the default sector (if the sector allows user creation by non-admins).
Request Body
Section titled “Request Body ” Media type application/json
object
sectorID
string
username
string
password
optional - depends on settings
string
name
string
Example generated
{ "sectorID": "example", "username": "example", "password": "example", "name": "example"}Responses
Section titled “ Responses ”A successful response.
Media type application/json
object
sub
string
username
string
sectorID
string
enrollmentTransactionId
Set when the sector has MFARequired=true and the user was just created via self-signup with a password. Must be passed to SignupMFABegin to prove ownership of the newly created account.
string
Example generated
{ "sub": "example", "username": "example", "sectorID": "example", "enrollmentTransactionId": "example"}default
Section titled “default ”An unexpected error response.
Media type application/json
object
code
integer format: int32
message
string
details
Array<object>
object
@type
string
key
additional properties
Example generated
{ "code": 1, "message": "example", "details": [ { "@type": "example" } ]}