Axuz Developers

POST /public/shared/{token}/document

Full-doc replace via share (access=interact).

  • Access: Public (link or signature)
  • Service: https://api-flow.axuz.net

Accepted authentication

No authentication (public route, or protected by link/signature).

Fase Live Collab A — fallback / escape hatch. Caminho preferencial: POST /public/shared/{token}/ops (Fase C).

Parameters

NameInTypeRequiredDescription
tokenpathstringyes

16 bytes hex (2^128 espaço).

Request body

application/json · Required

NameTypeRequiredDescription
documentFlowDocumentyes

Shape enxuta espelhando lib/types.ts:FlowDocument no client. Backend não valida a shape interna (opaco pro storage); os campos abaixo são o mínimo comum consumido pelo editor.

document.nodesarray<FlowNode>yes
document.nodes[].idstringyes
document.nodes[].typestringyes
document.nodes[].positionFlowXYyes
document.nodes[].position.xnumberyes
document.nodes[].position.ynumberyes
document.nodes[].widthinteger | nullno
document.nodes[].heightinteger | nullno
document.nodes[].parentNodestringno
document.nodes[].extentstringno
document.nodes[].dataobjectyes
document.nodes[].styleobjectno
document.edgesarray<FlowEdge>yes
document.edges[].idstringyes
document.edges[].sourcestringyes
document.edges[].targetstringyes
document.edges[].typestringno
document.edges[].dataobjectno
base_versionintegerno

Hint para futura detecção de conflito (Fase B+). Fase A aceita qualquer valor.

client_idstringno

UUID do tab/sessão — usado para dedup de echo no peer SSE.

{
  "document": {
    "nodes": [
      {
        "id": "string",
        "type": "string",
        "position": {},
        "width": 1,
        "height": 1,
        "parentNode": "string",
        "extent": "string",
        "data": {},
        "style": {}
      }
    ],
    "edges": [
      {
        "id": "string",
        "source": "string",
        "target": "string",
        "type": "string",
        "data": {}
      }
    ]
  },
  "base_version": 1,
  "client_id": "string"
}

Responses

200

Documento persistido, versão bumpada.

NameTypeRequiredDescription
versionintegeryes
last_updated_atstring<date-time>yes

400

Payload inválido.

NameTypeRequiredDescription
errorstringyes

403

Share access=view — leitor não pode escrever.

NameTypeRequiredDescription
errorstringyes

404

Recurso não encontrado ou fora de escopo.

NameTypeRequiredDescription
errorstringyes

410

Share expirou.

NameTypeRequiredDescription
errorstringyes

413

Body maior que FLOW_DOC_MAX_BYTES (default 5 MiB).

NameTypeRequiredDescription
errorstringyes

429

Rate limit estourado (per-token ou per-team).

NameTypeRequiredDescription
errorstringyes

500

Erro interno. Tente de novo com backoff; reporte o X-Request-Id.

NameTypeRequiredDescription
errorstringyes

503

Kill-switch FLOW_COLLAB_ENABLED=false.

NameTypeRequiredDescription
errorstringyes

Examples

"Try it" is turned off in this reference. Use the examples with your test credential.

curl

curl -sS -X POST 'https://api-flow.axuz.net/public/shared/TOKEN/document' \
  -H "Content-Type: application/json" \
  -d '{"document":{"nodes":[{"id":"string","type":"string","position":{},"width":1,"height":1,"parentNode":"string","extent":"string","data":{},"style":{}}],"edges":[{"id":"string","source":"string","target":"string","type":"string","data":{}}]},"base_version":1,"client_id":"string"}'

Node.js

const res = await fetch("https://api-flow.axuz.net/public/shared/TOKEN/document", {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "document": {
      "nodes": [
        {
          "id": "string",
          "type": "string",
          "position": {},
          "width": 1,
          "height": 1,
          "parentNode": "string",
          "extent": "string",
          "data": {},
          "style": {}
        }
      ],
      "edges": [
        {
          "id": "string",
          "source": "string",
          "target": "string",
          "type": "string",
          "data": {}
        }
      ]
    },
    "base_version": 1,
    "client_id": "string"
  }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());

Python

import os
import requests

res = requests.request(
    "POST",
    "https://api-flow.axuz.net/public/shared/TOKEN/document",
    json={
        "document": {
            "nodes": [
                {
                    "id": "string",
                    "type": "string",
                    "position": {},
                    "width": 1,
                    "height": 1,
                    "parentNode": "string",
                    "extent": "string",
                    "data": {},
                    "style": {},
                },
            ],
            "edges": [
                {
                    "id": "string",
                    "source": "string",
                    "target": "string",
                    "type": "string",
                    "data": {},
                },
            ],
        },
        "base_version": 1,
        "client_id": "string",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())