Overview
The Document Storage Service is the core service for managing documents, projects, folders, and related functionality in Macro. It provides comprehensive document lifecycle management including creation, editing, versioning, permissions, and deletion. Base URL:/v1 (versioned API)
Authentication: All endpoints require JWT authentication via the Authorization header, except internal endpoints which use x-document-storage-service-auth-key.
Core Concepts
Documents
Documents are the primary content type in Macro. Each document has:- Unique document ID (UUID)
- Version history with document version IDs
- S3-backed storage with CloudFront CDN delivery
- Permissions and access control via entity access service
- Processing pipeline for text extraction and indexing
Projects
Projects are containers that organize documents and folders hierarchically. They support:- Nested folder structures
- Sharing and permissions
- Bulk operations
Annotations
Documents support collaborative annotations including:- Anchors (highlighted regions)
- Comments on specific document sections
- Mentions of users
Documents
Create Document
Document name
Parent project ID (optional)
Initial document content in Macro’s internal format
Unique document ID
Initial version ID for the document
Creation timestamp
Get Document
Document ID
Document ID
Document name
Signed CloudFront URL for document access (expires based on configuration)
Current version ID
Document owner user ID
Save Document
Document ID to update
Updated document content
Current version ID (for optimistic locking)
The service uses optimistic locking - if the version_id doesn’t match the current version, the save will fail to prevent conflicts.
Edit Document Metadata
Document ID
New document name
Move to different project
Copy Document
Document ID to copy
Name for the copied document (defaults to “Copy of [original name]”)
Project ID for the copy
Delete Document
Document ID to delete
Permanently Delete Document
Revert Document Deletion
Get Document Text
Extracted plain text content
Export Document
Export format:
pdf, docx, htmlGet Document Permissions
Array of permission objects with user/team ID and access level
Get Document Access Token
Document ID
Document version ID
JWT access token
Token expiration time
Projects
Create Project
Project name
Parent project ID (for nested folders)
Get Project
Update Project
Delete Project
If true, deletes all documents within the project
Annotations
Create Anchor
Document ID
Character offset where anchor starts
Character offset where anchor ends
Highlight color (hex code)
Create Comment
Document ID
Anchor ID (if commenting on a highlight)
Comment text
Array of user IDs to mention
Get Annotations
Document ID
Activity & History
Get Recent Activity
Number of activity items to return (default: 50)
Pagination offset
Get Document History
Filter by specific document
Error Codes
The Document Storage Service uses standard HTTP status codes:200- Success201- Resource created400- Bad request (validation error)401- Unauthorized (invalid or missing JWT)403- Forbidden (insufficient permissions)404- Document not found409- Conflict (version mismatch in optimistic locking)413- Payload too large (quota exceeded)500- Internal server error
Service-Specific Error Codes
Machine-readable error code
Human-readable error description
QUOTA_EXCEEDED- User has exceeded document quotaVERSION_CONFLICT- Document was modified by another userDOCUMENT_PROCESSING- Document is still being processedINVALID_DOCUMENT_ID- Malformed document IDPERMISSION_DENIED- User lacks required permissions