Start here
Merge changes into a canvas's shared document
/v1/studio/projects/{project}/canvases/{canvas}/stateon https://api.auray.ai/v1Merge a window's changes — a Yjs update, base64 — into a canvas's shared document.
Merge a window's changes — a Yjs update, base64 — into a canvas's shared document. The merged document is read strictly before it is kept (canvas_invalid), and its state is kept up to 2 MB (crdt_too_large). seed is the first state of a canvas never shared, taken only while it has none; the second of two windows seeding at once is refused revision_conflict and loads the first's. Answers the revision it is now at and its state vector, never the whole state. Needs the edit_canvas capability. Takes a key holding studio:write — Account offers it unticked — or the desktop's own session key. Spends nothing.
#Authentication
Authorization: Bearer auray_sk_… — studio:write — Account offers it unticked; the desktop's session key holds it.
#Request
#Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
project | string | yes | |
canvas | string | yes |
#Body
application/json, required.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
update | string | yes | — | A Yjs update of the canvas's document, base64. The bytes, base64. |
seed | boolean | no | false | The canvas's first state, sent once by the window that first shares it. |
#Example request
curl -X POST https://api.auray.ai/v1/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state \
-H "Authorization: Bearer $AURAY_API_KEY" \
-H "content-type: application/json" \
-d '{
"update": "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed": true
}'const res = await fetch("https://api.auray.ai/v1/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AURAY_API_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
"update": "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed": true
}),
});
console.log(await res.json());import os, requests
r = requests.post(
"https://api.auray.ai/v1/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
json={
"update": "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed": True
},
)
r.raise_for_status()
print(r.json())package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"update": "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed": true
}`)
req, err := http.NewRequest("POST", "https://api.auray.ai/v1/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state", 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/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state");
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([
"update" => "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed" => 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/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
req["Content-Type"] = "application/json"
req.body = {
"update" => "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed" => 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 = """
{
"update": "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed": true
}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.auray.ai/v1/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state"))
.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/studio/projects/3f0c8a52-6a1d-4e8b-9c2d-7e5f4a3b2c1d/canvases/…/state");
var body = """
{
"update": "AQjXlI3iAQAoAQZjYW52YXMBdgF9AScBBmNhbnZhcwVwYWdlcwEnANeUjeIBAQZwYWdlLTEBKADXlI3iAQIEbmFtZQF3BlBhZ2UgMSgA15SN4gECBW9yZGVyAX0AKADXlI3iAQIIdmlld3BvcnQBdgMBeH0AAXl9AAR6b29tfQEnANeUjeIBAgVub2RlcwEnANeUjeIBAgVlZGdlcwEA",
"seed": 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
#200 OK
OK.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
object | string | yes | — | One of "crdt_ack". |
doc | string | yes | — | brief, or canvas: and the canvas's id. |
rev | integer | yes | — | 0 to …. |
state_vector | string | yes | — | The bytes, base64. |
bytes | integer | yes | — | 0 to 2097152. |
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
#413 Payload Too Large
#429 Too Many Requests
#500 Internal Server Error
#503 Service Unavailable
#Status codes
| Status | Meaning |
|---|---|
200 | OK. |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
409 | Conflict |
413 | Payload Too Large |
429 | Too Many Requests |
500 | Internal Server Error |
503 | Service Unavailable |
Every refusal names its code, and every code is explained at Errors.