Dispatching Background Jobs via API
HosteDay provides a dedicated API endpoint to dispatch background jobs programmatically via a
POSTrequest without blocking your client responses.
Endpoint & Authentication
POST https://my-app.hosteday.com/api/jobs/dispatch
Required Headers & Limits
Authorization: Bearer YOUR_USER_TOKEN(requires Sanctum authentication:auth:sanctum).X-Api-Token: YOUR_API_TOKEN(when API Protection is enabled).Content-Type: application/jsonandAccept: application/json.- Feature Requirement: Requires the Jobs feature to be enabled on your App (
allow-jobs). - Rate Limit: Limited to 30 requests per minute (
throttle:30,1).
Request Body Fields (JSON)
| Field | Type & Validation | Description |
|---|---|---|
type |
Required string (required|string) |
Job type; supports create_site, send_notification, or generate_invoice. |
payload |
Required object/array (required|array) |
Job execution data specific to the selected job type. |
Example (POST /api/jobs/dispatch)
curl -X POST "https://my-app.hosteday.com/api/jobs/dispatch" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Api-Token: YOUR_API_TOKEN" \
-H "Authorization: Bearer YOUR_USER_TOKEN" \
-d '{
"type": "send_notification",
"payload": {
"title": "Order Update",
"body": "Your order is ready for shipping.",
"user_id": "42",
"data": {
"screen": "/orders/42"
}
}
}'
Expected Response (200 OK)
{
"success": true,
"message": null,
"data": {
"status": "success",
"message": "تم إرسال المهمة إلى قائمة الانتظار بنجاح.",
"type": "send_notification"
}
}
If dispatching fails, the endpoint returns a 502 error response:
{
"success": false,
"message": "تعذر إرسال المهمة إلى خادم المهام المركزي.",
"data": null
}
Monitoring & Managing Jobs in the Dashboard
You can monitor dispatched jobs and manage Table Hooks directly from the Background Jobs tool inside your App workspace at dash.hosteday.com.