HRIS Integration - User Synchronization
Selflessly User API
Use the Selflessly User API to manage your Selflessly account: create, update, and delete users from your account. Also, list the current account users.
Base URL | https://customer-api.selflessly.io |
Process Overview
- Get an API Token
- For all subsequent functions:
- The authorization will be “Bearer Token”. Use the access token acquired in Step 1
- Content-Type application/json
- Perform various functions (list users, add users, delete users, etc…)
Get an API Token
POST /api/v1/token
Request
Content Type:: application/x-www-form-url-encoded
Field name | Required? | Type | Value |
client_id | ✔️ | string | |
client_secret | ✔️ | string | |
grant_type | ✔️ | string | password |
username | ✔️ | string | |
password | ✔️ | string |
The client_id and client_secret will be provided by selflessly. grant_type will be “password”. The username and password can be any user with admin access to your account (though we recommend a specific API user.)
Response
{
access_tokenstring nullable: true
expires_ininteger
token_typestringnullable: true
refresh_tokenstring nullable: true
scopestring nullable: true
}
Refresh the token (if needed)
POST /api/v1/token/refresh
List the users
GET /api/v1/users
Request
Field name | Required? | Type | Notes |
skip | No | integer | |
take | No | integer | Default is 50 |
Response (key fields)
{
items [{
idinteger
firstNamestringnullable: true
lastNamestringnullable: true
emailstringnullable: true
role {
namestring
idinteger
}
createdstring($date-time)
volunteerTimeOffinteger($int32)
matchAmountinteger($int32)
matchAmountCurrencyIdinteger($int32)
impactDollarsAvailableinteger($int32)
countrystringnullable: true
statestringnullable: true
groups
[{
idinteger
groupNamestring
}]
deletedstring($date-time) nullable: true
}]
}
Note: If deleted is null, the user is considered “active”.
Status Codes
200 | Ok |
Add a new user
POST /api/v1/users
Request
UserRequest (see details below)
NOTE: A password is not required, as the user will be notified of the new account by email and will be able to create a password or use SSO.
Response
UserResponse (see details below)
Status Codes
200 | Ok |
400 | Error found. See “errors” for more information. |
Update a user
PUT /api/v1/users/{userId}
Request
UserRequest (see details below)
Include an email address, but it will not be updated in the system.
Response
UserResponse (see details below)
Status Codes
200 | Ok |
500 | User not found |
Get a Specific User
GET /api/v1/users/{userId}
Response
UserResponse (see details below)
Status Codes
200 | Ok |
404 | User not found |
Delete a User
DELETE /api/v1/users/{userId}
Status Codes
200 | Ok |
404 | User not found |
UserRequest
{
firstNamestringnullable: true
lastNamestringnullable: true
emailstring
typeinteger(see “Roles” below)
volunteerTimeOffinteger($int32)
matchAmountinteger($int32)
matchAmountCurrencyIdinteger($int32)(defaults to USD)
groupIds [ integer ]comma-separated integers
(see “Groups” below)
passwordstringnullable: true
impactDollarsAvailableinteger($int32)
countrystringnullable: true
statestringnullable: true
}
Roles:
ID | Name |
2 | Admin |
3 | Employee (this is the most common option) |
6 | Champion |
Groups
To specify a user group in the API, the group must first exist in the application. Company Administrators have the ability to make a group in the application.
To list the groups available:
GET /api/v1/groups
From there, the IDs are available. When you want to add/update a user, use these IDs for the “groups” parameter
UserResponse
idinteger
firstNamestringnullable: true
lastNamestringnullable: true
emailstring
roleIdinteger
avatarUrlstring
countrystring
statestring
isActiveboolean
hasJoinedboolean
updatedDateTime
createdDateTime
deletedDateTime
The following fields will also be returned, but are likely less applicable in most use cases. Documentation can be provided if needed.
RoleRolesDto
UsersAdditionalUsersAdditionalDto
UsersCompanyAdditionalUserCompanyAdditionalDto
UserGroupsList<UserGroupDto>
FavoriteCausesList<FavoriteCausesDto>
FavoriteNonprofitsList<FavoriteNonprofitsDto>
UserSkillsList<UserSkillsDto>
Currencies
To specify a currency type for the match amount in the API (other than USD), obtain the currency id from the following:
GET /api/v1/currencies