Axuz Developers

POST /teams/{teamId}/files/from-url

Importar imagem de uma URL externa (server-side)

  • 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`.

Baixa a imagem no servidor e materializa uma row files_files normal, pra que o cliente nunca re-busque a URL de origem (hot-link apodrece e vaza IP + contexto do usuário pro host remoto). Usado pelo ImagePicker do axuz_flow_client.

Gates: filtro SSRF na URL e em cada redirect (recusa loopback, rede privada, link-local e metadata de cloud); teto de 50MB e timeout de 30s no download; content-type decidido pelo MIME sniffado dos bytes, nunca pelo header do remoto; depois disso valem os mesmos limites do upload normal (allowlist de tipo, teto por arquivo, quota do team) e o mesmo epílogo (antivírus quando ligado, thumbnail, content_hash, réplica).

Portado do pacote legacy internal/files no Passo 3 do FILES-03 — antes respondia em /api/teams/{teamId}/files/from-url e gravava em r2_files, tabela que a galeria não lê.

Parameters

NameInTypeRequiredDescription
teamIdpathstringyes

Request body

application/json · Required

NameTypeRequiredDescription
urlstring<uri>yes

URL http(s) pública da imagem

folder_idstring<uuid>no

Pasta de destino (opcional)

filenamestringno

Nome desejado (opcional). Sem ele, o basename do path da URL; a extensão vem sempre do MIME sniffado.

{
  "url": "https://example.test/",
  "folder_id": "00000000-0000-0000-0000-000000000000",
  "filename": "string"
}

Responses

200

Importado

NameTypeRequiredDescription
idstring<uuid>yes
team_idstring<uuid> | nullno

NULL em drive pessoal.

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

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

statusstringyes

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

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

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

context_idstring<uuid> | nullno
context_labelstring | nullno
thumb_keystring | nullno
thumb_widthinteger | nullno
thumb_heightinteger | nullno

400

URL ausente/inválida, recusada pelo filtro SSRF, ou folder_id inválido

NameTypeRequiredDescription
errorstringyes

Chave/slug do erro

messagestringno

401

Sem cookie/bearer válido

NameTypeRequiredDescription
errorstringyes

Chave/slug do erro

messagestringno

409

Team storage quota exceeded

413

Imagem acima do teto (50MB ou o limite do team)

415

A URL não devolveu uma imagem, ou o tipo está fora da allowlist

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

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

NameTypeRequiredDescription
errorstringyes

502

Falha ao buscar a URL (erro de rede, redirect bloqueado, ou status não-2xx no remoto)

504

Download excedeu 30s

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/from-url' \
  -H "Authorization: Bearer $AXUZ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.test/","folder_id":"00000000-0000-0000-0000-000000000000","filename":"string"}'

Node.js

const res = await fetch("https://files-api.axuz.net/teams/TEAM_ID/files/from-url", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "url": "https://example.test/",
    "folder_id": "00000000-0000-0000-0000-000000000000",
    "filename": "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://files-api.axuz.net/teams/TEAM_ID/files/from-url",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    json={
        "url": "https://example.test/",
        "folder_id": "00000000-0000-0000-0000-000000000000",
        "filename": "string",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())