Written for: For administrators
Users and groups API
These HTTP requests list the people and groups in your Astrato workspace, create and change groups, and add or remove members. They suit an embedded product that signs its own users in and keeps their group membership in step from its backend. To do the same in the product, see Manage users and Manage groups and assignment rules. For the other interfaces Astrato offers, see Integrate with Astrato.
Before you start
Section titled “Before you start”- A personal access token. Send it as
Authorization: Bearer <token>. An administrator decides which roles can create tokens in System settings; create one as described in Personal Access Tokens. Requests run with the permissions of the account that owns the token, so keep the token on your server. - The right role. Owners and administrators can make every request on this page. Creators can
list users, groups and group members, but cannot create, change or delete groups or change
membership, the same as in Administration → Groups. Viewers are refused with
403. If your token belongs to another role and a request returns403, use an owner’s or administrator’s token. - Your tenant ID. It appears in every path. Ask your Astrato administrator if you do not know it.
Every path on this page is relative to https://app.astrato.io/api/message. Send request bodies
as JSON with Content-Type: application/json. The examples use <tenant-id>, <group-id> and
similar placeholders; replace them with your own values.
Add a person to a group from your backend
Section titled “Add a person to a group from your backend”- Find the group’s ID, or create the group. Do this first: a web
ticket that names a group the workspace does not have is refused with
400and code11119. - Make sure the person exists in Astrato. People who use your product through web tickets are created when their browser first redeems a ticket, not when your backend asks for one. The ticket request can already name the groups the person joins; use the requests below to change membership afterwards. See Sign users in with web tickets.
- Find the person’s user ID.
- Add the person to the group, passing the user ID as
resourceId.
Text description
The drawing shows these steps as requests from your product to Astrato. Your backend finds or creates the group, asks for a web ticket, looks up the user and adds them to the group; the user’s browser redeems the ticket, which creates the user. Each step’s result is drawn on the Astrato side: the group ID, the web ticket, the new user, the user ID, and finally the user in the group.
What a group can open is set on the resources themselves, such as semantic layers and data connections. See How access works.
Find a user
Section titled “Find a user”GET /tenant/{tenantId}/user lists the people in the workspace, including pending invitations.
- To match one email address, pass the whole address as
email=<address>. Case is ignored for accounts. - To search, pass
filter={"search":"dana"}, URL-encoded. It matches a person’s name or email address and a pending invitation’s email address, ignoring case.
GET https://app.astrato.io/api/message/tenant/<tenant-id>/user?email=dana.diaz%40example.comAuthorization: Bearer <token>The response is an array of people. Each looks like this:
{ "id": "00000000-0000-0000-0000-0000000000a1", "email": "dana.diaz@example.com", "name": "Dana Diaz", "firstName": "Dana", "lastName": "Diaz", "imageUrl": null, "created": "2024-09-13T16:22:15.331Z", "updated": "2024-09-16T13:49:16.524Z", "isPending": false, "active": true, "teamId": "00000000-0000-0000-0000-0000000000b1", "role": "creator", "licenseType": "consumption", "creationOrigin": "internal", "is2FAEnabled": false, "twoFASetupDueDate": null}Keep id for adding the person to a group. When isPending is true, the entry is a pending
invitation and id is the invitation’s ID.
Find or create a group
Section titled “Find or create a group”GET /tenant/{tenantId}/group lists the groups in the workspace.
- To search by name, pass
filter={"displayName":"sales"}, URL-encoded. It matches names that contain the text, ignoring case. - To fetch known groups, pass their IDs comma-separated in
ids. - To include each group’s member IDs, add
embed=memberIds.
GET https://app.astrato.io/api/message/tenant/<tenant-id>/group?filter=%7B%22displayName%22%3A%22sales%22%7DAuthorization: Bearer <token>Each group in the response looks like this. membersQuantity is a number sent as a string.
{ "id": "00000000-0000-0000-0000-0000000000c1", "displayName": "Sales", "description": null, "externalId": null, "creationOrigin": "internal", "created": "2024-09-16T08:23:00.162Z", "updated": "2024-09-16T08:23:00.162Z", "membersQuantity": "2"}GET /tenant/{tenantId}/group/{groupId} returns one group with its member IDs in memberIds.
To create a group, send POST /tenant/{tenantId}/group. displayName is required: 2 to 200
characters after surrounding spaces are removed, and not already used by another group in the
workspace. description is optional, up to 1,024 characters.
POST https://app.astrato.io/api/message/tenant/<tenant-id>/groupAuthorization: Bearer <token>Content-Type: application/json
{ "displayName": "Sales", "description": "Managed from our product backend" }The response is the new group, including its id. A name that is already used returns 409.
Add members
Section titled “Add members”POST /tenant/{tenantId}/group/{groupId}/members adds one or more people. members must hold at
least one entry. For each entry, set resourceType to user for a person’s account or invite
for a pending invitation, and resourceId to that account’s or invitation’s ID.
POST https://app.astrato.io/api/message/tenant/<tenant-id>/group/<group-id>/membersAuthorization: Bearer <token>Content-Type: application/json
{ "members": [{ "resourceId": "00000000-0000-0000-0000-0000000000a1", "resourceType": "user" }] }The response lists the new memberships:
[ { "id": "00000000-0000-0000-0000-0000000000d1", "resourceId": "00000000-0000-0000-0000-0000000000a1", "resourceType": "user", "name": "Dana Diaz", "email": "dana.diaz@example.com", "imageUrl": null, "created": "2024-09-16T14:16:19.069Z", "tenantGroupId": "00000000-0000-0000-0000-0000000000c1", "tenantId": "<tenant-id>", "creationOrigin": "internal" }]The request adds all the entries or none. If any ID is not a person or invitation in your
workspace, it returns 404 and adds no one; details.resourceIds in the response lists the IDs
it could not find. Account IDs are checked before invitation IDs, so when an account ID is
missing, the list does not yet include missing invitation IDs.
To list a group’s current members, send GET /tenant/{tenantId}/group/{groupId}/members. Each
member has the fields shown above. To search them by name or email address, pass
filter={"generalSearch":"dana"}, URL-encoded.
Remove a member
Section titled “Remove a member”Send DELETE /tenant/{tenantId}/group/{groupId}/members/{memberId}. memberId is the membership
id from the add or list response, not the person’s user ID. Removing a member takes away the
access they had through that group.
Memberships added by SCIM provisioning or by an assignment rule cannot be removed this way: the
request returns 403. Change your identity provider or the
assignment rule instead.
Rename or delete a group
Section titled “Rename or delete a group”To change a group, send PATCH /tenant/{tenantId}/group/{groupId} with displayName and, if you
want to change it, description. The same limits apply as when you create a group. Include
displayName even when it stays the same: without it, the request returns 404.
To delete a group, send DELETE /tenant/{tenantId}/group/{groupId}. Its members lose the access
the group gave them, and the access granted to the group is removed.
Groups created by SCIM provisioning cannot be changed or deleted here; the request returns 403.
Request reference
Section titled “Request reference”| Method | Path | What it does |
|---|---|---|
GET |
/tenant/{tenantId}/user |
Lists people and pending invitations |
GET |
/tenant/{tenantId}/group |
Lists groups |
GET |
/tenant/{tenantId}/group/{groupId} |
Returns one group and its member IDs |
POST |
/tenant/{tenantId}/group |
Creates a group |
PATCH |
/tenant/{tenantId}/group/{groupId} |
Changes a group’s name or description |
DELETE |
/tenant/{tenantId}/group/{groupId} |
Deletes a group |
GET |
/tenant/{tenantId}/group/{groupId}/members |
Lists a group’s members |
POST |
/tenant/{tenantId}/group/{groupId}/members |
Adds members |
DELETE |
/tenant/{tenantId}/group/{groupId}/members/{memberId} |
Removes one member |
Paging
Section titled “Paging”The three list requests return their results in pages. Pass offset (default 0) and limit
(default 50, at most 1000) as query parameters. The Pagination-Total response header gives
the number of matching records; raise offset by limit until you have them all.
Errors
Section titled “Errors”| Status | Common causes |
|---|---|
400 |
A filter that is not a JSON object, an invalid email address in email, an invalid ID in ids or in the path, an embed other than memberIds, an unknown sort column, or a request body with unknown fields or values outside the limits above. |
403 |
Your role cannot make the request, or the group or membership is managed by SCIM provisioning or an assignment rule. |
404 |
The group, person, invitation or membership does not exist in your workspace, or a PATCH left out displayName. |
409 |
Another group already has that name. |