Axuz Developers

POST /teams/{teamId}/files/init-upload

Reservar row + emitir upload URL

  • Access: Signed in
  • Service: https://files-api.axuz.net

Accepted authentication

  • sessionCookie — Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.
  • bearerSession — JWT de acesso da sessão em `Authorization: Bearer`.

Valida size + content_type + quota; reserva files_files pending. Devolve upload_url — presigned PUT (S3/R2) OU path proxy /teams/{teamId}/files/upload/{fileId} (Local/Bunny). ?proxy=1 força path relativo mesmo com backend remoto (útil pra clients fora do CORS allowlist do bucket).

This operation's description comes from the handler comment in the code (in Portuguese).

Parameters

NameInTypeRequiredDescription
teamIdpathstringyes
proxyquerystringno

Request body

application/json · Required

NameTypeRequiredDescription
folder_idstring<uuid>no
namestringyes
content_typestringyes

MIME normalizado; validado contra allowlist.

size_bytesintegeryes
content_hashstringno

SHA256 hex opcional (dedup); ignorado com contexto.

context_typestringno

Contexto privado. task_deliverable + context_id (id da tarefa) criam um arquivo de ENTREGA (também usado pela capa de tarefa): fora da listagem/busca do Drive, legível só por quem lê a tarefa, teto de 100 MB (413 acima), sem dedup. board_image + context_id (id do board) cria a capa/foto do board: só imagem (jpeg/png/webp/gif/avif, 400 fora disso), teto de 10 MB, legível só por quem alcança o board (canal vinculado, scope tasks); 404 sem acesso ao board. Arquivo privado sem referência viva vai para a lixeira pelo GC.

enum: "task_deliverable", "board_image"

context_idstring<uuid>no

Id da tarefa ou do board (exige context_type).

{
  "folder_id": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "content_type": "string",
  "size_bytes": 1,
  "content_hash": "string",
  "context_type": "task_deliverable",
  "context_id": "00000000-0000-0000-0000-000000000000"
}

Responses

201

Criado

NameTypeRequiredDescription
fileFilesFileyes
file.idstring<uuid>yes
file.team_idstring<uuid> | nullno

NULL em drive pessoal.

file.folder_idstring<uuid> | nullno
file.uploaded_bystring<uuid>no
file.namestringyes
file.content_typestringyes
file.size_bytesintegeryes
file.storage_keystringyes

Chave opaca no storage provider (S3/R2/B2/Bunny/local).

file.statusstringyes

enum: "pending", "uploaded", "scanning", "ready", "infected"

file.created_atstring<date-time>yes
file.completed_atstring<date-time> | nullno
file.context_typestring | nullno

enum: "bill", "receivable", "payment", "receipt", "task", "timeline_post", "wiki", "drive", null

file.context_idstring<uuid> | nullno
file.context_labelstring | nullno
file.thumb_keystring | nullno
file.thumb_widthinteger | nullno
file.thumb_heightinteger | nullno
upload_urlstringyes

URL presigned PUT (S3/R2/B2) OU path relativo /teams/.../upload/{fileId} (Local/Bunny).

presigned_urlstringno

Alias legado; presente apenas na variante /me/files/init-upload.

400

Payload/params inválidos

NameTypeRequiredDescription
errorstringyes

Chave/slug do erro

messagestringno

401

Sem credencial valida

NameTypeRequiredDescription
errorstringyes

409

Team storage quota exceeded

NameTypeRequiredDescription
errorstringyes

Chave/slug do erro

messagestringno

413

File exceeds max size

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

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

NameTypeRequiredDescription
errorstringyes

Examples

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

curl

curl -sS -X POST 'https://files-api.axuz.net/teams/TEAM_ID/files/init-upload' \
  -H "Authorization: Bearer $AXUZ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"folder_id":"00000000-0000-0000-0000-000000000000","name":"string","content_type":"string","size_bytes":1,"content_hash":"string","context_type":"task_deliverable","context_id":"00000000-0000-0000-0000-000000000000"}'

Node.js

const res = await fetch("https://files-api.axuz.net/teams/TEAM_ID/files/init-upload", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "folder_id": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "content_type": "string",
    "size_bytes": 1,
    "content_hash": "string",
    "context_type": "task_deliverable",
    "context_id": "00000000-0000-0000-0000-000000000000"
  }),
});
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://files-api.axuz.net/teams/TEAM_ID/files/init-upload",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    json={
        "folder_id": "00000000-0000-0000-0000-000000000000",
        "name": "string",
        "content_type": "string",
        "size_bytes": 1,
        "content_hash": "string",
        "context_type": "task_deliverable",
        "context_id": "00000000-0000-0000-0000-000000000000",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())