Teams API

Teams allow you to collaborate with other users on monitoring. Team members can view and manage shared monitors based on their assigned role.

All team endpoints require authentication. Include the Authorization: Bearer {token} header with all requests.

Team Roles

RolePermissions
OWNERFull access, can delete team, change any member's role
ADMINCan invite members, manage monitors, update team settings
MEMBERCan view and manage monitors
VIEWERRead-only access to monitors and incidents

List Teams

GET/api/teams

Retrieve all teams the authenticated user belongs to

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "teams": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Engineering",
      "slug": "engineering",
      "owner_id": "user-uuid",
      "created_at": "2024-01-10T10:00:00Z",
      "updated_at": "2024-01-15T14:00:00Z",
      "member_count": 5,
      "user_role": "OWNER"
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "name": "DevOps",
      "slug": "devops",
      "owner_id": "other-user-uuid",
      "created_at": "2024-01-05T08:00:00Z",
      "updated_at": "2024-01-12T16:00:00Z",
      "member_count": 3,
      "user_role": "MEMBER"
    }
  ]
}

Create Team

POST/api/teams

Create a new team

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredValidation
namestringYes1-100 characters
slugstringYes1-100 characters, lowercase alphanumeric and hyphens only

Request Example:

{
  "name": "Engineering Team",
  "slug": "engineering-team"
}

The user creating the team automatically becomes the OWNER and first member.

Success Response (201 Created):

{
  "team": {
    "id": "770e8400-e29b-41d4-a716-446655440002",
    "name": "Engineering Team",
    "slug": "engineering-team",
    "owner_id": "user-uuid",
    "created_at": "2024-01-15T12:00:00Z",
    "updated_at": "2024-01-15T12:00:00Z"
  }
}

Error Responses:

StatusErrorDescription
400Validation errorsInvalid name or slug format
400Team slug already takenSlug must be unique

Get Team

GET/api/teams/:id

Get team details including members and pending invites

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "team": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Engineering",
    "slug": "engineering",
    "owner_id": "user-uuid",
    "created_at": "2024-01-10T10:00:00Z",
    "updated_at": "2024-01-15T14:00:00Z"
  },
  "members": [
    {
      "id": "member-uuid-1",
      "team_id": "team-uuid",
      "user_id": "user-uuid",
      "name": "John Doe",
      "email": "john@example.com",
      "role": "OWNER",
      "joined_at": "2024-01-10T10:00:00Z"
    },
    {
      "id": "member-uuid-2",
      "team_id": "team-uuid",
      "user_id": "user-uuid-2",
      "name": "Jane Smith",
      "email": "jane@example.com",
      "role": "ADMIN",
      "joined_at": "2024-01-12T09:00:00Z"
    }
  ],
  "pendingInvites": [
    {
      "id": "invite-uuid",
      "team_id": "team-uuid",
      "email": "new@example.com",
      "role": "MEMBER",
      "token": "invite-token",
      "invited_by": "user-uuid",
      "expires_at": "2024-01-22T10:00:00Z",
      "created_at": "2024-01-15T10:00:00Z"
    }
  ],
  "userRole": "OWNER"
}

Error Responses:

StatusErrorDescription
403Not a team memberUser is not a member of this team
404Team not foundTeam doesn't exist

Update Team

PUT/api/teams/:id

Update team name

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredValidation
namestringNo1-100 characters

Request Example:

{
  "name": "Engineering & DevOps"
}

Success Response (200 OK):

{
  "team": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Engineering & DevOps",
    "slug": "engineering",
    "owner_id": "user-uuid",
    "created_at": "2024-01-10T10:00:00Z",
    "updated_at": "2024-01-16T11:00:00Z"
  }
}

Error Responses:

StatusErrorDescription
403Not authorizedOnly OWNER or ADMIN can update team

Delete Team

DELETE/api/teams/:id

Permanently delete a team

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "message": "Team deleted"
}

Error Responses:

StatusErrorDescription
403Only owner can delete teamMust be team owner
404Team not foundTeam doesn't exist

Deleting a team is permanent and removes all team memberships and pending invites.


Invite Member

