API: quick start
Automate image and PDF processing with the REST API.
Access and keys
Sign in to Levomio and create a key in settings. Copy it and replace YOUR_API_KEY in your chosen client’s settings. Keep the key private.
Manage keys · APIAPI: quick start
This example converts photo.png to WebP for 1 credit. Set LEVOMIO_API_KEY to your key, then run the commands in the same terminal. You need Bash, curl and uuidgen.
1. Create a task
export LEVOMIO_API_KEY='YOUR_API_KEY'
export LEVOMIO_ORIGIN='https://levomio.com'
TASK_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
INPUT_ID=$(uuidgen | tr '[:upper:]' '[:lower:]')
OPTIONS='{"formats":["webp"],"zip":{"enabled":true}}'
curl --fail-with-body "$LEVOMIO_ORIGIN/api/v1/tasks" \
-H "Authorization: Bearer $LEVOMIO_API_KEY" \
-H 'Content-Type: application/json' \
--data "{\"taskId\":\"$TASK_ID\",\"type\":\"convert\",\"options\":$OPTIONS}"2. Upload the image
curl --fail-with-body "$LEVOMIO_ORIGIN/api/v1/tasks/$TASK_ID/inputs" \
-H "Authorization: Bearer $LEVOMIO_API_KEY" \
-F "taskFileInputId=$INPUT_ID" -F 'position=0' -F '[email protected]'3. Start — up to 1 credit
curl --fail-with-body "$LEVOMIO_ORIGIN/api/v1/tasks/$TASK_ID/start" \
-H "Authorization: Bearer $LEVOMIO_API_KEY" \
-H 'Content-Type: application/json' \
--data "{\"inputIds\":[\"$INPUT_ID\"],\"options\":$OPTIONS,\"maxCredits\":1}"4. Get the result
curl --fail-with-body "$LEVOMIO_ORIGIN/api/v1/tasks/$TASK_ID" \
-H "Authorization: Bearer $LEVOMIO_API_KEY"Repeat the last request every 1–2 seconds until status is completed. Set DOWNLOAD_PATH to the ready file’s outputs[].downloadUrl, then download it with this command.
curl --fail-with-body "$LEVOMIO_ORIGIN$DOWNLOAD_PATH" \
-H "Authorization: Bearer $LEVOMIO_API_KEY" --output result.webpCredit prices
| Operation | Cost |
|---|---|
| Image compression or conversion | 1 credit per image and output format |
| Images to PDF | 1 credit per source image, merged or separate |
| PDF compression | 1 credit per source PDF page, counted by the server |
10 images into WebP and AVIF cost 20 credits. 10 images into one PDF cost 10. Compressing a 30-page PDF costs 30.
Uploads, quotes, balance checks, status checks, previews, downloads and ZIP archives are free. No subscription is required; prices and limits are the same for every account.
Credits are charged when processing starts. maxCredits is your spending limit. For batches, get the total with quote before start. Retry the same task with the same IDs and parameters to avoid paying for a new task.
50,000,000 bytes per file, 250 sources per task. Drafts and results are retained for 2 hours; check expiresAt and download in time. Website quotas do not apply to API/MCP.