POST /teams/{teamId}/files/init-upload
Reservar row + emitir upload URL
- Acesso: Login
- Serviço:
https://files-api.axuz.net
Autenticação aceita
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).
A descrição desta operação vem do comentário do handler no código (em português).
Parâmetros
| Nome | Em | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
teamId | path | string | sim | |
proxy | query | string | não |
Corpo da requisição
application/json · Obrigatório
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
folder_id | string<uuid> | não | |
name | string | sim | |
content_type | string | sim | MIME normalizado; validado contra allowlist. |
size_bytes | integer | sim | |
content_hash | string | não | SHA256 hex opcional (dedup); ignorado com contexto. |
context_type | string | não | Contexto privado. enum: |
context_id | string<uuid> | não | Id da tarefa ou do board (exige |
{
"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"
}Respostas
201
Criado
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
file | FilesFile | sim | |
file.id | string<uuid> | sim | |
file.team_id | string<uuid> | null | não | NULL em drive pessoal. |
file.folder_id | string<uuid> | null | não | |
file.uploaded_by | string<uuid> | não | |
file.name | string | sim | |
file.content_type | string | sim | |
file.size_bytes | integer | sim | |
file.storage_key | string | sim | Chave opaca no storage provider (S3/R2/B2/Bunny/local). |
file.status | string | sim | enum: |
file.created_at | string<date-time> | sim | |
file.completed_at | string<date-time> | null | não | |
file.context_type | string | null | não | enum: |
file.context_id | string<uuid> | null | não | |
file.context_label | string | null | não | |
file.thumb_key | string | null | não | |
file.thumb_width | integer | null | não | |
file.thumb_height | integer | null | não | |
upload_url | string | sim | URL presigned PUT (S3/R2/B2) OU path relativo |
presigned_url | string | não | Alias legado; presente apenas na variante |
400
Payload/params inválidos
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | Chave/slug do erro |
message | string | não |
401
Sem credencial valida
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
409
Team storage quota exceeded
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim | Chave/slug do erro |
message | string | não |
413
File exceeds max size
429
Limite de requisições excedido.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
Exemplos
O "Try it" está desligado nesta referência. Use os exemplos com a sua credencial de teste.
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())