Skip to main content

Trigger Background Job

Trigger a background job manually. This endpoint allows administrators to manually trigger background jobs that normally run on a schedule, such as token expiry cleanup, data synchronization, or report generation.


Endpoint

Method: POST URL: {{base_url}}/api/v1/admin/jobs/trigger


Authentication

This endpoint uses Bearer Token authentication via a JWT (JSON Web Token). The token must be included in the Authorization header. Requires admin-level permissions.


Headers

HeaderDescriptionRequired
AuthorizationBearer token (JWT) for authenticationYes
acceptSpecifies acceptable response formats (application/json)Yes
content-typeMust be application/jsonYes
x-tenantidUUID identifying the tenant/organizationYes
realmnameThe authentication realm nameNo

Path Parameters

None.


Query Parameters

None.


Request Body Schema

FieldTypeDescriptionRequired
jobNamestringThe name of the job to triggerYes

Request Body Example

{
"jobName": "tokenExpiry"
}

Other Job Examples:

{
"jobName": "dataSync"
}
{
"jobName": "reportGeneration"
}
{
"jobName": "cleanupExpiredSessions"
}

Example cURL

curl --request POST \
--url '{{base_url}}/api/v1/admin/jobs/trigger' \
--header 'accept: application/json' \
--header 'authorization: Bearer {{access_token}}' \
--header 'content-type: application/json' \
--header 'x-tenantid: {{tenant_id}}' \
--data '{
"jobName": "tokenExpiry"
}'

Success Response Example

Status Code: 200 OK

{
"success": true,
"message": "Job triggered successfully",
"data": {
"jobId": "job-550e8400-e29b-41d4-a716-446655440001",
"jobName": "tokenExpiry",
"status": "queued",
"triggeredAt": "2025-07-10T14:45:00.000Z",
"triggeredBy": {
"id": "1876278a-3634-4833-b73e-1536d806e117",
"name": "Deepak purohit",
"email": "deepak.purohit@rezolve.ai"
},
"estimatedStartTime": "2025-07-10T14:45:05.000Z",
"priority": "normal"
},
"timestamp": "2025-07-10T14:45:00.000Z"
}

Available Jobs

Job NameDescription
tokenExpiryClean up expired tokens
dataSyncSynchronize data across services
reportGenerationGenerate scheduled reports
cleanupExpiredSessionsRemove expired user sessions
auditLogArchiveArchive old audit logs
credentialRotationCheckCheck for credentials needing rotation

Error Responses

Status CodeErrorDescription
400 Bad RequestInvalid job nameThe specified job name is not recognized
401 UnauthorizedAuthentication failedBearer token is missing, expired, or invalid
403 ForbiddenInsufficient permissionsUser lacks permission to trigger jobs
409 ConflictJob already runningThe specified job is already in progress
500 Internal Server ErrorServer errorUnexpected server-side error

Notes

  1. Manual Override: Use this to manually trigger jobs outside their scheduled time.

  2. Job Queue: Triggered jobs are added to the queue and processed in order.

  3. Idempotency: If a job is already running, a 409 error is returned.

  4. Monitoring: Use the job stats endpoint to monitor job progress.

  5. Required Roles: Requires system_admin or super_admin role.