AISARAISAR
REST API

Teams & Users

Manage teams (operator grouping + channel access), company members, and email invitations for new users. Roles are assigned at the company level (admin/manager/agent) via Spatie permissions in teams mode — one user can belong to multiple companies with different roles in each. The public, unauthenticated invitation-resolution steps (resolve/context/intent) are out of scope for this reference — see the invitations guide.

Endpoints

MethodPath
GET/v1/teams

List teams

POST/v1/teams

Create a team

GET/v1/teams/{team}

Get a team

PATCH/v1/teams/{team}

Update a team

DELETE/v1/teams/{team}

Delete a team

GET/v1/companies/current/members

List current company members

POST/v1/companies/current/members/{memberId}/role

Change a member's role

POST/v1/companies/current/members/{memberId}/revoke

Revoke a member's access

GET/v1/users

List current company users (excluding service accounts)

POST/v1/invitations

Send an invitation (email + role)

POST/v1/invitations/{guid}/accept

Accept an invitation

POST/v1/invitations/{guid}/decline

Decline an invitation

POST/v1/invitations/{invitationId}/role

Change the role on a pending invitation

POST/v1/invitations/{invitationId}/revoke

Revoke an invitation

DELETE/v1/invitations/{invitationId}

Delete an invitation

Examples

Invite a new user

Request

bash
curl -X POST https://api.aisar.app/v1/invitations \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "new.agent@example.com",
    "role": "agent"
  }'

Response

json
{
  "data": {
    "message": "Invitation sent.",
    "invitation": {
      "id": 77,
      "guid": "b6e2a4d0-1234-4a90-9e21-5d3f0c8a9b11",
      "invite_url": "https://my.aisar.app/invitation/b6e2a4d0-1234-4a90-9e21-5d3f0c8a9b11",
      "email": "new.agent@example.com",
      "role": "agent",
      "expires_at": "2026-03-22T10:00:00.000000Z"
    }
  }
}

Create a team

Request

bash
curl -X POST https://api.aisar.app/v1/teams \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Support",
    "description": "Customer success team",
    "channel_access_mode": "custom",
    "channel_ids": [7, 9],
    "member_ids": [5, 6]
  }'

Response

json
{
  "data": {
    "message": "Team created.",
    "team": {
      "id": 3,
      "company_id": 1,
      "name": "Support",
      "description": "Customer success team",
      "channel_access": { "mode": "custom", "channel_ids": [7, 9] },
      "member_ids": [5, 6],
      "created_at": "2026-03-15T10:00:00.000000Z",
      "updated_at": "2026-03-15T10:00:00.000000Z"
    }
  }
}