Axuz Developers

POST /public/shared/{token}/document

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

  • Acesso: Pública (link ou assinatura)
  • Serviço: https://api-flow.axuz.net

Autenticação aceita

Sem autenticação (rota pública ou protegida por link/assinatura).

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

Parâmetros

NomeEmTipoObrigatórioDescrição
tokenpathstringsim

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

Corpo da requisição

application/json · Obrigatório

NomeTipoObrigatórioDescrição
documentFlowDocumentsim

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>sim
document.nodes[].idstringsim
document.nodes[].typestringsim
document.nodes[].positionFlowXYsim
document.nodes[].position.xnumbersim
document.nodes[].position.ynumbersim
document.nodes[].widthinteger | nullnão
document.nodes[].heightinteger | nullnão
document.nodes[].parentNodestringnão
document.nodes[].extentstringnão
document.nodes[].dataobjectsim
document.nodes[].styleobjectnão
document.edgesarray<FlowEdge>sim
document.edges[].idstringsim
document.edges[].sourcestringsim
document.edges[].targetstringsim
document.edges[].typestringnão
document.edges[].dataobjectnão
base_versionintegernão

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

client_idstringnão

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"
}

Respostas

200

Documento persistido, versão bumpada.

NomeTipoObrigatórioDescrição
versionintegersim
last_updated_atstring<date-time>sim

400

Payload inválido.

NomeTipoObrigatórioDescrição
errorstringsim

403

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

NomeTipoObrigatórioDescrição
errorstringsim

404

Recurso não encontrado ou fora de escopo.

NomeTipoObrigatórioDescrição
errorstringsim

410

Share expirou.

NomeTipoObrigatórioDescrição
errorstringsim

413

Body maior que FLOW_DOC_MAX_BYTES (default 5 MiB).

NomeTipoObrigatórioDescrição
errorstringsim

429

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

NomeTipoObrigatórioDescrição
errorstringsim

500

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

NomeTipoObrigatórioDescrição
errorstringsim

503

Kill-switch FLOW_COLLAB_ENABLED=false.

NomeTipoObrigatórioDescrição
errorstringsim

Exemplos

O "Try it" está desligado nesta referência. Use os exemplos com a sua credencial de teste.

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())