DocsAPI ReferenceTeams API

Teams API

Manage operators (the people who own assets) and teams through the API, including team membership.


Operators Overview

Operators are the contacts of the infrastructure: people who can own assets (owner_ref on an asset) and be members of teams. They are not platform user accounts. Every authenticated user can read operators and teams; create, update, delete and membership changes need a manager or admin.

List Operators

Retrieve a paginated list of operators, ordered by name. Filters: name, role and email (case-insensitive substrings); ?search= matches name, email and role; ?ordering= accepts name and created_at.

Note: asset_count counts the active assets the operator owns. GET /api/v1/operators/minimal/ returns only id and name of every operator (for dropdowns), with the same filters.

GET /api/v1/operators/

curl https://idp.example.com/api/v1/operators/?search=chen \
  -H "Authorization: Bearer {access_token}"

# Response
{
  "count": 24,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "Alice Chen",
      "email": "alice.chen@example.com",
      "role": "SRE",
      "teams": [ { "id": 1, "name": "Platform Engineering" } ],
      "asset_count": 42,
      "created_at": "2025-01-15T09:00:00Z"
    }
  ]
}

Get Operator Detail

The detail adds phone, notes and updated_at to the list fields.

GET /api/v1/operators/{id}/

Create Operator

Create an operator (manager or admin). Writable fields: name (required, unique ignoring case and surrounding spaces), email, phone, role and notes.

POST /api/v1/operators/

curl -X POST https://idp.example.com/api/v1/operators/ \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Bob Martinez",
    "email": "bob.martinez@example.com",
    "phone": "+1-555-0102",
    "role": "DBA",
    "notes": "Database specialist"
  }'

Update Operator

Update an operator with PATCH (manager or admin), with the same fields as creation.

PATCH /api/v1/operators/{id}/

curl -X PATCH https://idp.example.com/api/v1/operators/2/ \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{"role": "Team lead"}'

Delete Operator

Delete an operator (manager or admin). The answer is 204 No Content.

Warning: The operator also leaves every team, and the assets it owned lose their owner. Reassign ownership first if continuity matters.

DELETE /api/v1/operators/{id}/

Teams Overview

Teams group operators. Assets are assigned to a team through team_ref (see Asset Ownership). Membership carries a free-text role.

List Teams

Retrieve a paginated list of teams, ordered by name. Filter: name (case-insensitive substring); ?search= matches name and description; ?ordering= accepts name and created_at.

Note: GET /api/v1/teams/minimal/ returns only id and name of every team.

GET /api/v1/teams/

# Response
{
  "count": 5,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "name": "Platform Engineering",
      "description": "Core infrastructure and Kubernetes clusters",
      "member_count": 4,
      "asset_count": 352,
      "created_at": "2025-01-20T10:00:00Z"
    }
  ]
}

Get Team Detail

The detail lists the members (operator id, name, email and membership role) and the number of active assets of the team.

GET /api/v1/teams/{id}/

# Response
{
  "id": 1,
  "name": "Platform Engineering",
  "description": "Core infrastructure and Kubernetes clusters",
  "members": [
    { "id": 1, "name": "Alice Chen", "email": "alice.chen@example.com", "role": "lead" }
  ],
  "asset_count": 352,
  "created_at": "2025-01-20T10:00:00Z",
  "updated_at": "2025-03-02T08:12:00Z"
}

Create and Update Teams

Create a team with POST and change it with PATCH (manager or admin). The writable fields are name (required, unique ignoring case and surrounding spaces) and description; members are managed with the membership actions below.

POST /api/v1/teams/
{ "name": "Database Reliability", "description": "All database instances" }

PATCH /api/v1/teams/{id}/
{ "name": "Database & Storage Reliability" }

Team Membership

Add or remove one operator at a time (manager or admin):

# Add (201 "Member added."; 409 when already a member, 404 for an unknown operator)
POST /api/v1/teams/{id}/add_member/
{ "operator_id": 4, "role": "member" }

# Remove (200 "Member removed."; 404 when not a member)
POST /api/v1/teams/{id}/remove_member/
{ "operator_id": 4 }

Delete Team

Delete a team and its memberships (manager or admin); the operators themselves are not affected. The answer is 204 No Content.

Warning: Assets assigned to a deleted team lose their team. Reassign them first if continuity matters.

DELETE /api/v1/teams/{id}/