Users API
REST endpoints to list, retrieve, create, update, and delete users in octoja.
Written By Erdinc Akay
Last updated 26 days ago
Users API
The Users API lets you query and manage user records. All endpoints require a valid JWT in the Authorization: Bearer <token> header β see API Authentication for how to obtain one.
For the complete, always-current list of endpoints, parameters, and response fields for the version you are running, use the interactive OpenAPI (Swagger) interface at https://<your-octoja-instance>/openapi/index.html. This article keeps only the permissions, behaviors, and validation rules that the schema cannot express.
Endpoints
Get the current user
GET /api/users/me returns a session-scoped view of the authenticated caller whose shape differs from the regular User object: the email field is named email (not mailAddress), the full groups objects are returned with their resolved permissions (not just groupIds), and an additional preferences field is included. Field-by-field details are in Swagger.
Creating a user
Requires the users.manage permission. Required: mailAddress (the login email address, which must be unique) and lastname. firstname and password are optional; the full field list is in Swagger.
If you create a user without a password, that user has no local password login and needs a linked OIDC / SSO login before they can sign in. A common example is Microsoft SSO. For Microsoft SSO, the first sign-in may require a Microsoft administrator in the Microsoft tenant to grant consent for octoja.
Updating a user
POST /api/users/{id}Requires the users.manage permission. Send only the fields you want to change. Each field is wrapped in an UpdateValue<T> envelope of the shape { "hasValue": true, "value": <T> }; omit the field entirely to leave it untouched. Sending a bare value (for example "newFirstname": "Max") is rejected as a deserialization error. The full updatable-field list is in Swagger; the fields below carry behavior worth knowing:
{ "newFirstname": { "hasValue": true, "value": "Max" }, "newPassword": { "hasValue": true, "value": null }}newMailAddressβ new login email address; must be unique.newPasswordβ avalueofnullremoves the local password login, making the account SSO-only unless a new password is set later.newFirstname/newLastnameβ avalueofnullclears the name.newGroupIdsβ replaces the full group assignment list (not a partial add/remove).newTotpSecretβ avalueofnulldisables TOTP.oidcProvidersToUnlinkβ OIDC providers to unlink, for example["Microsoft"].
Validation rules
newMailAddresswith an empty or whitespace-onlyvalue, or one already used by another user, returns400 Bad Request.newPasswordwith an empty or whitespace-onlyvaluereturns400 Bad Requestβ usenullto remove the password.newGroupIdscontaining an unknown group ID returns400 Bad Request.- A group change that would remove the last effective
groups.managecapability is rejected by the safety guard.
Deleting a user
Requires the users.manage permission. The same safety guard applies: deleting a user is rejected if it would leave no remaining member of a group with the groups.manage permission.
Update your own profile
POST /api/users/me is available to every authenticated user β no users.manage permission required. Fields use the same UpdateValue<T> envelope as "Updating a user" and the endpoint returns the updated user. Behaviors worth knowing:
newFirstnameβ avalueofnullor an empty string clears it.newLastnameβ an empty or whitespace-onlyvalueis rejected with400 Bad Request.newTotpSecretβ avalueofnulldisables TOTP.oidcProvidersToUnlinkβ unlink your own OIDC sign-ins, for example["Microsoft"]. Rejected with400 Bad Requestif it would leave you with no way to sign in (no local password and no remaining linked login).
Change your own password
POST /api/users/me/change-passwordAvailable to every authenticated user. This endpoint uses plain fields (currentPassword, newPassword), not the UpdateValue envelope. It returns 400 Bad Request if either field is empty, if the account has no local password set, or if currentPassword is incorrect. On success the response is 204 No Content.
Remove your own password
DELETE /api/users/me/passwordAvailable to every authenticated user. This removes your local password so the account signs in through SSO only. It returns 400 Bad Request if no password is set, or if the account has no linked OIDC login β octoja always keeps at least one sign-in method, so you cannot remove the password from an account that has no other way to sign in. On success the response is 204 No Content.
Update your preferences
POST /api/users/me/preferences is available to every authenticated user and updates the preferences object returned by GET /api/users/me. It returns the updated preferences object. Behaviors worth knowing:
toggleFavoriteAssetIdβ toggles the device in the favorites list: adds it if absent, removes it if present. Maximum 100 favorites; adding beyond that is rejected with400 Bad Request.startPageβ the page shown after sign-in. One of a fixed set of values (Dashboard,Cases,Devices,Customers,PatchCycles); defaultDashboard.openDevicesInNewTabβ whether device links open in a new browser tab.
Fields worth knowing
The full User object is documented field-by-field in Swagger. A few fields carry behavior that is easy to miss:
mailAddressβ the login email address on the standard User object; noteGET /api/users/mereturns this asemailinstead.groupIdsβ the IDs of the groups this user belongs to; the resolved group objects with permissions are returned only byGET /api/users/me.hasPassword/hasTotpSecretβ booleans that report whether a local password or TOTP is set, without exposing the secret.oidcLoginsβ linked OIDC sign-ins; each entry carriesproviderId(for exampleMicrosoft),subjectId, andlinkedAt.