# Add Project Members Adds a list of project members to a project. When the project is already assigned to all employees, it will be converted to a project with members. (`assigned_to_all` will be set to false) If the person is already a member of the project, the request is a no-op. If any of the person IDs are invalid, the entire request will fail with a 422 response. Subprojects can't have members. Trying to add members to a subproject will fail with a 422 response. # OpenAPI definition ```json { "openapi": "3.0.0", "info": { "title": "Attendances API", "version": "2.0.0", "description": "Endpoints to manage attendance periods, projects and their members." }, "servers": [ { "url": "https://api.personio.de" } ], "security": [ { "BearerAuth": [] } ], "tags": [ { "name": "Project Members", "description": "Endpoints relating to project members." } ], "paths": { "/v2/projects/{id}/members": { "parameters": [ { "$ref": "#/components/parameters/projectIdParam" } ], "post": { "x-path-examples": { "201 POST Project Members valid request": { "value": "/papi/v2/projects/1234/members" }, "201 POST Project Members valid request single item": { "value": "/papi/v2/projects/1234/members" }, "400 Invalid Project Members JSON": { "value": "/papi/v2/projects/1234/members" }, "400 Missing Project Members required parameters": { "value": "/papi/v2/projects/1234/members" }, "422 Person not found": { "value": "/papi/v2/projects/1234/members" }, "422 Can't manage members with subproject": { "value": "/papi/v2/projects/1234/members" }, "403 Forbidden response": { "value": "/papi/v2/projects/1234/members" }, "404 Resource Not Found": { "value": "/papi/v2/projects/9999/members" } }, "tags": [ "Project Members" ], "summary": "Add Project Members", "description": "Adds a list of project members to a project. When the project is already assigned to all employees, it will be converted to a project with members. (`assigned_to_all` will be set to false) If the person is already a member of the project, the request is a no-op.\nIf any of the person IDs are invalid, the entire request will fail with a 422 response.\nSubprojects can't have members. Trying to add members to a subproject will fail with a 422 response.\n", "requestBody": { "$ref": "#/components/requestBodies/AddProjectMembersRequest" }, "responses": { "201": { "$ref": "#/components/responses/AddProjectMembersResponse" }, "400": { "$ref": "#/components/responses/AddProjectMembersBadRequestResponse" }, "403": { "$ref": "#/components/responses/ForbiddenResponse" }, "404": { "$ref": "#/components/responses/NotFoundResponse" }, "422": { "$ref": "#/components/responses/ManageProjectMembersUnprocessableContentErrorResponse" } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer" } }, "requestBodies": { "AddProjectMembersRequest": { "description": "Request object for adding project members.", "required": true, "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/ProjectMember" } }, "examples": { "201 POST Project Members valid request": { "value": [ { "person": { "id": "1234" } }, { "person": { "id": "5678" } } ] }, "201 POST Project Members valid request single item": { "value": [ { "person": { "id": "1234" } } ] }, "400 Invalid Project Members JSON": { "value": { "random": "INVALID JSON" } }, "400 Missing Project Members required parameters": { "value": [ { "person": {} } ] }, "422 Person not found": { "value": [ { "person": { "id": "1234" } } ] }, "422 Can't manage members with subproject": { "value": [ { "person": { "id": "1234" } } ] }, "403 Forbidden response": { "value": [ { "person": { "id": "1234" } } ] }, "404 Resource Not Found": { "value": [ { "person": { "id": "1234" } } ] } } } } } }, "schemas": { "ProjectMember": { "type": "object", "required": [ "person" ], "description": "- Model of project member entity. - Describes a person assigned to a project.", "properties": { "person": { "type": "object", "description": "An object reference for a Person.", "required": [ "id" ], "properties": { "id": { "type": "string", "example": "1234" } } } } } }, "responses": { "ForbiddenResponse": { "description": "Forbidden", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/NotFoundResponse/content/application~1problem%2Bjson/schema" }, "examples": { "403 Forbidden response": { "$ref": "#/components/examples/ForbiddenResponse" } } } } }, "NotFoundResponse": { "description": "The resource could not be found.", "content": { "application/problem+json": { "schema": { "type": "object", "description": "This object represents an error response.", "properties": { "personio_trace_id": { "type": "string", "example": "aswo3f-a202lfso-312123sld-1230ddd", "description": "A unique ID that was created for this error." }, "timestamp": { "type": "string", "format": "date-time", "example": "2021-05-28T11:17:30.000Z", "description": "The timestamp of when the error occurred." }, "errors": { "type": "array", "items": { "type": "object", "properties": { "title": { "type": "string", "example": "Not found", "description": "The title of the error." }, "detail": { "type": "string", "example": "The requested resource was not found.", "description": "A short description about the error." }, "type": { "type": "string", "format": "uri", "example": "https://developer.personio.de/reference/errors#common.requested_resource_not_found", "description": "A link to the developer hub where more information can be found for the encountered error." }, "_meta": { "type": "object", "additionalProperties": { "type": "string" } } } } } } }, "examples": { "404 Resource Not Found": { "$ref": "#/components/examples/NotFoundResponse" } } } } }, "AddProjectMembersResponse": { "description": "Successful response.", "content": { "application/json": { "schema": { "type": "object", "properties": { "_data": { "type": "array", "items": { "$ref": "#/components/schemas/ProjectMember" } } } }, "examples": { "201 POST Project Members valid request": { "$ref": "#/components/examples/AddProjectMembersResponse" }, "201 POST Project Members valid request single item": { "$ref": "#/components/examples/AddProjectMembersResponseSingleItem" } } } } }, "AddProjectMembersBadRequestResponse": { "description": "Invalid request", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/NotFoundResponse/content/application~1problem%2Bjson/schema" }, "examples": { "400 Invalid Project Members JSON": { "$ref": "#/components/examples/InvalidPostPayloadResponse" }, "400 Missing Project Members required parameters": { "$ref": "#/components/examples/MissingProjectMembersRequiredFieldsPayloadResponse" } } } } }, "ManageProjectMembersUnprocessableContentErrorResponse": { "description": "Unprocessable content", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/NotFoundResponse/content/application~1problem%2Bjson/schema" }, "examples": { "422 Person not found": { "$ref": "#/components/examples/PersonNotFoundResponse" }, "422 Can't manage members with subproject": { "$ref": "#/components/examples/CantManageMembersWithSubprojectResponse" } } } } } }, "examples": { "ForbiddenResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Access denied", "detail": "Access denied to perform attendance period operations.", "type": "https://developer.personio.de/reference/errors#common.forbidden_response" } ] } }, "NotFoundResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Resource not found", "detail": "The requested resource is not found.", "type": "https://developer.personio.de/reference/errors#common.resource_not_found" } ] } }, "InvalidPostPayloadResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Input must be valid JSON", "detail": "The provided input is not a JSON object." } ] } }, "AddProjectMembersResponse": { "value": { "_data": [ { "person": { "id": "1234" } }, { "person": { "id": "5678" } } ] } }, "AddProjectMembersResponseSingleItem": { "value": { "_data": [ { "person": { "id": "1234" } } ] } }, "MissingProjectMembersRequiredFieldsPayloadResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30+00:00", "errors": [ { "title": "Missing required fields", "detail": "The following required fields are missing: [id]", "_meta": { "field": "id" } } ] } }, "PersonNotFoundResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Person not found.", "detail": "The provided person ID `1234` does not exist. Please ensure that the person ID is correct." } ] } }, "CantManageMembersWithSubprojectResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Can't manage members with subproject.", "detail": "Members cannot be managed on subprojects." } ] } } } } } ```