This document describes the HiveHub Cloud API integration for Vectorizer Sync. Note: This API is planned for future implementation and is documented here for reference.
Current Status: Documented only, not implemented
Planned Implementation: Future release
The system SHALL use OAuth 2.0 for authentication with HiveHub Cloud.
POST https://api.hivehub.cloud/oauth/authorize
Request:
{
"client_id": "<client_id>",
"redirect_uri": "vectorizer-sync://oauth/callback",
"response_type": "code",
"scope": "workspace:read workspace:write files:read files:write",
"state": "<random_state>"
}Response:
- Redirects to HiveHub login page
- User authenticates
- Redirects back to application with authorization code
POST https://api.hivehub.cloud/oauth/token
Request:
{
"grant_type": "authorization_code",
"code": "<authorization_code>",
"redirect_uri": "vectorizer-sync://oauth/callback",
"client_id": "<client_id>",
"client_secret": "<client_secret>"
}Response:
{
"access_token": "<access_token>",
"refresh_token": "<refresh_token>",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "workspace:read workspace:write files:read files:write"
}POST https://api.hivehub.cloud/oauth/token
Request:
{
"grant_type": "refresh_token",
"refresh_token": "<refresh_token>",
"client_id": "<client_id>",
"client_secret": "<client_secret>"
}Response: Same as token exchange
- Access tokens stored securely (OS keychain/credential store)
- Refresh tokens stored securely
- Tokens automatically refreshed before expiration
- Tokens cleared on logout
https://api.hivehub.cloud/v1
All API requests MUST include authentication header:
Authorization: Bearer <access_token>
Get list of user's workspaces.
Endpoint: GET /workspaces
Response:
{
"workspaces": [
{
"id": "ws_abc123",
"name": "My Workspace",
"description": "Workspace description",
"created_at": "2025-12-02T10:30:00.000Z",
"updated_at": "2025-12-02T15:45:00.000Z",
"quota_used": 500000000,
"quota_limit": 1000000000,
"file_count": 1234
}
]
}Get details of a specific workspace.
Endpoint: GET /workspaces/:workspace_id
Response:
{
"id": "ws_abc123",
"name": "My Workspace",
"description": "Workspace description",
"created_at": "2025-12-02T10:30:00.000Z",
"updated_at": "2025-12-02T15:45:00.000Z",
"quota_used": 500000000,
"quota_limit": 1000000000,
"file_count": 1234,
"collections": [
{
"id": "col_xyz789",
"name": "source-code",
"file_count": 567
}
]
}Create a new workspace.
Endpoint: POST /workspaces
Request:
{
"name": "My New Workspace",
"description": "Workspace description"
}Response:
{
"id": "ws_new123",
"name": "My New Workspace",
"description": "Workspace description",
"created_at": "2025-12-02T16:00:00.000Z",
"updated_at": "2025-12-02T16:00:00.000Z",
"quota_used": 0,
"quota_limit": 1000000000,
"file_count": 0
}Update workspace configuration.
Endpoint: PUT /workspaces/:workspace_id
Request:
{
"name": "Updated Workspace Name",
"description": "Updated description"
}Response: Updated workspace object
Delete a workspace (and all its files).
Endpoint: DELETE /workspaces/:workspace_id
Response: 204 No Content
Upload a file to a workspace.
Endpoint: POST /workspaces/:workspace_id/files
Request (multipart/form-data):
file: <file content>
path: <relative/path/to/file>
collection: <collection_name>
Response:
{
"id": "file_abc123",
"path": "relative/path/to/file",
"size": 12345,
"hash": "sha256_hash",
"uploaded_at": "2025-12-02T16:30:00.000Z",
"collection_id": "col_xyz789"
}Update an existing file.
Endpoint: PUT /workspaces/:workspace_id/files/:file_id
Request (multipart/form-data):
file: <updated file content>
Response: Updated file object
Delete a file from workspace.
Endpoint: DELETE /workspaces/:workspace_id/files/:file_id
Response: 204 No Content
List files in a workspace.
Endpoint: GET /workspaces/:workspace_id/files
Query Parameters:
collection: Filter by collection namelimit: Maximum number of results (default: 100)offset: Pagination offset
Response:
{
"files": [
{
"id": "file_abc123",
"path": "relative/path/to/file",
"size": 12345,
"hash": "sha256_hash",
"uploaded_at": "2025-12-02T16:30:00.000Z",
"updated_at": "2025-12-02T16:30:00.000Z",
"collection_id": "col_xyz789"
}
],
"total": 1234,
"limit": 100,
"offset": 0
}Get file details.
Endpoint: GET /workspaces/:workspace_id/files/:file_id
Response: File object
Get user account information and quota.
Endpoint: GET /account
Response:
{
"email": "user@example.com",
"plan": {
"type": "free",
"name": "Free Plan",
"quota_limit": 1000000000,
"quota_used": 500000000,
"quota_percentage": 50
},
"workspaces_count": 3,
"created_at": "2025-01-01T00:00:00.000Z"
}Get detailed quota information.
Endpoint: GET /account/quota
Response:
{
"quota_limit": 1000000000,
"quota_used": 500000000,
"quota_available": 500000000,
"quota_percentage": 50,
"warnings": [
{
"threshold": 80,
"message": "You are using 80% of your quota"
}
]
}Get user notifications.
Endpoint: GET /notifications
Query Parameters:
unread_only: Return only unread notifications (default: false)limit: Maximum number of results (default: 50)offset: Pagination offset
Response:
{
"notifications": [
{
"id": "notif_abc123",
"type": "quota_warning",
"severity": "warning",
"title": "Quota Warning",
"message": "You are using 80% of your quota",
"read": false,
"action_url": "https://hivehub.cloud/upgrade",
"created_at": "2025-12-02T15:00:00.000Z"
}
],
"total": 5,
"unread_count": 2
}Mark a notification as read.
Endpoint: PUT /notifications/:notification_id/read
Response: 204 No Content
Mark all notifications as read.
Endpoint: PUT /notifications/read-all
Response: 204 No Content
All API errors follow this format:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {
"field": "additional error details"
}
}
}200 OK: Successful request201 Created: Resource created successfully204 No Content: Successful request with no response body400 Bad Request: Invalid request parameters401 Unauthorized: Authentication required or invalid token403 Forbidden: Insufficient permissions404 Not Found: Resource not found409 Conflict: Resource conflict (e.g., quota exceeded)429 Too Many Requests: Rate limit exceeded500 Internal Server Error: Server error503 Service Unavailable: Service temporarily unavailable
AUTH_REQUIRED: Authentication requiredAUTH_INVALID: Invalid authentication tokenAUTH_EXPIRED: Authentication token expiredQUOTA_EXCEEDED: Quota limit exceededQUOTA_WARNING: Approaching quota limitFILE_TOO_LARGE: File exceeds size limitFILE_INVALID: Invalid file formatWORKSPACE_NOT_FOUND: Workspace not foundFILE_NOT_FOUND: File not foundRATE_LIMIT_EXCEEDED: Rate limit exceededSERVER_ERROR: Internal server error
API requests are rate-limited:
- Default: 100 requests per minute per user
- File Uploads: 10 uploads per minute per workspace
- Rate Limit Headers:
X-RateLimit-Limit: Maximum requests allowedX-RateLimit-Remaining: Remaining requestsX-RateLimit-Reset: When rate limit resets (Unix timestamp)
When rate limit is exceeded, the API returns 429 Too Many Requests.
The client SHALL implement exponential backoff for:
- Network errors
429 Too Many Requestsresponses503 Service Unavailableresponses
Retry Strategy:
- Initial delay: 1 second
- Maximum delay: 60 seconds
- Maximum retries: 5
- Exponential backoff: delay = min(initial_delay * 2^retry_count, max_delay)
Webhooks may be implemented in the future for:
- File upload completion
- Quota warnings
- Workspace updates
- Account changes
- HTTPS Only: All API communications use HTTPS
- Token Security: Tokens stored securely (OS keychain)
- Token Refresh: Automatic token refresh before expiration
- Request Signing: Optional request signing for additional security (future)
- Default timeout: 30 seconds
- File upload timeout: 5 minutes
- Configurable per request type
- Maximum file size: Based on plan quota
- Supported formats: All text-based files
- Binary files: Excluded by default
- Chunked upload: For large files (future)
- Initial Sync: Upload all files
- Incremental Sync: Upload only changed files (based on hash)
- Conflict Resolution: Last-write-wins (configurable)
- Batch Operations: Batch file operations for efficiency