Base URL
All API endpoints are available at:API_PORT environment variable.
Authentication
All API requests require authentication using an API key in the request header:Generating an API Key
Generate a secure API key using:.env file:
Security: Never commit API keys to version control. Always use environment variables for sensitive configuration.
Request Format
HTTP Methods
The API uses standard HTTP methods:- GET: Retrieve resources
- POST: Create resources or trigger actions
- PATCH: Update existing resources (partial)
- PUT: Replace existing resources (full)
- DELETE: Remove resources
Content Type
All POST, PATCH, and PUT requests should include:Request Body
Request bodies must be valid JSON:Response Format
Success Responses
Successful responses return the appropriate HTTP status code and JSON data:Paginated Responses
List endpoints return paginated results:limit: Number of items per page (default: 50, max: 100)offset: Number of items to skip (default: 0)
Error Responses
Errors return appropriate HTTP status codes and a JSON error object:HTTP Status Codes
| Status Code | Meaning | When Used |
|---|---|---|
| 200 | OK | Successful GET, PATCH, PUT, or DELETE request |
| 201 | Created | Successful POST request that creates a resource |
| 400 | Bad Request | Invalid request data, validation error, or operation failed |
| 401 | Unauthorized | Missing or invalid API key |
| 404 | Not Found | Resource does not exist |
| 500 | Internal Server Error | Unexpected server error |
Common Error Codes
400 Bad Request
Returned when:- Invalid JSON in request body
- Missing required fields
- Invalid field values or types
- Source validation fails (e.g., cannot connect to workflow source)
- Resource already exists (e.g., duplicate URL for sources)
- Operation fails (e.g., failed to create schedule)
401 Unauthorized
Returned when:- No
X-API-Keyheader provided - Invalid API key provided
404 Not Found
Returned when:- Requested resource ID does not exist
- Endpoint does not exist
Rate Limiting
No Rate Limiting: Spark does not implement rate limiting. You can make as many requests as your system can handle.
API Versioning
The current API version is v1, indicated in the URL path:Cross-Origin Requests (CORS)
CORS is enabled for all origins by default. Configure CORS settings via environment variables:Example Request
Here’s a complete example of making an API request:Available Endpoints
Sources API
Manage workflow sources (LangFlow, Hive)
Workflows API
Sync and run workflows
Schedules API
Create and manage cron schedules
Tasks API
Monitor task executions
Getting Help
Use the
--help flag with any CLI command to see available options:
