Start here
Publish a result
/v1/community/publicationson https://api.auray.ai/v1Publish one of your results to the Community.
Publish one of your results to the Community. Its file is copied into the Community's kept folder — kept until you unpublish it, where the job it came from keeps its three days — and an image is drawn again as a feed thumbnail; a video's or a 3D model's poster, which you draw (a frame, a view), is redrawn beside it; a WAV's waveform is read off the file. The title, the description and a shown prompt pass an automatic check: words it refuses answer 422 text_refused and nothing is published. The work is then on your profile and at its own link at once, and in the public feeds once our team approves it (mine.approval). Publishing grants the display and remix licences the Terms state, for this one work: send licence: true, and the Terms version you accepted that states them. The job must be yours, succeeded, within its three days, not held by a report or taken down, and paid for. Takes a key holding community:write — Account offers it unticked — or the desktop's own session key. Spends nothing. While our team has paused publishing it answers 503 publishing_paused before the body is read, with our sentence for the pause when we wrote one, and nothing is published.
#Authentication
Authorization: Bearer auray_sk_… — community:write — Account offers it unticked; the desktop's session key holds it.
#Request
#Body
application/json, required.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
job_id | string | yes | — | The job, as a submit answered it and GET /v1/jobs/{id} reads it. |
licence | boolean | yes | — | You grant the display licence and the remix licence the Terms state, for this work. One of true. |
terms_version | string | no | — | The Terms version you accepted that states the licences. Defaults to the current one. |
asset | integer or string | no | — | Which file of the job: a position (0 unless said), or for a 3D job an artefact's name — textured first by default. |
title | string | no | — | 0 to 100 characters. May be null. |
description | string | no | — | 0 to 2000 characters. May be null. |
show_prompt | boolean | no | false | Show the prompt and the settings with the work. Never a file you uploaded to make it. |
discoverable | boolean | no | true | Let it into the public feeds and search once approved. It is on your profile and at its link either way. |
remix_of | string | no | — | The work you made it from, while that is shown. May be null. |
remix_kind | string | no | — | How, with remix_of. One of "recreate", "animate", "upscale", "edit". |
poster | object | no | — | A frame of a video, a view of a 3D model or a cover for a song, drawn by you: PNG, JPEG or WebP as base64, at most 2,000,000 bytes decoded. Redrawn at most 2048 pixels on its longest side, with a feed thumbnail. |
poster.content_type | string | no | — | One of "image/png", "image/jpeg", "image/webp". |
poster.data_base64 | string | no | — | |
waveform | number[] | no | — | A song's peaks, when its file is not a WAV the API reads them off. |
#Example request
curl -X POST https://api.auray.ai/v1/community/publications \
-H "Authorization: Bearer $AURAY_API_KEY" \
-H "content-type: application/json" \
-d '{
"job_id": "photo_docs-mtpb1vnh",
"licence": true,
"title": "A lighthouse in the fog",
"show_prompt": true
}'import { createClient } from "@auray/client";
const auray = createClient(); // reads AURAY_API_KEY
const answer = await auray.platform.community.publications.publish({ jobId: "photo_docs-mtpb1vnh", licence: true, title: "A lighthouse in the fog", showPrompt: true });
console.dir(answer, { depth: null });from auray_client import Client
auray = Client() # reads AURAY_API_KEY
answer = auray.platform.community.publications.publish(job_id="photo_docs-mtpb1vnh", licence=True, title="A lighthouse in the fog", show_prompt=True)
print(answer)const res = await fetch("https://api.auray.ai/v1/community/publications", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AURAY_API_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
"job_id": "photo_docs-mtpb1vnh",
"licence": true,
"title": "A lighthouse in the fog",
"show_prompt": true
}),
});
console.log(await res.json());import os, requests
r = requests.post(
"https://api.auray.ai/v1/community/publications",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
json={
"job_id": "photo_docs-mtpb1vnh",
"licence": True,
"title": "A lighthouse in the fog",
"show_prompt": True
},
)
r.raise_for_status()
print(r.json())package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"job_id": "photo_docs-mtpb1vnh",
"licence": true,
"title": "A lighthouse in the fog",
"show_prompt": true
}`)
req, err := http.NewRequest("POST", "https://api.auray.ai/v1/community/publications", bytes.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AURAY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
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/community/publications");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AURAY_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"job_id" => "photo_docs-mtpb1vnh",
"licence" => true,
"title" => "A lighthouse in the fog",
"show_prompt" => true,
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;require "net/http"
require "json"
uri = URI("https://api.auray.ai/v1/community/publications")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
req["Content-Type"] = "application/json"
req.body = {
"job_id" => "photo_docs-mtpb1vnh",
"licence" => true,
"title" => "A lighthouse in the fog",
"show_prompt" => true
}.to_json
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 {
String body = """
{
"job_id": "photo_docs-mtpb1vnh",
"licence": true,
"title": "A lighthouse in the fog",
"show_prompt": true
}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.auray.ai/v1/community/publications"))
.header("Authorization", "Bearer " + System.getenv("AURAY_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AURAY_API_KEY"));
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.auray.ai/v1/community/publications");
var body = """
{
"job_id": "photo_docs-mtpb1vnh",
"licence": true,
"title": "A lighthouse in the fog",
"show_prompt": true
}
""";
request.Content = new StringContent(body, Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");#Responses
#201 Created
Published: the work as its page draws it, mine included.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
object | string | yes | — | One of "publication". |
id | string | yes | — | The work's public id. |
kind | string | yes | — | One of "image", "video", "audio", "model3d", "project". |
title | string | yes | — | May be null. |
model | object | yes | — | |
model.address | string | yes | — | The model address it was made with, as GET /v1/models lists it: the path a job is submitted to, such as auray-ai/krea-2-turbo/text-to-image. May be null. |
model.id | string | yes | — | The same model's id, as GET /v1/models lists it: the catalogue slug, such as krea2. May be null. |
model.label | string | yes | — | The model's name, as a person reads it. May be null. |
attribution | string | yes | — | The licence text the model's output travels with. Show it wherever the work is shown. May be null. |
ai_generated | boolean | yes | — | Every work here is a generation's result. Label it so wherever it is shown. One of true. |
media | object[] | yes | — | |
media[].role | string | yes | — | primary is the work as it was made; the rest are what the feeds draw: an image's thumbnail, a video's or a model's poster and thumbnail, a song's waveform (JSON: {version, peaks}). One of "primary", "poster", "preview", "thumbnail", "waveform". |
media[].position | integer | yes | — | |
media[].url | string | yes | — | Where to load it. Kept until its author unpublishes the work. A URL. |
media[].content_type | string | yes | — | |
media[].width | integer | yes | — | May be null. |
media[].height | integer | yes | — | May be null. |
media[].duration_ms | integer | yes | — | May be null. |
media[].supplied | boolean | yes | — | True for a poster, or its thumbnail, that the work's author supplied rather than one our services made: it is not what the model made, and the work's ai_generated does not describe it. |
author | object or null | yes | — | |
counts | object | yes | — | |
counts.likes | integer | yes | — | |
counts.views | integer | yes | — | Counted once a day per visitor. |
counts.comments | integer | yes | — | |
counts.remixes | integer | yes | — | |
made_at | string | yes | — | When the result was made. May be null. |
published_at | string | yes | — | May be null. |
featured | boolean | yes | — | Featured by our team. |
pinned | boolean | yes | — | Pinned by our team to the top of the public feeds. |
original | boolean | yes | — | An Original: made by our own team. |
remixed | boolean | yes | — | Made from another work. |
liked | boolean | yes | — | The reader's own like; null when no key that holds community:write was sent. May be null. |
url | string | yes | — | The work's page. A URL. |
description | string | yes | — | May be null. |
show_prompt | boolean | yes | — | |
prompt | string | yes | — | Only while its author shows it. A hidden prompt is not stored anywhere. May be null. |
params | object | yes | — | The settings it was made with, only while shown — never a file that was uploaded to make it. May be null. |
remix_kind | string | yes | — | One of "recreate", "animate", "upscale", "edit", null. May be null. |
remix_of | object | yes | — | The work it was made from, while that is shown. May be null. |
remix_of.id | string | no | — | |
remix_of.kind | string | no | — | One of "image", "video", "audio", "model3d", "project". |
remix_of.title | string | no | — | May be null. |
remix_of.author | object or null | no | — | |
remix_of.url | string | no | — | A URL. |
mine | object | no | — | Where an author's own work stands and why. Only ever answered to its author. |
mine.state | string | yes | — | published is shown on the profile and at its link; hidden while a severe report is reviewed; withdrawn unpublished while a report held it; removed taken down by our team; staging while its files are copied. One of "staging", "published", "hidden", "withdrawn", "removed". |
mine.state_reason | string | yes | — | Why our team hid or removed it. May be null. |
mine.approval | string | yes | — | Whether it is in the public feeds and search. Approval gates the feeds only — never the profile or the link. One of "pending", "approved", "rejected". |
mine.approval_reason | string | yes | — | Why our team declined it for the feeds. May be null. |
mine.discoverable | boolean | yes | — | The author lets it into the public feeds once approved. |
mine.profile_pinned | boolean | yes | — | |
mine.held | boolean | yes | — | An open report holds it: it is kept until the report is decided. |
mine.licence_version | string | no | — | The Terms version whose display and remix licences were granted. |
mine.created_at | string | yes | — | |
request_id | string | no | — | Mirrored in the X-Request-Id header. |
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
#413 Payload Too Large
#422 Unprocessable Content
#428 Precondition Required
#429 Too Many Requests
#502 Bad Gateway
#503 Service Unavailable
#Status codes
| Status | Meaning |
|---|---|
201 | Published: the work as its page draws it, mine included. |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
409 | Conflict |
410 | Gone |
413 | Payload Too Large |
422 | Unprocessable Content |
428 | Precondition Required |
429 | Too Many Requests |
502 | Bad Gateway |
503 | Service Unavailable |
Every refusal names its code, and every code is explained at Errors.