Naijacloud
Docs

Cron jobs

Every /v1 route for cron jobs. This page is generated from the API's OpenAPI contract, so it always matches what the API accepts and returns.

Authentication, pagination, errors and idempotency work the same on every route. They are described once, in the API overview.

Get a cron run

GET /v1/cron-runs/{runId}

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
runIdstringyesThe run's id.

Returns

bash
curl "https://api.naijacloud.com/v1/cron-runs/$RUN_ID" \ -H "Authorization: Bearer $NC_API_KEY"

A cron run's output, oldest line first

GET /v1/cron-runs/{runId}/logs

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
runIdstringyesThe run's id.

Query parameters

NameTypeRequiredNotes
limitintegernoRows per page. Ignored when a cursor is given.
cursorstringnoThe nextCursor of the previous page, unchanged.

Returns

  • 200 with a page: { data: V1CronRunLogLine[], nextCursor }, where each item is V1CronRunLogLine.
bash
curl "https://api.naijacloud.com/v1/cron-runs/$RUN_ID/logs" \ -H "Authorization: Bearer $NC_API_KEY"

Change a cron job's schedule or command

PATCH /v1/services/{serviceId}/cron

Takes effect from the next scheduled run.

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Body

FieldTypeRequiredNotes
schedulestringnoFive-field cron expression, in UTC. e.g. 0 3 * * *
commandstringnoThe command each run executes.

Returns

bash
curl -X PATCH "https://api.naijacloud.com/v1/services/$SERVICE_ID/cron" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Content-Type: application/json" \ -d '{"schedule":"0 3 * * *"}'

List a cron job's runs, newest first

GET /v1/services/{serviceId}/runs

Key scopes: READ and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Query parameters

NameTypeRequiredNotes
limitintegernoRows per page. Ignored when a cursor is given.
cursorstringnoThe nextCursor of the previous page, unchanged.

Returns

  • 200 with a page: { data: V1CronRun[], nextCursor }, where each item is V1CronRun.
bash
curl "https://api.naijacloud.com/v1/services/$SERVICE_ID/runs" \ -H "Authorization: Bearer $NC_API_KEY"

Run a cron job now

POST /v1/services/{serviceId}/runs

Needs a built image: deploy the job first.

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Headers

NameTypeRequiredNotes
Idempotency-KeystringnoAny unique string (1–255 printable characters). A retry with the same key and body returns the first response instead of acting twice, for 24 hours.

Returns

bash
curl -X POST "https://api.naijacloud.com/v1/services/$SERVICE_ID/runs" \ -H "Authorization: Bearer $NC_API_KEY" \ -H "Idempotency-Key: $(uuidgen)"

Resume scheduled runs

POST /v1/services/{serviceId}/cron/resume

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Returns

  • 204 with no body.
bash
curl -X POST "https://api.naijacloud.com/v1/services/$SERVICE_ID/cron/resume" \ -H "Authorization: Bearer $NC_API_KEY"

Pause scheduled runs

POST /v1/services/{serviceId}/cron/suspend

Manual runs still work while paused.

Key scopes: WRITE and PLATFORM_API.

Path parameters

NameTypeRequiredNotes
serviceIdstringyesThe service's id.

Returns

  • 204 with no body.
bash
curl -X POST "https://api.naijacloud.com/v1/services/$SERVICE_ID/cron/suspend" \ -H "Authorization: Bearer $NC_API_KEY"

Types

V1CronRun

FieldTypeNotes
idstring (uuid)
serviceIdstring (uuid)
seqnumber, or nullRun number for this job, from 1.
statusQUEUED, RUNNING, SUCCEEDED, FAILED, TIMED_OUT, SKIPPED
triggerSCHEDULED, MANUAL
exitCodenumber, or null
errorstring, or null
commitShastring, or null
createdAtstring (date-time)
startedAtstring (date-time), or null
finishedAtstring (date-time), or null

V1CronRunLogLine

FieldTypeNotes
idstring (uuid)
linestring
streamOUTPUT, SYSTEM
createdAtstring (date-time)

V1CronSettings

FieldTypeNotes
serviceIdstring (uuid)
schedulestring, or nulle.g. 0 3 * * *
commandstring, or null
suspendedbooleanScheduled runs are paused.