Skip to content

Conversation

@c-st
Copy link

@c-st c-st commented Dec 4, 2025

API documentation for #20

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.

Description

This PR adds OpenAPI documentation for the new file upload endpoint. The endpoint accepts
multipart/form-data file uploads and returns the created file object ID and IPFS CID.

Changes:

  • Added POST /v1/spaces/{space_id}/files endpoint documentation
  • Added apimodel.FileUploadResponse schema definition
  • Includes proper request/response examples and error codes

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI

Related Tickets & Documents

  • Implementation PR: [Link to anytype-heart PR once created]
  • Adds REST API coverage for file upload functionality

Mobile & Desktop Screenshots/Recordings

N/A - OpenAPI specification update only.

Example usage:

curl -X POST http://localhost:31009/v1/spaces/{space_id}/files \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Anytype-Version: 2025-05-20" \
  -F "file=@/path/to/file.pdf"

Example response:
{
  "object_id": "bafyreiabc123def456",
  "file_id": "bafyreie6n5l5nkbjal37su54cha4coy7qzuhrnajluzv5qd5jvtsrxkequ",
  "details": {
    "name": "file.pdf",
    "sizeInBytes": 12345
  }
}

Added tests?

  • 👍 yes

This is a documentation-only change. Tests are included in the implementation PR.

Added to documentation?

  • 🙅 no documentation needed

The OpenAPI specification itself serves as the API documentation.

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.
@c-st c-st mentioned this pull request Dec 4, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant