From d9f279efaf6ff26f2c006735b61fc65d7904fa75 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 09:16:51 +0000 Subject: [PATCH 1/2] Document the Teams endpoints GET /teams, GET /teams/{id} and PATCH /teams/{id}: an Organisation's Teams, and the Projects a Team adds the people who join it to (CP-9018). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xqgnRRouqAicKF7GRu --- openapi.yaml | 201 +++++++++++++++++++++++++++++++++++++++++++++++++++ server.js | 43 +++++++++++ 2 files changed, 244 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index e412f74..ec9d47b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -155,6 +155,8 @@ tags: description: Obtain and manage authentication tokens - name: Users description: Platform users with login credentials + - name: Teams + description: Teams of colleagues in an Organisation, and the Projects a Team adds the people who join it to - name: Charities description: Organisations — the top-level entity that owns Projects - name: Projects @@ -703,6 +705,119 @@ paths: $ref: '#/components/responses/NotFound' "422": $ref: '#/components/responses/UnprocessableEntityList' + /teams: + get: + tags: [Teams] + summary: List an Organisation's Teams + description: | + The Teams of an Organisation (Charity) the user belongs to, as the Teams page lists them. A + Team groups colleagues across Projects; its managers are shown as "Managers" (leaders in + older screens) and everyone else as "Members". When `auto_add_to_projects` is true, someone + who joins the Team is added, at that moment, to the Projects in `auto_add_project_ids` and to + every open Project that one of the saved project filters in `auto_add_filter_ids` matches, + with the project role in `auto_add_manager_role` or `auto_add_member_role`. + operationId: listTeams + security: [{tokenAuth: []}] + parameters: + - name: charity_id + in: query + required: true + description: The Organisation whose Teams to list. Another Organisation reads as not found. + schema: + type: integer + - $ref: '#/components/parameters/Page' + - $ref: '#/components/parameters/PerPage' + - $ref: '#/components/parameters/LastSyncDatetime' + responses: + "200": + description: Paginated list of Teams + content: + application/json: + schema: + $ref: '#/components/schemas/TeamList' + "401": + $ref: '#/components/responses/Unauthorized' + "404": + $ref: '#/components/responses/NotFound' + + /teams/{id}: + get: + tags: [Teams] + summary: Get a Team + description: A Team of one of the user's Organisations, with its managers, members and the Projects it adds people to. + operationId: getTeam + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + schema: + type: integer + responses: + "200": + description: The Team + content: + application/json: + schema: + $ref: '#/components/schemas/Team' + "401": + $ref: '#/components/responses/Unauthorized' + "404": + $ref: '#/components/responses/NotFound' + + patch: + tags: [Teams] + summary: Set which Projects a Team adds people to + description: | + Changes the "Automatically add managers and members to projects" settings of a Team, as the + Create/Edit Team popup does. Only an Organisation Admin of the Team's Organisation can do + this. Send only the fields to change. + + People are added only at the moment they join the Team. Changing these settings doesn't add + the Team's current managers and members to anything, and someone removed from one of these + Projects later isn't added back. People who already have a role on a Project keep it. + + `auto_add_project_ids` must be open Projects of the Team's Organisation. `auto_add_filter_ids` + must be saved Projects page filters the user can use: their own, or ones colleagues have + shared (the same list as `saved_filters` in `GET /project_automations/options?charity_id=`). + Projects and filters already on the Team are kept even if this user couldn't choose them. + Roles are `editor` (Project Manager), `reporter` (Changemaker) or `observer` (Analyst). + operationId: updateTeam + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TeamUpdateRequest' + example: + auto_add_to_projects: true + auto_add_project_ids: [619, 620] + auto_add_filter_ids: [88] + auto_add_manager_role: editor + auto_add_member_role: reporter + responses: + "200": + description: The updated Team + content: + application/json: + schema: + $ref: '#/components/schemas/Team' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + /albums: get: tags: [Albums] @@ -14873,6 +14988,92 @@ components: type: string format: date-time + Team: + type: object + properties: + id: + type: integer + charity_id: + type: integer + description: The Organisation the Team belongs to + name: + type: string + colour: + type: string + description: The Team's chip colour, e.g. "#3595d5" + manager_ids: + type: array + description: User IDs of the Team's managers (leaders) + items: + type: integer + member_ids: + type: array + description: User IDs of the Team's other members + items: + type: integer + auto_add_to_projects: + type: boolean + description: Whether people who join the Team are added to its Projects + auto_add_project_ids: + type: array + items: + type: integer + auto_add_filter_ids: + type: array + description: Saved project filters (FilterHistory) whose matching open Projects people are added to + items: + type: integer + auto_add_manager_role: + type: string + enum: [editor, reporter, observer] + description: The project role a new manager gets + auto_add_member_role: + type: string + enum: [editor, reporter, observer] + description: The project role a new member gets + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + + TeamList: + type: object + properties: + page: + type: integer + page_size: + type: integer + page_count: + type: integer + total_count: + type: integer + data: + type: array + items: + $ref: '#/components/schemas/Team' + + TeamUpdateRequest: + type: object + properties: + auto_add_to_projects: + type: boolean + auto_add_project_ids: + type: array + items: + type: integer + auto_add_filter_ids: + type: array + items: + type: integer + auto_add_manager_role: + type: string + enum: [editor, reporter, observer] + auto_add_member_role: + type: string + enum: [editor, reporter, observer] + AlbumList: type: object properties: diff --git a/server.js b/server.js index e5e83e9..116079c 100644 --- a/server.js +++ b/server.js @@ -925,6 +925,7 @@ function buildDocsPage() { GETAlbums (Portfolios) POSTSignup Pages POSTUsers + PATCHTeams POSTContacts GETContact Bio Forms POSTCases @@ -1479,6 +1480,48 @@ function buildDocsPage() { + +
+
Core resource
+

