Skip to content
  • There are no suggestions because the search field is empty.

Converting files through the API

Convert between PNG, JPG, SVG, PDF and Lottie, and render Lottie animations as GIF or video.

Upload a file to POST /v3/convert/{operation} to convert it. Conversions need your Client ID and Client Secret, use API credits, and must be turned on for your app.

What you can convert

Operation

From

To

Result

png-to-jpg

PNG

JPG

Instant

jpg-to-png

JPG

PNG

Instant

svg-to-png

SVG

PNG

Instant

svg-to-jpg

SVG

JPG

Instant

svg-to-pdf

SVG

PDF

Instant

svg-to-lottie

SVG

Lottie JSON

Instant

lottie-optimize

Lottie JSON

Smaller Lottie JSON

Instant

lottie-to-dotlottie

Lottie JSON

dotLottie

Instant

lottie-to-gif

Lottie JSON

GIF

Job to poll

lottie-to-webp

Lottie JSON

WebP

Job to poll

lottie-to-mp4

Lottie JSON

MP4

Job to poll

lottie-to-webm

Lottie JSON

WebM

Job to poll

Lottie to SVG is only available in the iconscout.com editor, not through the API.

Instant conversions

The converted file comes back directly in the response. Save the response straight to a file.

curl -X POST "https://api.iconscout.com/v3/convert/svg-to-png" \   -H "Client-ID: $ICONSCOUT_CLIENT_ID" \   -H "Client-Secret: $ICONSCOUT_CLIENT_SECRET" \   -F "file=@logo.svg" \   -o logo.png

Lottie to GIF, WebP, MP4 or WebM

These renders can take tens of seconds, so they run as a job.

  1. Send the Lottie JSON file. Optionally add width and height (up to 4096 px) and transparent.
  2. You get a 202 response with a job ID and a Retry-After interval.
  3. Poll GET /v3/convert/jobs/{job} every Retry-After seconds. The status goes queued → processing → completed or failed. A 1080×1080 MP4 usually takes well under a minute.
  4. When it's completed, download the file from download_url or GET /v3/convert/jobs/{job}/download. Downloading again doesn't use more credits.
  5. Save it before expires_at. After that, the file is deleted and you need to render it again.

Need a transparent video? Use lottie-to-webm. MP4 has no transparency.

SVG to Lottie options

Field

Details

preset

Required. fade-in, fade-in-up, fade-in-down, scale-up, scale-down, slide-in-left, slide-in-right, draw or pop

duration

Animation length in seconds, up to 60

delay_start, delay_end

Pause before and after the animation, in seconds, up to 60

sequential

Animate the SVG's parts one after another instead of all together

File rules

  • The file must match the operation's input format, by extension, file type and content.
  • SVGs with a <!DOCTYPE> or <!ENTITY> declaration are refused.
  • The upload size limit depends on your plan. GET /v3/convert/operations shows it, along with each operation's credit cost and available_on_your_plan.

Credits

  • Each conversion uses credits from your API credit balance. Check current costs with GET /v3/convert/operations.
  • Failed conversions aren't charged.

You can send an Idempotency-Key header so a retried request doesn't run twice. For instant conversions, if the conversion worked but you lost the response, it can't be fetched again. A new request is charged again. If that matters, use a job-based conversion, since you can always poll the original job.

Common errors

Error

Reason

What to do

400

invalid_input_file

The file doesn't match the operation, or it's an SVG with DOCTYPE or ENTITY

403

entitlement_required

Your plan doesn't include this conversion, or File Converter is off for your app

404

unknown_operation / job_not_found

Check the operation name or job ID

409

job_not_completed

The job isn't done yet. Keep polling.

410

result_expired

The file was deleted after expires_at. Convert again.

413

File too large

Check max_upload_kb for your plan

429

rate_limit_exceeded / quota_exhausted

Too many requests, or no credits left (Article 9)

500–504

Conversion failed or timed out

You aren't charged. Retry once.

For more details, see IconScout API docs.