Organizations
Organizations are a fundamental part of how Caddie organizes access to data and customized chat experiences.
Create an organization
Name and slug are required, other fields are optional. The "slug" is a short identifier for the organization and should be set to a short, dash-separated version of the organization name.
If userId is provided, that user will be assigned as owner of the organization. Otherwise, the userId will default to the active user.
Note that only application-level admin users can create organizations. Any other user will encounter an unauthorized error.
fetch('http://localhost:3000/api/auth/organization/create', {
method: 'POST',
headers: {
"Content-Type": 'application/json',
"X-API-KEY": "",
},
body: JSON.stringify({
name: '',
slug: '',
userId: '',
logo: '',
metadata: '',
keepCurrentActiveOrganization: ''
})
})
Get full organization metadata
Returns the metadata for the organization in 'X-ORGANIZATION-ID' header.
fetch('http://localhost:3000/api/auth/organization/get-full-organization', {
method: "GET",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "",
"X-Organization-ID": ""
},
})
Update organization
The body must contain the organizationId field, to specify the organization that will be updated. Note, this need not match the X-ORGANIZATION-ID header.
fetch('http://localhost:3000/api/auth/organization/update', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': '',
},
body: JSON.stringify({
data: {
name: '',
slug: '',
userId: '',
logo: '',
metadata: '',
keepCurrentActiveOrganization: ''
},
organizationId: ''
})
})
Delete organization
fetch('http://localhost:3000/api/auth/organization/delete', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': ''
},
body: JSON.stringify({
organizationId: ""
})
})
Note, only user's with the role of "owner" of an organization can delete it. Admins of an organization cannot.