API Reference
Complete API documentation for Cron Job Provider integration
API Endpoints
Authentication
API Key Authentication
All API requests require authentication using your API key. Include it in the request headers:
Authorization: Bearer YOUR_API_KEY
Getting Your API Key
- Log in to your Cron Job Provider account
- Go to Profile Settings
- Generate a new API key
- Copy and store it securely
Webhooks
Webhook Endpoint
Each cron job has a unique webhook URL that can be used to trigger the job manually:
https://cron.motherslittlehelpers.net/public/webhook.php?token=YOUR_SECRET_TOKEN
Triggering Jobs
You can trigger a job by making a request to its webhook URL:
curl -X POST "https://cron.motherslittlehelpers.net/public/webhook.php?token=YOUR_SECRET_TOKEN"
Webhook Response
The webhook will return a JSON response:
{
"success": true,
"job_id": 123,
"execution_id": 456,
"message": "Job triggered successfully",
"timestamp": "2024-01-01T12:00:00Z"
}
Security Considerations
- Each job has a unique secret token
- Tokens are randomly generated and secure
- Anyone with the token can trigger the job
- Consider using HTTPS for production
Job Management
Create a New Job
Create a new cron job via API:
POST /api/v1/jobs
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
{
"name": "Daily Backup",
"url": "https://example.com/api/backup",
"schedule_type": "day",
"interval": 1,
"status": "active"
}
Update a Job
Update an existing cron job:
PUT /api/v1/jobs/{job_id}
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
{
"name": "Updated Job Name",
"status": "inactive"
}
Delete a Job
Delete a cron job:
DELETE /api/v1/jobs/{job_id}
Authorization: Bearer YOUR_API_KEY
List All Jobs
Get a list of all your cron jobs:
GET /api/v1/jobs?page=1&limit=10
Authorization: Bearer YOUR_API_KEY
Execution Logs
Get Job Logs
Retrieve execution logs for a specific job:
GET /api/v1/jobs/{job_id}/logs?page=1&limit=50
Authorization: Bearer YOUR_API_KEY
Log Response Format
Each log entry contains:
{
"id": 123,
"job_id": 456,
"start_time": "2024-01-01T12:00:00Z",
"end_time": "2024-01-01T12:00:05Z",
"duration_ms": 5000,
"http_status_code": 200,
"response_snippet": "Success: Backup completed",
"error_message": null,
"created_at": "2024-01-01T12:00:05Z"
}
Filter Logs
Filter logs by various criteria:
GET /api/v1/jobs/{job_id}/logs?status=success&from=2024-01-01&to=2024-01-31
Rate Limits
API Rate Limits
To ensure fair usage, we implement the following rate limits:
| Plan | API Calls | Webhook Triggers | Job Executions |
|---|---|---|---|
| Free | 100/hour | 10/hour | 5/month |
| Business | 1,000/hour | 100/hour | 50/month |
| Developer | 5,000/hour | 500/hour | 500/month |
Rate Limit Headers
API responses include rate limit information:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 950
X-RateLimit-Reset: 1640995200
Error Codes
HTTP Status Codes
Our API uses standard HTTP status codes:
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource not found |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server error |
Error Response Format
Error responses include detailed information:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid schedule_type value",
"details": {
"field": "schedule_type",
"value": "invalid_value",
"allowed_values": ["minute", "hour", "day", "week", "month"]
}
}
}