API Reference
The Armor REST API provides comprehensive endpoints for file management, authentication, and system operations. This API supports multiple authentication methods and offers complete file operations with real-time collaboration features.
Table of contents
- Interactive Documentation
- Authentication Methods
- API Categories
- API Examples
- API Key Permissions
- Real-Time Features
- Response Formats
- Error Handling
- Rate Limiting
- Best Practices
- Related Documentation
Interactive Documentation
Access the complete interactive Swagger UI at /api-docs on your Armor server
The Swagger UI provides:
- Dark theme integration: Professional appearance matching Armor’s interface
- API key management: Fill authentication directly from your existing keys
- Temporary key generation: Create testing keys on-demand
- Dynamic server detection: Auto-detects your server with custom override option
- Live testing: Try all endpoints directly from the documentation
Direct Links
- Live Swagger UI - Interactive API documentation with testing
- OpenAPI Specification - Raw OpenAPI 3.0 spec for tools and integrations
Authentication Methods
Armor supports three authentication methods for maximum compatibility:
1. API Keys (Recommended for Automation)
# Bearer token authentication
curl -k -H "Authorization: Bearer YOUR_API_KEY" \
https://your-server/api/api-keys
2. JWT Sessions (Web Interface)
# Login to get JWT token
curl -k -X POST -H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}' \
https://your-server/auth/login/basic
3. HTTP Basic Auth (CLI Tools)
# wget style (wget compatible)
wget --no-check-certificate "https://admin:admin123@your-server/file.txt"
# curl style
curl -k -u admin:admin123 https://your-server/file.txt
API Categories
API Key Management
GET /api/api-keys- List your API keysPOST /api/api-keys- Create new API keyPUT /api/api-keys/{id}- Update API keyDELETE /api/api-keys/{id}- Delete API key
File Operations
GET /{path}- Download file or list directoryPOST /{path}- Upload file (multipart/form-data)POST /{path}/folders- Create folderPUT /{path}?action=rename- Rename file or folderDELETE /{path}- Delete file or directory
Search Operations
POST /{path}/search- Search files by name or checksum
Authentication
GET /auth/methods- Get available authentication methodsPOST /auth/login/basic- Basic username/password loginPOST /auth/logout- Logout and clear token
API Examples
File Operations
List Directory Contents
# Get JSON directory listing
curl -k -H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
https://your-server/uploads/
Upload File
# Upload file to specific directory
curl -k -X POST -H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@./local-file.txt" \
https://your-server/uploads/documents/
Search Files
# Search for files by name or checksum
curl -k -X POST -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"document"}' \
https://your-server/uploads/search
Create Folder
# Create new folder
curl -k -X POST -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"folderName":"new-folder"}' \
https://your-server/uploads/folders
Rename File
# Rename file or folder
curl -k -X PUT -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"newName":"new-filename.txt"}' \
https://your-server/uploads/oldname.txt?action=rename
API Key Management
Create API Key
# Create API key with specific permissions
curl -k -X POST -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "CI Pipeline",
"permissions": ["downloads", "uploads"],
"expires_at": "2025-12-31T23:59:59.000Z"
}' \
https://your-server/api/api-keys
List API Keys
# Get all your API keys
curl -k -H "Authorization: Bearer YOUR_API_KEY" \
https://your-server/api/api-keys
Authentication
Basic Login
# Authenticate with username/password
curl -k -X POST -H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}' \
https://your-server/auth/login/basic
Get Auth Methods
# Check available authentication methods
curl -k https://your-server/auth/methods
API Key Permissions
API keys can have the following permissions:
- downloads - Access to download files and list directories
- uploads - Access to upload files and create folders
- delete - Access to delete files and directories
Note: Users can only create API keys with permissions they have. Regular users can only create download-only keys.
Real-Time Features
Server-Sent Events (SSE)
Armor provides real-time updates via Server-Sent Events:
// Connect to real-time updates
const eventSource = new EventSource('/events');
eventSource.addEventListener('checksum-update', function(event) {
const data = JSON.parse(event.data);
console.log('File checksum updated:', data.filePath, data.checksum);
});
eventSource.addEventListener('file-deleted', function(event) {
const data = JSON.parse(event.data);
console.log('File deleted:', data.filePath);
});
Events include:
checksum-update- File checksum calculation completedfile-deleted- File or directory deletedfolder-created- New folder createdfile-renamed- File or folder renamed
Response Formats
Success Response
{
"success": true,
"message": "Operation completed successfully",
"data": {
// Response data varies by endpoint
}
}
Error Response
{
"success": false,
"message": "Error description",
"details": "Additional error information"
}
Directory Listing Response
{
"success": true,
"path": "/uploads/",
"files": [
{
"name": "document.pdf",
"path": "/uploads/document.pdf",
"size": 1024000,
"mtime": "2025-09-22T23:42:51.207Z",
"checksum": "1c8bdacfd9077738...",
"isDirectory": false
}
],
"total": 5
}
Error Handling
Armor uses standard HTTP status codes:
200- Success201- Created301- Redirect (directory trailing slash)400- Bad Request (invalid parameters)401- Unauthorized (authentication required)403- Forbidden (insufficient permissions)404- Not Found (file/directory doesn’t exist)500- Internal Server Error
Rate Limiting
API requests are subject to configurable rate limiting:
- Default: 100 requests per 10-minute window
- Headers include rate limit information:
RateLimit-Limit- Request limitRateLimit-Remaining- Remaining requestsRateLimit-Reset- Reset time
Best Practices
Security
- Use HTTPS for all API calls (
-kflag with curl for self-signed certs) - Store API keys securely (environment variables, not hardcoded)
- Use least-privilege permissions (only grant necessary API key permissions)
- Rotate API keys regularly
Performance
- Use
Accept: application/jsonheader for directory listings - Implement proper error handling for network timeouts
- Monitor rate limit headers to avoid throttling
- Use appropriate request timeouts
File Operations
- Verify file uploads with checksum validation
- Handle large file uploads with progress tracking
- Use appropriate Content-Type headers
- Implement retry logic for network failures
Related Documentation
- Getting Started Guide - Setup and basic usage
- Authentication Guide - Detailed auth configuration
- Configuration Reference - Complete config options
Need help? Check our Support Documentation or open an issue.