# Update document metadata. Updates the metadata of the Document with the provided Document ID. # OpenAPI definition ```json { "openapi": "3.0.0", "info": { "title": "Document Management", "version": "2.0.0", "description": "Collection of endpoints to manage Documents." }, "servers": [ { "url": "https://api.personio.de" } ], "security": [ { "BearerAuth": [] } ], "paths": { "/v2/document-management/documents/{document_id}": { "patch": { "summary": "Update document metadata.", "description": "Updates the metadata of the Document with the provided Document ID.", "tags": [ "Document Management" ], "x-path-examples": { "Document not found": { "value": "/v2/document-management/documents/54321" } }, "parameters": [ { "name": "document_id", "in": "path", "description": "Document ID of document to update metadata.", "example": 123, "schema": { "type": "string" }, "required": true } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateDocument" }, "examples": { "Update Document": { "$ref": "#/components/examples/UpdateDocumentRequest" }, "Category Not Found": { "$ref": "#/components/examples/NotFoundRequest" }, "Invalid Date Format": { "$ref": "#/components/examples/InvalidDocumentDateFormatRequest" }, "Invalid Date Null Value": { "$ref": "#/components/examples/InvalidDocumentDateNullValueRequest" }, "Invalid Date Empty String Value": { "$ref": "#/components/examples/InvalidDocumentDateEmptyStringValueRequest" }, "Invalid Name Length": { "$ref": "#/components/examples/InvalidDocumentNameLengthRequest" }, "Invalid Name Null Value": { "$ref": "#/components/examples/InvalidDocumentNameNullValueRequest" }, "Invalid Name Empty String Value": { "$ref": "#/components/examples/InvalidDocumentNameEmptyStringValueRequest" }, "Invalid Comment Null Value": { "$ref": "#/components/examples/InvalidDocumentCommentNullValueRequest" }, "Invalid Category ID Null Value": { "$ref": "#/components/examples/InvalidCategoryIdNullValueRequest" }, "Invalid Category ID Empty String Value": { "$ref": "#/components/examples/InvalidCategoryIdEmptyStringValueRequest" } } } } }, "responses": { "204": { "description": "The document metadata was successfully updated.", "x-response-example": "Update Document" }, "404": { "$ref": "#/components/responses/NotFoundError" }, "422": { "$ref": "#/components/responses/InvalidRequestError" } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer" } }, "responses": { "NotFoundError": { "description": "Requested resource not 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": { "Category Not Found": { "$ref": "#/components/examples/CategoryNotFoundResponse" }, "Document not found": { "$ref": "#/components/examples/DocumentNotFoundResponse" } } } } }, "InvalidRequestError": { "description": "Invalid request.", "content": { "application/problem+json": { "schema": { "$ref": "#/components/responses/NotFoundError/content/application~1problem%2Bjson/schema" }, "examples": { "Invalid Date Format": { "$ref": "#/components/examples/InvalidDocumentDateFormatResponse" }, "Invalid Date Null Value": { "$ref": "#/components/examples/InvalidDocumentDateNullEmptyValueResponse" }, "Invalid Date Empty String Value": { "$ref": "#/components/examples/InvalidDocumentDateNullEmptyValueResponse" }, "Invalid Name Length": { "$ref": "#/components/examples/InvalidDocumentNameLengthResponse" }, "Invalid Name Null Value": { "$ref": "#/components/examples/InvalidDocumentNameNullEmptyValueResponse" }, "Invalid Name Empty String Value": { "$ref": "#/components/examples/InvalidDocumentNameNullEmptyValueResponse" }, "Invalid Comment Null Value": { "$ref": "#/components/examples/InvalidDocumentCommentNullValueResponse" }, "Invalid Category ID Null Value": { "$ref": "#/components/examples/InvalidCategoryIdNullEmptyValueResponse" }, "Invalid Category ID Empty String Value": { "$ref": "#/components/examples/InvalidCategoryIdNullEmptyValueResponse" }, "Invalid limit": { "$ref": "#/components/examples/InvalidLimitResponse" }, "Invalid created_at.gte": { "$ref": "#/components/examples/InvalidCreatedAtGteResponse" }, "Invalid created_at.lt": { "$ref": "#/components/examples/InvalidCreatedAtLtResponse" } } } } } }, "schemas": { "Document": { "description": "Document schema", "type": "object", "properties": { "id": { "type": "string", "description": "The identifier for the Document.", "readOnly": true }, "name": { "type": "string", "description": "The name of the Document." }, "date": { "type": "string", "format": "date", "description": "A customisable date field for the Document. Documents will be ordered in Personio according to this date." }, "comment": { "type": "string", "description": "The comment associated with the Document." }, "category": { "type": "object", "description": "The category that the Document belongs to.", "properties": { "id": { "type": "string", "description": "ID of the category." } } }, "owner": { "type": "object", "description": "The owner of the document.", "properties": { "id": { "type": "string", "description": "The ID of the owner." } } }, "document_type": { "type": "string", "description": "The MIME type of the Document.", "readOnly": true }, "size": { "type": "integer", "description": "The size of the Document in bytes.", "readOnly": true }, "created_at": { "type": "string", "description": "The date/time the Document was created at.", "readOnly": true }, "virus_scan": { "type": "object", "description": "Information related to the virus scanning of the Document.", "readOnly": true, "properties": { "status": { "type": "string", "description": "The virus scan status of the Document. If no viruses have been detected, the status will be 'safe'. If a virus has been detected, the status will be 'unsafe'. If the virus scan has not yet completed, the status will be 'unknown'.", "enum": [ "unknown", "safe", "unsafe" ], "readOnly": true } } }, "esignature": { "type": "object", "description": "Information related to e-signature requests for the Document.", "readOnly": true, "properties": { "status": { "type": "string", "enum": [ "status_unspecified", "pending", "signed", "declined", "canceled", "expired", "failed", "email_bounced" ], "description": "The status of e-signature requests associated with the Document.", "readOnly": true } } } } }, "UpdateDocument": { "description": "Updated Document schema", "allOf": [ { "$ref": "#/components/schemas/Document" }, { "type": "object", "properties": { "owner": { "readOnly": true, "properties": { "id": { "readOnly": true } } } } } ] } }, "examples": { "UpdateDocumentRequest": { "value": { "name": "new name", "date": "2023-01-01", "comment": "a new comment", "category": { "id": 321 } } }, "NotFoundRequest": { "value": { "name": "new name", "date": "2023-01-01", "comment": "a new comment", "category": { "id": -1 } } }, "CategoryNotFoundResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Category not found.", "detail": "Category could not be found for requested category.id.", "type": "https://developer.personio.de/reference/errors#documents.not_found.category" } ] } }, "DocumentNotFoundResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Document not found.", "detail": "Document could not be found for requested document_id.", "type": "https://developer.personio.de/reference/errors#documents.not_found.document" } ] } }, "InvalidDocumentDateFormatRequest": { "value": { "name": "new name", "date": "23-1-1", "comment": "a new comment", "category": { "id": "abc" } } }, "InvalidDocumentDateFormatResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Invalid date format.", "detail": "The provided date for field 'date' is invalid. Please ensure that the date follows the format YYYY-MM-DD.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.date_format" } ] } }, "InvalidDocumentDateNullValueRequest": { "value": { "name": "new name", "date": null, "comment": "a new comment", "category": { "id": "abc" } } }, "InvalidDocumentDateEmptyStringValueRequest": { "value": { "name": "new name", "date": "", "comment": "a new comment", "category": { "id": "abc" } } }, "InvalidDocumentDateNullEmptyValueResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Missing value for document date.", "detail": "If the 'date' field is included, a value must be provided. Please ensure that the value follows the format YYYY-MM-DD.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.date_format" } ] } }, "InvalidDocumentNameLengthRequest": { "value": { "name": "This document name is too long KLe6pS83o4vJAnV9FxGQDXQPsaKALnkPOT07SY94MYJAHk3vzdYp1NfS4XN1gstXXeq7uzTDvYYKI5 3yGxVkQvEMiai6V9doOKn3zUuyibpwIBI684tSkrORc9ohgXvTvqoVyDk6BLJalyodXnwWTFKY8ywFtfyopGooSk5c5zU7jzT3W6oQqDvbzJp zO48IeotqpnXWNUvE71it4CEpZJyWzMLV7fZvYfb1NzVFSocKElTLDeNQUqMjhNGy2nqP", "date": "2023-01-01", "comment": "a new comment", "category": { "id": "abc" } } }, "InvalidDocumentNameLengthResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Invalid document name length.", "detail": "The provided value for field 'name' is invalid. The name must be less than 256 characters.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.name_length" } ] } }, "InvalidDocumentNameNullValueRequest": { "value": { "name": null, "date": "2023-01-01", "comment": "a new comment", "category": { "id": "abc" } } }, "InvalidDocumentNameEmptyStringValueRequest": { "value": { "name": "", "date": "2023-01-01", "comment": "a new comment", "category": { "id": "abc" } } }, "InvalidDocumentNameNullEmptyValueResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Missing value for document name.", "detail": "If the 'name' field is included, a value must be provided.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.name_empty" } ] } }, "InvalidDocumentCommentNullValueRequest": { "value": { "name": "new name", "date": "2023-01-01", "comment": null, "category": { "id": "abc" } } }, "InvalidDocumentCommentNullValueResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Null value for document comment.", "detail": "If the 'comment' field is included, the value must not be null.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.comment_null" } ] } }, "InvalidCategoryIdNullValueRequest": { "value": { "name": "new name", "date": "2023-01-01", "comment": "a new comment", "category": { "id": null } } }, "InvalidCategoryIdEmptyStringValueRequest": { "value": { "name": "new name", "date": "2023-01-01", "comment": "a new comment", "category": { "id": "" } } }, "InvalidCategoryIdNullEmptyValueResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Missing value for document category.id.", "detail": "If the 'category.id' field is included, a value must be provided.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.category_id_empty" } ] } }, "InvalidLimitResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Invalid limit parameter.", "detail": "The provided value for the 'limit' parameter is invalid. Please ensure that the value is an integer within the range 1-200.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.limit" } ] } }, "InvalidCreatedAtGteResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Invalid created_at.gte parameter.", "detail": "The provided date for the 'created_at.gte' parameter is invalid. Please ensure that the date follows the format YYYY-MM-DD.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.created_at.gte" } ] } }, "InvalidCreatedAtLtResponse": { "value": { "timestamp": "2022-06-17T14:07:17Z", "personio_trace_id": "aswo3f-a202lfso-312123sld-1230dd1", "errors": [ { "title": "Invalid created_at.lt parameter.", "detail": "The provided date for the 'created_at.lt' parameter is invalid. Please ensure that the date follows the format YYYY-MM-DD.", "type": "https://developer.personio.de/reference/errors#documents.invalid_request.created_at.lt" } ] } } } } } ```