Update User
PUT
/api/v1/users/{sub}
const url = 'https://api.spartanauth.com/api/v1/users/example';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"profile":{"sub":"example","name":"example","givenName":"example","familyName":"example","middleName":"example","nickname":"example","preferredUsername":"example","profile":"example","picture":"example","website":"example","email":"example","emailVerified":true,"gender":"example","birthdate":"example","zoneinfo":"example","locale":"example","phoneNumber":"example","phoneNumberVerified":true,"address":{"formatted":"example","streetAddress":"example","locality":"example","region":"example","postalCode":"example","country":"example"},"updatedAt":"example","createdAt":"example"},"sectorID":"example","isAdmin":true,"setAdminExplicitly":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.spartanauth.com/api/v1/users/example \ --header 'Content-Type: application/json' \ --data '{ "profile": { "sub": "example", "name": "example", "givenName": "example", "familyName": "example", "middleName": "example", "nickname": "example", "preferredUsername": "example", "profile": "example", "picture": "example", "website": "example", "email": "example", "emailVerified": true, "gender": "example", "birthdate": "example", "zoneinfo": "example", "locale": "example", "phoneNumber": "example", "phoneNumberVerified": true, "address": { "formatted": "example", "streetAddress": "example", "locality": "example", "region": "example", "postalCode": "example", "country": "example" }, "updatedAt": "example", "createdAt": "example" }, "sectorID": "example", "isAdmin": true, "setAdminExplicitly": true }'Updates a user’s profile information and admin status. Requires the caller to be an admin of the user’s sector or the default sector (if the sector allows user update by non-admins), or the user themselves (proven by a valid transactionID from a recent authentication flow). This endpoint is intended for internal use by the admin settings UI and user profile page. Only sector admins can set another user to be an admin. When updating admin status, the set_admin_explicitly flag must be set to true to prevent accidental overwriting of the default false value.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” sub
required
string
Request Body
Section titled “Request Body ” Media type application/json
object
profile
object
sub
string
name
string
givenName
string
familyName
string
middleName
string
nickname
string
preferredUsername
string
profile
string
picture
string
website
string
email
string
emailVerified
boolean
gender
string
birthdate
string
zoneinfo
string
locale
string
phoneNumber
string
phoneNumberVerified
boolean
address
object
formatted
string
streetAddress
string
locality
string
region
string
postalCode
string
country
string
updatedAt
string format: int64
createdAt
string format: int64
sectorID
string
isAdmin
The desired admin state (only applied when set_admin_explicitly = true)
boolean
setAdminExplicitly
Must be true for is_admin to be applied — prevents default false from overwriting
boolean
Example generated
{ "profile": { "sub": "example", "name": "example", "givenName": "example", "familyName": "example", "middleName": "example", "nickname": "example", "preferredUsername": "example", "profile": "example", "picture": "example", "website": "example", "email": "example", "emailVerified": true, "gender": "example", "birthdate": "example", "zoneinfo": "example", "locale": "example", "phoneNumber": "example", "phoneNumberVerified": true, "address": { "formatted": "example", "streetAddress": "example", "locality": "example", "region": "example", "postalCode": "example", "country": "example" }, "updatedAt": "example", "createdAt": "example" }, "sectorID": "example", "isAdmin": true, "setAdminExplicitly": true}Responses
Section titled “ Responses ”A successful response.
Media type application/json
object
sub
string
username
string
sectorID
string
Example generated
{ "sub": "example", "username": "example", "sectorID": "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" } ]}