Teams

+
+

A Team groups colleagues across an Organisation's Projects. Its people are Managers (manager_ids; leaders in older screens) and Members (member_ids). A Team can add the people who join it to Projects automatically: when auto_add_to_projects is true, someone joining is added, at that moment, to the Projects in auto_add_project_ids and to every open Project that one of the saved Projects page filters in auto_add_filter_ids matches. A new Manager gets auto_add_manager_role and a new Member auto_add_member_role: editor (Project Manager), reporter (Changemaker) or observer (Analyst). People who already have a role on a Project keep it, and someone removed from one of those Projects later isn't added back.

+
+
+ ${endpointCard("GET", "/teams", "List an Organisation's Teams", true, [ + { name: "charity_id", type: "integer", required: true, desc: "The Organisation. One you aren't in reads as not found" }, + { name: "page", type: "integer", required: false, desc: "Page number (default 1)" }, + { name: "per_page", type: "integer", required: false, desc: "Records per page (default 10, max 200)" }, + { name: "last_synced_datetime", type: "string", required: false, desc: "ISO 8601 — return only Teams updated after this" } + ], [ + { code: "200", cls: "response-2xx", desc: "Paginated list of Teams" }, + { code: "401", cls: "response-4xx", desc: "Not authenticated" }, + { code: "404", cls: "response-4xx", desc: "An Organisation you aren't in" } + ], "The Teams the Organisation's Teams page shows. Anyone in the Organisation can list them.")} + ${endpointCard("GET", "/teams/{id}", "Get a Team", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Team ID" } + ], [ + { code: "200", cls: "response-2xx", desc: "The Team, with manager_ids, member_ids and its project auto-add settings" }, + { code: "401", cls: "response-4xx", desc: "Not authenticated" }, + { code: "404", cls: "response-4xx", desc: "Not found, or a Team of an Organisation you aren't in" } + ])} + ${endpointCard("PATCH", "/teams/{id}", "Set which Projects a Team adds people to", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Team ID" }, + { name: "auto_add_to_projects", type: "boolean", required: false, desc: "Turn adding people to Projects on or off" }, + { name: "auto_add_project_ids", type: "integer[]", required: false, desc: "Open Projects of the Team's Organisation (replaces the list)" }, + { name: "auto_add_filter_ids", type: "integer[]", required: false, desc: "Saved Projects page filters you can use: saved_filters from GET /project_automations/options (replaces the list)" }, + { name: "auto_add_manager_role", type: "string", required: false, desc: "editor, reporter or observer for a new Manager (default editor)" }, + { name: "auto_add_member_role", type: "string", required: false, desc: "editor, reporter or observer for a new Member (default reporter)" } + ], [ + { code: "200", cls: "response-2xx", desc: "The updated Team" }, + { code: "401", cls: "response-4xx", desc: "Not authenticated" }, + { code: "403", cls: "response-4xx", desc: "You aren't an Organisation Admin of the Team's Organisation" }, + { code: "404", cls: "response-4xx", desc: "Not found, or a Team of an Organisation you aren't in" }, + { code: "422", cls: "response-4xx", desc: "{errors: {field: [...]}}, e.g. another Organisation's Project or an unknown role" } + ], "Changes the Automatically add managers and members to projects settings, as the Create/Edit Team popup does. Send only the fields to change. It doesn't add the Team's current people to anything; people are added only as they join.")} +
+
+
Core resource
From 0bc59e606e48f1c9862363413594c654208d439d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Nov 2026 10:05:15 +0000 Subject: [PATCH 2/2] Document adding colleagues to a Team POST /teams/{id}/members, used by the Teams tab of Invite a colleague (CP-9018 items 5.2 and 5.3). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01F1a5xqgnRRouqAicKF7GRu --- openapi.yaml | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ server.js | 11 ++++++++++ 2 files changed, 72 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index ec9d47b..e3af558 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -818,6 +818,53 @@ paths: "422": $ref: '#/components/responses/UnprocessableEntity' + /teams/{id}/members: + post: + tags: [Teams] + summary: Add colleagues to a Team + description: | + Adds colleagues to a Team as Members or Managers, as the Create/Edit Team popup and the Teams + tab of Invite a colleague do. The Team's other people are left as they are, and someone already + in the Team in that role is skipped. Only an Organisation Admin of the Team's Organisation can + do this, and everyone added must already be a colleague in the Organisation (use + `GET /users` to find them). + + When the Team has `auto_add_to_projects` on, the people who join are added, in the background, + to its Projects and to the open Projects its saved filters match, with the Team's project role + for a Manager or a Member. People who already have a role on a Project keep it. + operationId: addTeamMembers + security: [{tokenAuth: []}] + parameters: + - name: id + in: path + required: true + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TeamAddMembersRequest' + example: + user_ids: [4012, 4013] + role: member + responses: + "200": + description: The Team, with the people added + content: + application/json: + schema: + $ref: '#/components/schemas/Team' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/ForbiddenError' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' + /albums: get: tags: [Albums] @@ -15038,6 +15085,20 @@ components: type: string format: date-time + TeamAddMembersRequest: + type: object + required: [user_ids, role] + properties: + user_ids: + type: array + description: Colleagues (user IDs) in the Team's Organisation + items: + type: integer + role: + type: string + enum: [member, manager] + description: Add them as Members, or as Managers (leaders) + TeamList: type: object properties: diff --git a/server.js b/server.js index 116079c..cf8cdbf 100644 --- a/server.js +++ b/server.js @@ -1519,6 +1519,17 @@ function buildDocsPage() { { code: "404", cls: "response-4xx", desc: "Not found, or a Team of an Organisation you aren't in" }, { code: "422", cls: "response-4xx", desc: "{errors: {field: [...]}}, e.g. another Organisation's Project or an unknown role" } ], "Changes the Automatically add managers and members to projects settings, as the Create/Edit Team popup does. Send only the fields to change. It doesn't add the Team's current people to anything; people are added only as they join.")} + ${endpointCard("POST", "/teams/{id}/members", "Add colleagues to a Team", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Team ID" }, + { name: "user_ids", type: "integer[]", required: true, desc: "Colleagues (users) already in the Team's Organisation" }, + { name: "role", type: "string", required: true, desc: "member or manager" } + ], [ + { code: "200", cls: "response-2xx", desc: "The Team, with the people added" }, + { code: "401", cls: "response-4xx", desc: "Not authenticated" }, + { code: "403", cls: "response-4xx", desc: "You aren't an Organisation Admin of the Team's Organisation" }, + { code: "404", cls: "response-4xx", desc: "Not found, or a Team of an Organisation you aren't in" }, + { code: "422", cls: "response-4xx", desc: "{errors: {field: [...]}}, e.g. someone who isn't a colleague, or an unknown role" } + ], "Adds people as the Create/Edit Team popup and the Teams tab of Invite a colleague do, leaving the Team's other people as they are. When the Team adds people to Projects, the ones who join are added to them too.")}