From 4628be386f8901aa401185e95f6d5c85ed65d2b5 Mon Sep 17 00:00:00 2001 From: Christian Stangier Date: Thu, 4 Dec 2025 23:32:51 +0100 Subject: [PATCH] Add file upload endpoint to OpenAPI specification Add POST /v1/spaces/{space_id}/files endpoint for uploading files via multipart/form-data. Includes FileUploadResponse schema with file_id (IPFS CID) and object_id fields. --- docs/reference/openapi-2025-05-20.yaml | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/docs/reference/openapi-2025-05-20.yaml b/docs/reference/openapi-2025-05-20.yaml index 951cce7c..6391f435 100644 --- a/docs/reference/openapi-2025-05-20.yaml +++ b/docs/reference/openapi-2025-05-20.yaml @@ -1375,6 +1375,25 @@ components: - ObjectLayoutSet - ObjectLayoutCollection - ObjectLayoutParticipant + apimodel.FileUploadResponse: + description: The response after uploading a file + properties: + details: + additionalProperties: true + description: Additional file metadata (size, mime type, etc.) + type: object + file_id: + description: The file ID (IPFS CID) + example: bafyreie6n5l5nkbjal37su54cha4coy7qzuhrnajluzv5qd5jvtsrxkequ + type: string + object_id: + description: The ID of the created file object + example: bafyreiabc123def456 + type: string + required: + - file_id + - object_id + type: object apimodel.ObjectResponse: properties: object: @@ -3470,6 +3489,76 @@ paths: summary: Update object tags: - Objects + /v1/spaces/{space_id}/files: + post: + description: Uploads a file to the specified space using multipart/form-data. + The file is processed and stored, then a file object is created. Returns the + file object ID and file ID (IPFS CID). + operationId: upload_file + parameters: + - description: The version of the API to use + in: header + name: Anytype-Version + required: true + schema: + default: "2025-05-20" + type: string + - description: The ID of the space to upload the file to + in: path + name: space_id + required: true + schema: + type: string + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + description: The file to upload + format: binary + type: string + required: + - file + type: object + description: The file to upload + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/apimodel.FileUploadResponse" + description: File uploaded successfully + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/util.BadRequestError" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/util.UnauthorizedError" + description: Unauthorized + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/util.RateLimitError" + description: Rate limit exceeded + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/util.ServerError" + description: Internal server error + security: + - bearerauth: [] + summary: Upload file + tags: + - Files /v1/spaces/{space_id}/properties: get: description: "⚠ Warning: Properties are experimental and may change in the next