> For the complete documentation index, see [llms.txt](https://docs.pixiebrix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pixiebrix.com/developer-api/team-management-apis.md).

# Team Management APIs

PixieBrix Team Management APIs Overviews

This page details the most import APIs for team management, e.g., integration with a workforce management (WFM) system or identity provider. For a complete list of team management API endpoints, see [OpenAPI Specification](/developer-api/openapi-specification.md)

## Team Management

### List Team Memberships

`GET /api/organizations/:organizationId/memberships/`

This endpoint must be paginated, see [Making an API Request](/developer-api/making-an-api-request.md#pagination).

Service accounts are included by default. To exclude them, use the following param: `user__service_account=true`

Deployment key accounts are included by default. To exclude them, use the following param: `user__deployment_key_account=true`

### Remove User From Team

`DELETE /api/memberships/:id/`

This endpoint can be used to remove a member from a team. For more information, view our [OpenAPI Specification](https://docs.pixiebrix.com/developer-api/openapi-specification).

## Group Management

### List Groups

`GET /api/organizations/:organizationId/groups/`

### Create a Group

`POST /api/organizations/:organizationId/groups/`

The payload should include the group name. For example:

```json
{ "name": "My Group Name" }
```

### List Group Memberships

To get the current memberships:

`GET /api/groups/:groupId/memberships/`

### Add or Update Group Memberships

* `POST /api/groups/:groupId/memberships/`: Add one or more members to a Group
* `PUT /api/groups/:groupId/memberships/`: Replace the members in a Group

{% hint style="warning" %}
When using the `PUT` method, the members you provide will **replace** the current membership list. Existing members that are not in the payload will be removed from the group.
{% endhint %}

The payload should consist of one or more registered user ids or emails.

To include an email, the user must be either: 1) already a member of your team, or 2) have an email domain that has been verified for your team. To verify an email domain for your team, contact <support@pixiebrix.com>.

Example payload:

```json
[
  {"user_id": "dcf5853e-523e-418c-bf6f-f014cd06c3c0"}, 
  {"email": "paz@pixies.com"} 
]
```

### Delete Group Membership

To delete a single group membership, call the DELETE method on the membership resource.

`DELETE /api/groups/:groupId/memberships/:membershipId/`

## Campaign Management

### List Campaigns

`GET /api/organizations/:organizationId/campaigns/`

### Update Campaign

To update a campaign's name, use the following endpoint:

`GET /api/organizations/:organizationId/campaigns/:campaignId/`

Example payload:

```json
{
  "name": "Campaign Name"
}
```

### List Campaign Memberships

To list membership information for a given campaign, use the following endpoint:

`GET /api/organizations/:organizationId/campaigns/:campaignId/members/`

### Add or Update Campaign Memberships

* `POST /api/organizations/:organizationId/campaigns/:campaignId/members/`: Add one or more members to a Campaign
* `PUT /api/organizations/:organizationId/campaigns/:campaignId/members/`: Replace the members in a Campaign

{% hint style="warning" %}
When using the `PUT` method, the members you provide will **replace** the current membership list. Existing members that are not in the payload will be removed from the campaign.
{% endhint %}

To include an email, the user must be either: 1) already a member of your team, or 2) have an email domain that’s been verified for your team. To verify an email domain for your team, contact <support@pixiebrix.com>

The users list supports a `data` property where you can provide custom master data about the users for reporting, e.g., Location, Organization Unit, etc.

Example payload:

```json
[
  {
    "email": "paz@pixies.com",
    "data": {
       "Location": "New York, NY"
    }
  }
]
```

## Audit Log

You must have the Admin or Manager role on the team to use these endpoints. Events are sorted newest first. For the meaning of each field, see [Audit Log](/managing-teams/audit-log.md).

### List Team Audit Events

`GET /api/audit/organizations/:organizationId/`

If the team has more than 1,000 events, you must paginate this endpoint. Without pagination, the request fails. To paginate, send API version 2.0 in the `Accept` header, then follow the `next` link in the `Link` response header. See [Making an API Request](/developer-api/making-an-api-request.md). For example:

```
GET /api/audit/organizations/:organizationId/?page=1&page_size=100
Accept: "application/json; version=2.0"
```

### List Group Audit Events

`GET /api/audit/groups/:groupId/`

### List Deployment Audit Events

`GET /api/audit/deployments/:deploymentId/`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pixiebrix.com/developer-api/team-management-apis.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
