Start here
Stop a job that is still running
/v1/jobs/{id}on https://api.auray.ai/v1Settles what it was worth; does not delete the row.
Settles what it was worth; does not delete the row. Photo refunds in full, music and video bill the fraction made, 3D keeps the completed stages' shares. Cancelling something already finished is 200 with cancelled:false, not an error. A job that is charged but has no provider_job_id yet answers 200 with cancelled:true and settled:false: the stop is recorded on it and carried out as soon as it has one, or once it can no longer get one — refund included, and in full for a job that finished before the stop could reach it, whose output is withheld; poll it to see it settle. 3D can answer 409 cancel_refused when it cannot stop the job. A catalogue model that cannot be stopped once it starts answers 409 cancel_not_offered — it keeps running and keeps being charged — and a product with no cancel at all (chat) answers 400 cancel_unsupported.
#Authentication
Authorization: Bearer auray_sk_… — A scope that may submit the job's model: the kind it makes (image:write, video:write, …) or the older product name (photo:write, auray-ai-video:write, external:write).
#Request
#Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes |
#Example request
curl -X DELETE https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh \
-H "Authorization: Bearer $AURAY_API_KEY"import { createClient } from "@auray/client";
const auray = createClient(); // reads AURAY_API_KEY
console.log(await auray.platform.jobs.cancel("photo_docs-mtpb1vnh"));from auray_client import Client
auray = Client() # reads AURAY_API_KEY
print(auray.platform.jobs.cancel("photo_docs-mtpb1vnh"))const res = await fetch("https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh", {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.AURAY_API_KEY}` },
});
console.log(await res.json());import os, requests
r = requests.delete(
"https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
)
r.raise_for_status()
print(r.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("DELETE", "https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AURAY_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}<?php
$ch = curl_init("https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AURAY_API_KEY"),
],
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;require "net/http"
uri = URI("https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh")
req = Net::HTTP::Delete.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.bodyimport java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh"))
.header("Authorization", "Bearer " + System.getenv("AURAY_API_KEY"))
.DELETE()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AURAY_API_KEY"));
using var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.auray.ai/v1/jobs/photo_docs-mtpb1vnh");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");#Responses
#200 OK
OK
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | no | — | |
status | string | no | — | Five words, whatever the product. Our internals disagree; you never see that. One of "queued", "running", "succeeded", "failed", "cancelled". |
cancelled | boolean | no | — | |
settled | boolean | no | — | |
credits_charged | integer | no | — | What the job cost, after the cancel's refund — the ledger's net. Null, with settled_unknown: true, when the ledger could not be read; the job read answers it once it can. May be null. |
credits_reserved | integer | no | — | What was taken when the job was charged. May be null. |
settled_unknown | boolean | no | — | Present, and true, when the cancel happened and its figures could not be read. |
Headers:
| Header | Description |
|---|---|
RateLimit-Limit | Burst capacity. |
RateLimit-Remaining | |
RateLimit-Reset | Seconds until refill. |
X-RateLimit-Limit | |
X-RateLimit-Remaining | |
X-RateLimit-Reset | Unix seconds. The X- spelling is what client libraries read. |
X-Request-Id |
#400 Bad Request
#401 Unauthorized
#403 Forbidden
#404 Not Found
#409 Conflict
#410 Gone
#429 Too Many Requests
#500 Internal Server Error
settle_failed — the cancel reached the service, but the outcome could not be recorded. Read the job again in a moment. Or job_read_failed, when the job could not be looked up at all: that one is not a statement that the job is gone, and the render is still running and still charged.
The error body: error, message, docs (the entry that explains it) and request_id.
#502 Bad Gateway
#503 Service Unavailable
#Status codes
| Status | Meaning |
|---|---|
200 | OK |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
409 | Conflict |
410 | Gone |
429 | Too Many Requests |
500 | settle_failed — the cancel reached the service, but the outcome could not be recorded. |
502 | Bad Gateway |
503 | Service Unavailable |
Every refusal names its code, and every code is explained at Errors.