Issue a URL of a job's result file
POST /v1/jobs/{job_id}/result-url
| Property | Value |
|---|---|
| Operation | create_job_result_url |
| Group | Jobs |
| Scope | jobs:read |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited platform.job.result_url (mutation) |
| Released in | 1.52.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Answers a URL of the result file of a succeeded job, valid for 5 minutes (a target); the file is kept 7 days (a target). A job with no result file, or not succeeded, is 409 job_result_not_available. The issuance writes an Audit event, a content read when the file holds content (1.52.0). The api also requires the permission JOB_TYPE_PERMISSIONS names for the job type (webhooks:write for webhook.replay); a job the caller lacks it for is not_found to it and absent from its list.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the jobs:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/jobs/job_.../result-url" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"const response = await fetch(`${process.env.VOCAL_API}/v1/jobs/job_.../result-url`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
},
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/jobs/job_.../result-url",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
job_id | path | JobId | yes | The id of an asynchronous job: job_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | JobResultUrl | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | job_result_not_available, idempotency_in_progress, idempotency_key_reused |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is JobResultUrl.
| Field | Type | Required | Description |
|---|---|---|---|
expires_at | Timestamp | yes | |
object | "job_result_url" | yes | |
url | string (uri) | yes | A URL of the result file, valid for 5 minutes (a target). |