Users
Kojo's Users endpoint helps provision and administer who is allowed access to the system, and what they're allowed to do.
Schema​
User​
important
Admins may perform any operation within Kojo, including modifying any entity such as jobs, orders, and users.
| Name | Type | Description | Example |
|---|---|---|---|
| admin | boolean | If the user is an admin | true |
| avatarUrl | string? | A url to a png or jpeg resource which will render as the user's account photo | "https://coolPics.com/mh.png" |
| displayName | string | The user's display name | "Matt Hernandez" |
string | The user's unique email address | "mh@bestsales.com" | |
| firstName | string | The user's first name | "Matt" |
| id | ID | The unique user ID | "ckmnpybisiy5x08abky4g2d1f" |
| jobs | Job[] | The list of jobs the user is assigned to | See the Jobs docs |
| lastName | string | The user's last name | "Hernandez" |
| phone | string? | The user's phone number | "5131234567" |
| role | UserRole | The user's role | Field |
UserRole​
| Value | Description |
|---|---|
BackOffice | The user will have access to Kojo Office, but is not listed as a Purchasing Agent in various places |
Field | The user will have access to Kojo Jobsite |
FieldOrdering | The user will have access to Kojo Jobsite and may send Orders directly to vendors |
Procurement | The user will have access to Kojo Office |
Warehouse | The user will have access to the warehouse module in Kojo |
Queries​
user​
Used to read a single user.
Parameters​
| Name | Description | Example |
|---|---|---|
| id | The ID of the user to fetch | "ckmnpybisiy5x08abky4g2d1f" |
Response​
A single User object.
Example Query​
query {
user(id: "ckmnpybisiy5x08abky4g2d1f") {
displayName
id
}
}
Example Response​
{
"displayName": "Matt Hernandez",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
users​
Read all users, with pagination.
Parameters​
Accepts all standard pagination parameters.
Allowed orderBy fields: createdAt, displayName, email, id, updatedAt.
Allowed filter fields: admin, createdAt, displayName, email, id, phone, updatedAt.
Response​
A list of User objects.
Example Query​
query {
users(limit: 10, orderBy: displayName) {
displayName
id
}
}
Example Response​
[
{
"displayName": "Benji Orlansky",
"id": "ckmnpybisiy5x08abky4g2f1d"
},
{
"displayName": "Matt Hernandez",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
]
Mutations​
addUserToJob​
See this mutation documented in Jobs.
removeUserFromJob​
See this mutation documented in Jobs.
inviteUser​
Creates a new user and sends them a registration email.
Parameters​
| Name | Type | Default | Description | Example |
|---|---|---|---|---|
| admin | boolean? | false | If the user is an admin | true |
| avatarUrl | string? | null | A url to a png or jpeg resource which will render as the user's account photo | "https://coolPics.com/mh.png" |
string | The user's unique email address | "mh@bestsales.com" | ||
| firstName | string | The user's first name | "Matt" | |
| lastName | string | The user's last name | "Hernandez" | |
| phone | string? | null | The user's phone number | "5131234567" |
| role | UserRole | The user's role | Field |
Response​
The created User.
Example Mutation​
mutation {
inviteUser(
admin: true
email: "mh@bestsales.com"
firstName: "Matt"
lastName: "Hernandez"
role: BackOffice
) {
displayName
id
}
}
Example Response​
{
"displayName": "Matt Hernandez",
"id": "ckmnpybisiy5x08abky4g2d1f"
}