IMAGEM

Transformação de imagem

Manda uma imagem (ou aponta uma URL), recebe de volta redimensionada e/ou convertida entre PNG e JPEG. Sem fila, sem callback — a resposta já é o arquivo pronto.

Image transform

Send an image (or point to a URL), get it back resized and/or converted between PNG and JPEG. No queue, no callback — the response already is the finished file.

SYNC resposta na mesma chamada answers in the same call

Endpoint

Endpoint

POST /api/v1/imagem/transform redimensiona e/ou converte uma imagem resizes and/or converts an image

Entrada: PNG, JPEG ou GIF, no corpo da requisição — ou use ?url= pra a própria API buscar a imagem em vez de você enviar os bytes. A resposta de sucesso é a imagem crua (Content-Type: image/png ou image/jpeg), não o envelope JSON. Erros continuam vindo como JSON normalmente.

Input: PNG, JPEG or GIF, in the request body — or use ?url= to have the API fetch the image instead of sending the bytes yourself. The success response is the raw image (Content-Type: image/png or image/jpeg), not the JSON envelope. Errors still come back as JSON as usual.

Parâmetros

Parameters

NomeNameOndeInDescriçãoDescription
url query opcional — se presente, a API baixa a imagem dessa URL em vez de ler o corpo da requisição optional — if present, the API downloads the image from this URL instead of reading the request body
resize query opcional — LARGURAxALTURA em pixels (ex.: 200x200), entre 1 e 4096. Sem isso, mantém o tamanho original optional — WIDTHxHEIGHT in pixels (e.g. 200x200), between 1 and 4096. Without it, keeps the original size
format query opcional, padrão pngpng ou jpeg optional, defaults to pngpng or jpeg
quality query opcional, padrão 90 — só vale com format=jpeg, entre 1 e 100 optional, defaults to 90 — only applies with format=jpeg, between 1 and 100

Exemplo

Example

# redimensiona e converte pra JPEG# resize and convert to JPEG
curl -X POST "https://api.alicercelabs.com.br/api/v1/imagem/transform?resize=200x200&format=jpeg&quality=85" \
  -H "Authorization: Bearer <token>" \
  --data-binary @foto-original.png \
  -o miniatura.jpg

# ou buscando de uma URL# or fetching from a URL
curl -X POST "https://api.alicercelabs.com.br/api/v1/imagem/transform?url=https://exemplo.com/foto.jpg&resize=64x64" \
  -H "Authorization: Bearer <token>" \
  -o avatar.png

Erros possíveis

Possible errors

StatusMotivoReason
400corpo vazio ou não é uma imagem válida, resize/format/quality mal formados, ou url inválidaempty body or not a valid image, malformed resize/format/quality, or invalid url
401token ausente ou inválidomissing or invalid token
429limite de taxa excedidorate limit exceeded
503falha ao baixar a imagem de ?url=failed to download the image from ?url=

Limites

Limits

10.000/dia · 416/hora, por IP chamador. Upload máximo 10MB por padrão (corpo da requisição ou o que é baixado via ?url=). Sem cache — cada transformação é processada do zero.

10,000/day · 416/hour, per calling IP. Max upload 10MB by default (request body or whatever's downloaded via ?url=). No caching — every transform is processed from scratch.