batchDeleteJobs()
Signature
client.batchDeleteJobs(payload: JobBatchDeletePayload): Promise<JobBatchDeleteResponse>Parameters#
| Param | Type | Description |
|---|---|---|
ids | string[] | Array of job IDs to delete (max 100) |
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
})
const result = await client.batchDeleteJobs({
ids: [
'9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c',
'a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p'
]
})
console.log(`Deleted ${result.deleted} jobs, failed ${result.failed}`)
// The endpoint is: DELETE /api/v1/jobs/batchResponse#
JobBatchDeleteResponse
{
"jobs": [
{ "id": "9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c", "msg": "Job deleted" },
{ "id": "a1b2c3d4-5e6f-7g8h-9i0j-1k2l3m4n5o6p", "msg": "Job deleted" }
],
"total": 2,
"deleted": 2,
"failed": 0
}This operation is irreversible. Deleting jobs will also delete all associated job runs. Maximum 100 IDs per request. Jobs that don't exist will be skipped and included in the 'failed' count.
Required scope#
Requires: jobs:delete (or jobs:write, admin, *)
Common errors#
| Status | error | Cause |
|---|---|---|
400 | validation_error | ids is required and must be an array |
400 | validation_error | Maximum 100 IDs per request |
401 | invalid_api_key | Missing or revoked API key |
403 | insufficient_scope | Key lacks jobs:delete scope |