API Reference
Users
Here are examples for working with the Users collection through the REST API.
Creating Users
const createPatientUser = async (token) => {
const response = await fetch('https://api.picoshealth.com/v1/users', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: 'patient@example.com',
password: 'SecurePass123!',
firstName: 'John',
lastName: 'Doe',
role: 'patient',
location: 'New York, NY',
}),
});
return response.json();
};
Querying Users
Get All Admin Users
const getAdminUsers = async (token) => {
const response = await fetch(
'https://api.picoshealth.com/v1/users?where={"role":{"equals":"admin"}}',
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Search Users by Email
const searchUserByEmail = async (token, emailPattern) => {
const response = await fetch(
`https://api.picoshealth.com/v1/users?limit=10&where={"email":{"contains":"${emailPattern}"}}`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Get Users by Role
const getUsersByRole = async (token, role) => {
const response = await fetch(
`https://api.picoshealth.com/v1/users?where={"role":{"equals":"${role}"}}&limit=100`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Updating Users
Update User Profile
const updateUserProfile = async (token, userId, updates) => {
const response = await fetch(
`https://api.picoshealth.com/v1/users/${userId}`,
{
method: 'PATCH',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstName: updates.firstName,
lastName: updates.lastName,
location: updates.location,
}),
}
);
return response.json();
};
Getting User Details
const getUserDetails = async (token, userId) => {
const response = await fetch(
`https://api.picoshealth.com/v1/users/${userId}?depth=2`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Last Updated: June 22, 2026