Adding Users
To allow users to interact with Caddie, you must create them, add them to an organization, and grant them access to an agent.
Create new user
fetch('http://localhost:3000/api/auth/admin/create-user', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': '',
'X-ORGANIZATION-ID': ''
},
body: JSON.stringify({
email: '',
password: '',
name: '',
})
})
Your request body must follow this field schema:
- email: string, must be valid email address
- password: string, at least 8 characters
- name: string, at least 1 character
If successful, you'll recieve a response with this JSON body:
{
"user": {
"name": "",
"email": "",
"emailVerified": false,
"image": null,
"createdAt": "2025-07-08T16:48:47.190Z",
"updatedAt": "2025-07-08T16:48:47.190Z",
"role": "user",
"banned": null,
"banReason": null,
"banExpires": null,
"id": ""
}
}
The user can be later identified using their id or email.
Add user as member of organization
Use the /api/organization/add-member endpoint to add a member to organization specified by X-ORGANIZATION-ID. You can provide either the user's id or email to identify them.
fetch('http://localhost:3000/api/auth/organization/add-member', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': '',
'X-ORGANIZATION-ID': ''
},
body: JSON.stringify({ // optionally provide user Id or email, but at least one or the other must be provided
"userId": "",
"userEmail": ""
})
})
Grant user access to agent
Provide the user's email to the agent/agentId/users endpoint. If the provided user is not already a member of the organization the agent belongs to, they will be automatically added as a member.
fetch("http://localhost:3000/api/agent/id-of-agent/users", {
method: "POST",
headers: {
"Content-Type": 'application/json',
"X-API-KEY": '',
"X-ORGANIZATION-ID": ''
},
body: {
"email": '',
"isActive": true //optional, defaults to true
}
})
Field schema for valid inputs:
- email: required string field, must be a valid email
- isActive: optional boolean field (defaults to true). isActive parameter can be passed if you want to add a user, but wait to activate them.