Start an optimization
Starts an optimization job of an image and answers at once with its id. Poll GET /optimize/{id} or pass callback_url for a signed webhook.
https://realpng.com/api/v1/optimizeIn: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Exactly one of image_url, image_base64 or image_upload_id. image_url and image_upload_id take images up to 25 MB and 25 megapixels. image_base64 travels inside this request, so it is limited to 4 MB. Use POST /uploads for larger files.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://realpng.com/api/v1/optimize" \ -H "X-API-Key: $REALPNG_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "image_url": "https://images.example.com/portrait.jpg" }'{ "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "status": "queued", "media": "image"}