Axuz Developers

POST /me/avatar/upload-init

Inicia o fluxo de upload gerando a upload URL adequada ao backend (presigned PUT em S3/R2 ou rota local-proxy /me/avatar/upload-binary).

  • Access: Signed in
  • Service: https://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`.

Entradas: userID do JWT; body {filename, content_type, size}. Aceita apenas image/jpeg|png|webp; tamanho em (0, maxAvatarBytes = 2 MiB].

Retorno: 201 com {upload_url, key, public_url, uses_local_proxy}; 400 content_type não permitido ou size ≤ 0; 401 sem auth; 413 size > 2 MiB; 500 falha ao gerar presign.

Parameters

No parameters.

Request body

Corpo JSON. O schema detalhado deste endpoint ainda não está tipado na spec; veja a descrição da operação.

application/json

NameTypeRequiredDescription
(corpo)objectno
{}

Responses

200

TBD

400

Content_type não permitido ou size ≤ 0

NameTypeRequiredDescription
errorstringyes

401

Sem credencial valida

NameTypeRequiredDescription
errorstringyes

413

Size > 2 MiB

NameTypeRequiredDescription
errorstringyes

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

Falha ao gerar presign

NameTypeRequiredDescription
errorstringyes

Examples

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

curl

curl -sS -X POST 'https://api.axuz.net/me/avatar/upload-init' \
  -H "Authorization: Bearer $AXUZ_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Node.js

const res = await fetch("https://api.axuz.net/me/avatar/upload-init", {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
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.axuz.net/me/avatar/upload-init",
    headers={
        "Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
    },
    json={},
    timeout=30,
)
res.raise_for_status()
print(res.json())