Added
Manage users through the API (experimental)
about 15 hours ago by ReadMe API
An HR tool or an identity provider can now keep Spendesk members in sync without anyone opening Spendesk: read who they are, then change their name, default cost center, manager and role, and offboard them.
Read — Get Users filters by status (active, archived, pending) and returns each user's roles. Add include for the manager, costCenter, teams and spendingPolicy; each value costs one more lookup, so ask only for what you need. With an organisation-level token, Get Company Users lists the members of one entity: GET /v2/companies/{companyId}/users.
Change — with the experimental:user:manage scope:
| What | Endpoint |
|---|---|
| First and last name | Update User |
| Default cost center, or none | Update User Cost Center |
| Manager, by id or email, or none | Update User Manager |
| Offboard the user from the company | Deactivate User |
and, with the separate experimental:user:role:manage scope, make a user a requester or a controller with Update User Role.
curl --request PUT \
--url https://public-api.spendesk.com/v2/users/<userId>/manager \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{"managerEmail":"[email protected]"}'
What these endpoints refuse
- Companies whose users are managed by an HRIS integration: change users in the HRIS instead.
- Admins, account owners and travel managers cannot be renamed or get a new cost center or manager. Role changes only switch between
requesterandcontroller, and never on the user the token acts for.- The cost center and manager endpoints need the cost centers and reporting managers features switched on for the company.
- Deactivation is refused for an account owner or a user with pending transfers. It removes the user from this company only; they leave Spendesk when it was their last company.
- Role and manager changes answer
409when someone else changed them in the meantime: read the user again before retrying. For roles, send the roles you last read incurrentRoles.