# Update an attendance period. Update an attendance period by given attendance period ID and return the attendance period ID. # 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": "Attendances", "description": "Endpoints relating to the times that people work, and the rules that define this." } ], "paths": { "/v2/attendance-periods/{id}": { "parameters": [ { "$ref": "#/components/parameters/periodIdParam" } ], "patch": { "parameters": [ { "$ref": "#/components/parameters/skipApprovalQueryParam" } ], "x-path-examples": { "204 PATCH Valid request": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "400 Invalid JSON": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "400 Invalid start field": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "403 Forbidden response": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "404 Resource Not Found": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "422 Start date greater than end date": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "422 Period time range too long": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" }, "422 Break periods with project": { "value": "/papi/v2/attendance-periods/bd242cd1-5116-41a0-99aa-c12af4837c81", "query": "skip_approval=false" } }, "tags": [ "Attendances" ], "summary": "Update an attendance period.", "description": "Update an attendance period by given attendance period ID and return the attendance period ID.", "requestBody": { "$ref": "#/components/requestBodies/UpdateAttendancePeriodRequest" }, "responses": { "204": { "$ref": "#/components/responses/AttendancePeriodUpdatedResponse" }, "400": { "$ref": "#/components/responses/UpdateAttendancePeriod400ErrorResponse" }, "403": { "$ref": "#/components/responses/ForbiddenResponse" }, "404": { "$ref": "#/components/responses/NotFoundResponse" }, "422": { "$ref": "#/components/responses/UpdateAttendancePeriod422ErrorResponse" } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer" } }, "parameters": { "skipApprovalQueryParam": { "name": "skip_approval", "in": "query", "description": "If true, skip any approval that this write request would otherwise require.", "required": false, "schema": { "type": "boolean", "default": false, "example": false } } }, "requestBodies": { "UpdateAttendancePeriodRequest": { "description": "- Request object for updating an existing attendance period.", "required": true, "content": { "application/json": { "schema": { "anyOf": [ { "required": [ "start" ] }, { "required": [ "end" ] }, { "required": [ "comment" ] }, { "required": [ "project" ] } ], "properties": { "start": { "description": "Date time property", "required": [ "date_time" ], "type": "object", "properties": { "date_time": { "$ref": "#/components/schemas/DateTimeWithoutTimezone" } } }, "end": { "description": "Date time property", "type": "object", "nullable": true, "required": [ "date_time" ], "properties": { "date_time": { "$ref": "#/components/schemas/DateTimeWithoutTimezone" } } }, "comment": { "type": "string", "nullable": true }, "project": { "description": "Project reference by object ID. Projects need to have status=ACTIVE. Periods with type=BREAK can't have project.", "type": "object", "nullable": true, "required": [ "id" ], "properties": { "id": { "type": "string" } } } } }, "examples": { "204 PATCH Valid request": { "value": { "start": { "date_time": "2024-02-01T10:00:00" }, "end": { "date_time": "2024-02-01T18:00:00" }, "comment": "Hello", "project": { "id": "1234" } } }, "400 Invalid JSON": { "value": { "random": "INVALID JSON" } }, "400 Invalid start field": { "value": { "start": "NOTADATE" } }, "403 Forbidden response": { "value": { "start": { "date_time": "2024-02-01T10:00:00" }, "end": { "date_time": "2024-02-01T18:00:00" } } }, "404 Resource Not Found": { "value": { "start": { "date_time": "2024-02-01T10:00:00" }, "end": { "date_time": "2024-02-01T18:00:00" } } }, "422 Start date greater than end date": { "value": { "start": { "date_time": "2024-02-01T20:00:00" }, "end": { "date_time": "2024-02-01T10:00:00" } } }, "422 Period time range too long": { "value": { "start": { "date_time": "2024-02-01T10:00:00" }, "end": { "date_time": "2024-02-02T11:00:00" } } }, "422 Break periods with project": { "value": { "project": { "id": "1234" } } } } } } } }, "schemas": { "DateTimeWithoutTimezone": { "type": "string", "example": "2022-01-01T14:00:00", "description": "An RFC3339 date and timestamp without a timezone offset." } }, "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" } } } } }, "AttendancePeriodUpdatedResponse": { "description": "Attendance period was successfully updated.", "x-response-example": "204 PATCH Valid request" }, "UpdateAttendancePeriod400ErrorResponse": { "description": "Invalid request", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/NotFoundResponse/content/application~1problem%2Bjson/schema" }, "examples": { "400 Invalid JSON": { "$ref": "#/components/examples/InvalidPostPayloadResponse" }, "400 Invalid start field": { "$ref": "#/components/examples/InvalidStartPayloadResponse" } } } } }, "UpdateAttendancePeriod422ErrorResponse": { "description": "Invalid request", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/NotFoundResponse/content/application~1problem%2Bjson/schema" }, "examples": { "422 Start date greater than end date": { "$ref": "#/components/examples/StartGreaterThanEndResponse" }, "422 Period time range too long": { "$ref": "#/components/examples/TimeRangeTooLongResponse" }, "422 Project not trackable": { "$ref": "#/components/examples/AttendancePeriodsProjectNotTrackable" }, "422 Break periods with project": { "$ref": "#/components/examples/BreakPeriodsWithProject" } } } } } }, "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." } ] } }, "InvalidStartPayloadResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Invalid field value", "detail": "Invalid value for field: start. Value must in format: YYYY-MM-DDTHH:mm or YYYY-MM-DDTHH:mm:ss" } ] } }, "StartGreaterThanEndResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Invalid start date", "detail": "Start date cannot be greater than end date of an attendance period." } ] } }, "TimeRangeTooLongResponse": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2026-01-28T11:17:30Z", "errors": [ { "title": "Unprocessable entity", "detail": "Period cannot be longer than 24 hours." } ] } }, "AttendancePeriodsProjectNotTrackable": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Invalid project parameter", "detail": "Project not trackable" } ] } }, "BreakPeriodsWithProject": { "value": { "personio_trace_id": "aswo3f-a202lfso-312123sld-1230ddd", "timestamp": "2021-05-28T11:17:30Z", "errors": [ { "title": "Invalid project parameter", "detail": "Break periods cannot have a project associated" } ] } } } } } ```