createJob()
Signature
client.createJob(payload: JobCreatePayload): Promise<CreateJobResponse>Payload#
| Field | Type | Required | Description |
|---|---|---|---|
target_url | string | Yes | Absolute HTTPS URL the job will call on schedule |
schedule_cron | string | Yes | 5-field cron expression (e.g. /5 *) or 6-field with year |
name | string | No | Friendly name for the job |
description | string | No | Optional description |
method | string | No | HTTP method. Defaults to POST |
timezone | string | No | IANA timezone. Defaults to UTC |
folder_path | string | No | Virtual folder path for organization (e.g. /reports/, /checkin/monday/). Defaults to / |
headers_json | object | No | Custom headers sent with each execution |
body_json | object | No | JSON body sent with each execution |
timeout_ms | number | No | Request timeout in milliseconds |
retry_policy_json | object | No | Retry config — { max_retries: number, backoff_ms: number } |
Usage#
ts
import { VeloraClient } from '@rimora/velora'
import fetch from 'node-fetch'
const client = new VeloraClient({
apiKey: process.env.VELORA_API_KEY,
fetch: fetch as any
})
// Minimal — runs every 5 minutes
const simple = await client.createJob({
target_url: 'https://yourapp.com/ping',
schedule_cron: '*/5 * * * *'
})
console.log('Created:', simple.id)
// With folder organization
const foldered = await client.createJob({
name: 'Daily report',
target_url: 'https://yourapp.com/cron/daily-report',
schedule_cron: '0 9 * * *',
folder_path: '/reports/daily/'
})
// Full options
const full = await client.createJob({
name: 'Weekly report',
description: 'Sends weekly usage report every Monday at 9am UTC',
target_url: 'https://yourapp.com/cron/weekly-report',
method: 'POST',
schedule_cron: '0 9 * * 1',
timezone: 'UTC',
folder_path: '/reports/weekly/',
headers_json: { 'X-Secret': 'my-shared-secret' },
body_json: { trigger: 'cron', version: 2 },
timeout_ms: 10000,
retry_policy_json: { max_retries: 3, backoff_ms: 5000 }
})
console.log('Created full job:', full.id)Response#
CreateJobResponse
{
"id": "9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c",
"owner_id": "a18eac82-fb19-4637-99b1-96ef5b8de6d4",
"api_key_id": "95a3af0d-3a83-4b13-b819-cbf65d7c47bf",
"status": "active",
"msg": "Job created"
}Required scope#
Requires: jobs:create (or jobs:write, admin, *)
Common errors#
| Status | error | Cause |
|---|---|---|
400 | validation_error | Missing target_url, invalid URL scheme, private/loopback target (SSRF block), missing schedule_cron, invalid cron, or past year |
401 | invalid_api_key | Missing or revoked API key |
403 | insufficient_scope | Key lacks jobs:create scope |
403 | job_limit_exceeded | Plan job limit reached — delete unused jobs or upgrade |
Velora blocks
target_url values that resolve to private/loopback addresses (SSRF protection). Use a publicly reachable URL or a tunnelling service (e.g. ngrok) during local development.