JWT Authentication
Swiftor uses JWT Bearer tokens for authentication. Public endpoints like profiles and reports are accessible without authentication, but most operations require a valid JWT token. User authentication details retrieved via JWT are cached using Redis for improved performance.
To authenticate your requests, include your JWT token in the Authorization header:
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-H "Origin: https://swiftor.io" \
http://api.swiftor.io/vms
Token Security
Keep your JWT token secure and never share it. Tokens can be compromised if exposed.
API Access
Currently we only offer direct API access to our enterprise plan subscribers. We are working on API keys rather than a JWT token.
These endpoints are accessible without authentication:
GET /@{username}
- Get user's public profileGET /@{username}/pfp
- Get profile pictureGET /@{username}/banner
- Get profile bannerGET /@{username}/{reportid}
- Get public reportPOST /@{username}/{reportid}
- Get public report details. Requires a JSON body, potentially with a password
field if the report is protected.Report Access
Only reports marked as public (not private) are accessible. If a public report is password-protected, the correct password must be supplied in the request body.
Authentication Required
All endpoints below require a valid JWT token in the Authorization header.
We use redis for caching.
GET /init
- Get current authenticated user's comprehensive information (profile, VMs, reports, payloads, notifications).GET /get-usage
- Get Sparks usage details.GET /vms
- List VMsPOST /vms/create
- Create VMGET /vms/start/{vmid}
- Start VMGET /vms/stop/{vmid}
- Stop VMGET /vms/delete/{vmid}
- Delete VMGET /vms/secrets
- Manage Environment VariablesGET /vms/networking
- Manage Subdomain MappingGET /reports
- List reportsPOST /reports/create
- Create reportPUT /reports/publish/{report_id}
- Update report (used to manage content, theme, protection status, etc.)DELETE /reports/{report_id}
- Delete reportPOST /payloads/install
- Install payloadPOST /payloads/abuse
- Report abuseGET /payloads/abuse/{payloadid}
- Get abuse reports (admin only)GET /storage
- List storage usagePOST /storage/upload
- Upload fileDELETE /storage/{file_id}
- Delete fileGET /notifications
- Get notificationsPOST /notifications/read
- Mark as readPOST /payment/test/create-checkout-session
- Create checkoutPOST /ai/chat
- Chat with AI (streaming)/delete
handle account-related deletion tasks. (Details TBC)Cross-Origin Requests
The API only accepts requests from https://swiftor.io
. All other origins will be rejected.
The API uses standard HTTP status codes with JSON error responses:
{
"detail": "Error description"
}
Common status codes:
Code | Description |
---|---|
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Server Error |