Users
Data model
User
JSON:API resource type: user.
firstNamestringFirst name of the user.
lastNamestringLast name of the user.
contactEmailstringThe contact email address of the user.
Relationships
clientclientClient that owns the user. Required. This relationship does NOT grant the user any access to the client (or any of its sub-resources).
readAccessToReportingEntitiesarray of reporting-entityReporting entities the user has read access to, i.e. the reporting entities the user can view in MyAleta. Optional.
Invite
JSON:API resource type: invite.
Invitation link to enable a user to connect a third-party identity to their Aleta user account. Once connected the third-party identity can be used for authentication. MyAleta supports the following identity providers: Apple, Google, Microsoft.
statestringDescription of the current state of the invite. Possible values:
valid,used,expired,cancelled.linkstringURL for the invite. This is the link that should be sent to the user.
restrictedToIdentityProviderstring | nullThe invite may be restricted to a single identity provider. Possible values:
apple,google,microsoft,""(no restriction – the user can select any of the supported identity providers). An invite created without a provider hasnull(no restriction).restrictedToEmailstringThe invite is locked to this specific email address. This should match the email address registered by the identity provider (case-insensitive). Defaults to the contact email address of the user when creating the invite.
expirationstringISO 8601 representation of the invite's expiration timestamp. Defaults to 60 days after creation.
Relationships
useruserThe user account the invite grants access to. Required.
Create a user
Create a user account owned by the client given by id. Returns 201.
firstName, lastName and contactEmail are required; a request without one of them is refused with 400. readAccessToReportingEntities must name at least one reporting entity, and every reporting entity must belong to the client or a client below it; an unknown reporting entity, or one that belongs to another client, is refused with 400. An unknown client returns 404.
When contactEmail belongs to an existing active user, that user is given access instead of a new one being created. An email that belongs to a deactivated user is refused with 409.
Path parameters
idstringClient identifier, see
GET /clients. Required.
curl -X POST https://api.aleta.ai/api/v2/clients/6698d912deb64c8b2fec2c08/users \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "user",
"attributes": {
"firstName": "New user first name",
"lastName": "New user last name",
"contactEmail": "user-contact-email@example.com"
},
"relationships": {
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "cb4b00eef0af406faddc82ae" },
{ "type": "reporting-entity", "id": "51c10fb37fcada1fbda0eccf" }
]
}
}
}
}'
{
"data": {
"id": "107b590a-3761-4f8f-b776-f8f2fe346e81",
"type": "user",
"attributes": {
"firstName": "New user first name",
"lastName": "New user last name",
"contactEmail": "user-contact-email@example.com"
},
"relationships": {
"client": {
"data": { "type": "client", "id": "6698d912deb64c8b2fec2c08" }
},
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "cb4b00eef0af406faddc82ae" },
{ "type": "reporting-entity", "id": "51c10fb37fcada1fbda0eccf" }
]
}
}
}
}
List users on a client
Find all user accounts owned by the client given by id. Deleted users are not listed. Returns 200, or 404 for an unknown client.
Path parameters
idstringClient identifier, see
GET /clients. Required.
curl https://api.aleta.ai/api/v2/clients/6698d912deb64c8b2fec2c08/users \
-H "Authorization: Bearer {access_token}"
{
"data": [
{
"id": "a3979a79-a8ad-4d14-a83f-ff7b4959c776",
"type": "user",
"attributes": {
"firstName": "User 1 first name",
"lastName": "User 1 last name",
"contactEmail": "user1-contact-email@example.com"
},
"relationships": {
"client": {
"data": { "type": "client", "id": "6698d912deb64c8b2fec2c08" }
},
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "cb4b00eef0af406faddc82ae" },
{ "type": "reporting-entity", "id": "51c10fb37fcada1fbda0eccf" }
]
}
}
},
{
"id": "87f024aa-d0fe-43fd-8240-7a2c45eef947",
"type": "user",
"attributes": {
"firstName": "User 2 first name",
"lastName": "User 2 last name",
"contactEmail": "user2-contact-email@example.com"
},
"relationships": {
"client": {
"data": { "type": "client", "id": "6698d912deb64c8b2fec2c08" }
},
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "cb4b00eef0af406faddc82ae" }
]
}
}
}
]
}
Retrieve a user
Find the user account given by id. Returns 200, or 404 when the user does not exist or the caller has no access to the user's client.
Path parameters
idstringUser identifier (a UUID), see
GET /clients/:id/users. Required. Anidthat is not a UUID is refused with400.
curl https://api.aleta.ai/api/v2/users/a3979a79-a8ad-4d14-a83f-ff7b4959c776 \
-H "Authorization: Bearer {access_token}"
{
"data": {
"id": "a3979a79-a8ad-4d14-a83f-ff7b4959c776",
"type": "user",
"attributes": {
"firstName": "User 1 first name",
"lastName": "User 1 last name",
"contactEmail": "user1-contact-email@example.com"
},
"relationships": {
"client": {
"data": { "type": "client", "id": "6698d912deb64c8b2fec2c08" }
},
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "cb4b00eef0af406faddc82ae" },
{ "type": "reporting-entity", "id": "51c10fb37fcada1fbda0eccf" }
]
}
}
}
}
Update a user
Update the user account given by id. Returns 200 with the updated user.
All three attributes, firstName, lastName and contactEmail, must be present in attributes; send null for the ones you want to keep. A request without one of them is refused with 400.
readAccessToReportingEntities is optional: when present it replaces the user's reporting entities, when omitted they are kept. An unknown id returns 404.
Path parameters
idstringUser identifier, see
GET /clients/:id/users. Required.
curl -X PATCH https://api.aleta.ai/api/v2/users/a3979a79-a8ad-4d14-a83f-ff7b4959c776 \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"id": "a3979a79-a8ad-4d14-a83f-ff7b4959c776",
"type": "user",
"attributes": {
"firstName": null,
"lastName": "User 1 UPDATED last name",
"contactEmail": null
},
"relationships": {
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "6852b1535ddc5f5f6e77e85e" }
]
}
}
}
}'
{
"data": {
"id": "a3979a79-a8ad-4d14-a83f-ff7b4959c776",
"type": "user",
"attributes": {
"firstName": "User 1 first name",
"lastName": "User 1 UPDATED last name",
"contactEmail": "user1-contact-email@example.com"
},
"relationships": {
"client": {
"data": { "type": "client", "id": "6698d912deb64c8b2fec2c08" }
},
"readAccessToReportingEntities": {
"data": [
{ "type": "reporting-entity", "id": "6852b1535ddc5f5f6e77e85e" }
]
}
}
}
}
Delete a user
Delete the user account given by id. Returns 204 with no body, or 404 for an unknown id. A deleted user is no longer listed on its client, and deleting it again returns 204.
Path parameters
idstringUser identifier, see
GET /clients/:id/users. Required.
curl -X DELETE https://api.aleta.ai/api/v2/users/a3979a79-a8ad-4d14-a83f-ff7b4959c776 \
-H "Authorization: Bearer {access_token}"
Create an invite
Create an invitation link for the user with id. Returns 201.
Path parameters
idstringUser identifier, see
GET /clients/:id/users. Required.
Attributes
restrictedToIdentityProviderstringOptional. Restrict the invite to a single identity provider. Possible values:
apple,google,microsoft(lower case); any other non-empty value is refused with400. This can be used to create a better onboarding experience if the user's preferred identity provider is known.restrictedToEmailstringOptional. By default the invite is locked to the contact email address of the user. This optional field can be used to override the default. This can be useful if the user wants an additional identity connected, e.g. a private Apple identity or a work Microsoft identity.
curl -X POST https://api.aleta.ai/api/v2/users/107b590a-3761-4f8f-b776-f8f2fe346e81/invites \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "invite"
}
}'
{
"data": {
"id": "d0a4d3fe-4309-47e3-b677-9c89ca1c1e73",
"type": "invite",
"attributes": {
"state": "valid",
"link": "https://my.aleta.io/-/invite/{token}",
"restrictedToIdentityProvider": null,
"restrictedToEmail": "user-contact-email@example.com",
"expiration": "2025-02-28T11:22:33.123+00:00"
},
"relationships": {
"user": {
"data": { "type": "user", "id": "107b590a-3761-4f8f-b776-f8f2fe346e81" }
}
}
}
}
List invites
Find all invitations created for the user with id, oldest first. This includes both used, expired, cancelled, and valid (active) invites. Returns 200, or 404 for an unknown user. An id that is not a UUID is refused with 400.
Path parameters
idstringUser identifier, see
GET /clients/:id/users. Required.
curl https://api.aleta.ai/api/v2/users/107b590a-3761-4f8f-b776-f8f2fe346e81/invites \
-H "Authorization: Bearer {access_token}"
{
"data": [
{
"id": "16f91a30-ca34-42d7-a7c8-2b848c93f54c",
"type": "invite",
"attributes": {
"state": "expired",
"link": "https://my.aleta.io/-/invite/{token}",
"restrictedToIdentityProvider": "",
"restrictedToEmail": "user-contact-email@example.com",
"expiration": "2024-12-31T11:22:33.123+00:00"
},
"relationships": {
"user": {
"data": { "type": "user", "id": "107b590a-3761-4f8f-b776-f8f2fe346e81" }
}
}
},
{
"id": "d0a4d3fe-4309-47e3-b677-9c89ca1c1e73",
"type": "invite",
"attributes": {
"state": "used",
"link": "https://my.aleta.io/-/invite/{token}",
"restrictedToIdentityProvider": "",
"restrictedToEmail": "user-contact-email@example.com",
"expiration": "2025-02-28T11:22:33.123+00:00"
},
"relationships": {
"user": {
"data": { "type": "user", "id": "107b590a-3761-4f8f-b776-f8f2fe346e81" }
}
}
},
{
"id": "9c41676f-8b7b-4f8f-9951-2beb73d2bdd4",
"type": "invite",
"attributes": {
"state": "valid",
"link": "https://my.aleta.io/-/invite/{token}",
"restrictedToIdentityProvider": "microsoft",
"restrictedToEmail": "user-work-email@example.com",
"expiration": "2025-02-28T11:22:33.123+00:00"
},
"relationships": {
"user": {
"data": { "type": "user", "id": "107b590a-3761-4f8f-b776-f8f2fe346e81" }
}
}
}
]
}
Cancel an invite
Cancel the invitation with inviteId. The invitation link becomes invalid and can no longer be used. Returns 204 with no body. The request body is not read.
The invite is found by inviteId alone. userId must be a UUID but is not compared with the invite's user, so the invite is cancelled whatever user id is in the path.
Only a valid invite can be cancelled: an unknown, used, expired or already cancelled invite is refused with 400. A userId or inviteId that is not a UUID is refused with 400.
If the invited user cannot be found, or you have no write access to that user, the answer is still 204, but nothing is cancelled and the invite stays valid. To confirm a cancellation, check that the invite's state is cancelled in GET /users/:id/invites.
Path parameters
userIdstringUser identifier, see
GET /clients/:id/users. Required.inviteIdstringInvitation identifier, see
GET /users/:id/invites. Required.
curl -X POST \
https://api.aleta.ai/api/v2/users/107b590a-3761-4f8f-b776-f8f2fe346e81/invites/9c41676f-8b7b-4f8f-9951-2beb73d2bdd4/cancellation \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/vnd.api+json" \
-d '{
"data": {
"type": "invite-cancellation"
}
}'