POST/api/teams/:id/invite

Send an invitation to join the team

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredValidation
emailstringYesValid email address
rolestringYesADMIN, MEMBER, or VIEWER

Request Example:

{
  "email": "newmember@example.com",
  "role": "MEMBER"
}

Invites expire after 7 days. The invited user must have a PixoMonitor account to accept the invite.

Success Response (201 Created):

{
  "invite": {
    "id": "invite-uuid",
    "team_id": "team-uuid",
    "email": "newmember@example.com",
    "role": "MEMBER",
    "token": "unique-invite-token",
    "invited_by": "user-uuid",
    "expires_at": "2024-01-22T12:00:00Z",
    "created_at": "2024-01-15T12:00:00Z"
  }
}

Error Responses:

StatusErrorDescription
400User is already a team memberUser already in team
400Invite already sent to this emailPending invite exists
403Not authorized to inviteOnly OWNER or ADMIN can invite

Cancel Invite

DELETE/api/teams/:id/invite/:inviteId

Cancel a pending team invitation

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID
inviteIdUUIDInvite ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "message": "Invite cancelled"
}

Error Responses:

StatusErrorDescription
403Not authorizedOnly OWNER or ADMIN can cancel invites

Accept Invite

POST/api/teams/invites/:token/accept

Accept a team invitation

Path Parameters:

ParameterTypeDescription
tokenstringInvite token from invitation

Headers:

HeaderValue
AuthorizationBearer {access_token}

The authenticated user's email must match the invitation email.

Success Response (200 OK):

{
  "message": "Successfully joined team"
}

Error Responses:

StatusErrorDescription
400No account found with this email. Please sign up first.User must register first
400Already a team memberUser already in team
404Invalid or expired inviteToken invalid or expired

Remove Member

DELETE/api/teams/:id/members/:memberId

Remove a member from the team

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID
memberIdUUIDTeam member ID (not user ID)

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "message": "Member removed"
}

Error Responses:

StatusErrorDescription
400Cannot remove ownerTeam owner cannot be removed
403Not authorizedOnly OWNER or ADMIN can remove members
404Member not foundInvalid member ID

Update Member Role

PUT/api/teams/:id/members/:memberId

Change a team member's role

Path Parameters:

ParameterTypeDescription
idUUIDTeam ID
memberIdUUIDTeam member ID

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredValidation
rolestringYesADMIN, MEMBER, or VIEWER

Request Example:

{
  "role": "ADMIN"
}

Success Response (200 OK):

{
  "member": {
    "id": "member-uuid",
    "team_id": "team-uuid",
    "user_id": "user-uuid",
    "role": "ADMIN",
    "joined_at": "2024-01-12T09:00:00Z"
  }
}

Error Responses:

StatusErrorDescription
403Only owner can change rolesMust be team owner
404Member not foundInvalid member ID

The OWNER role cannot be assigned via this endpoint. To transfer ownership, the current owner must be changed first.


Team Invitation Flow

1. OWNER/ADMIN sends invite → POST /api/teams/:id/invite
   ↓
2. Invite email sent with unique token
   ↓
3. Recipient clicks link / uses token
   ↓
4. Recipient calls → POST /api/teams/invites/:token/accept
   ↓
5. User becomes team member with assigned role

Permission Matrix

ActionOWNERADMINMEMBERVIEWER
View team
Update team name
Delete team
Invite members
Cancel invites
Remove members
Change member roles
Manage monitors
View monitors

Error Responses Summary

StatusErrorDescription
400Validation errorsInvalid request body
400Team slug already takenDuplicate slug
400User is already a team memberDuplicate membership
400Invite already sent to this emailDuplicate invite
400Cannot remove ownerOwner removal attempted
400Already a team memberAccepting invite when already member
403Not a team memberAccessing team without membership
403Not authorizedInsufficient permissions
403Not authorized to inviteNon-admin inviting
403Only owner can delete teamNon-owner deleting team
403Only owner can change rolesNon-owner changing roles
404Team not foundInvalid team ID
404Member not foundInvalid member ID
404Invalid or expired inviteBad invite token