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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
teamId | path | string | yes |
Request body
application/json · Required
| Name | Type | Required | Description |
|---|---|---|---|
url | string<uri> | yes | URL http(s) pública da imagem |
folder_id | string<uuid> | no | Pasta de destino (opcional) |
filename | string | no | 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
| Name | Type | Required | Description |
|---|---|---|---|
id | string<uuid> | yes | |
team_id | string<uuid> | null | no | NULL em drive pessoal. |
folder_id | string<uuid> | null | no | |
uploaded_by | string<uuid> | no | |
name | string | yes | |
content_type | string | yes | |
size_bytes | integer | yes | |
storage_key | string | yes | Chave opaca no storage provider (S3/R2/B2/Bunny/local). |
status | string | yes | enum: |
created_at | string<date-time> | yes | |
completed_at | string<date-time> | null | no | |
context_type | string | null | no | enum: |
context_id | string<uuid> | null | no | |
context_label | string | null | no | |
thumb_key | string | null | no | |
thumb_width | integer | null | no | |
thumb_height | integer | null | no |
400
URL ausente/inválida, recusada pelo filtro SSRF, ou folder_id inválido
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes | Chave/slug do erro |
message | string | no |
401
Sem cookie/bearer válido
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes | Chave/slug do erro |
message | string | no |
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.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
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())