# Cleanup image div strong 🔨 In Development — This section is still being developed and may change. Remove unwanted objects, fix imperfections, and enhance images with Freddy cleanup tools. #### Authentication - `Authorization: Bearer $FREDDY_API_KEY` ## Request Body **`image_url`** string required Source image URL or base64-encoded image payload. **`cleanup_instructions`** string required Describe what to remove or repair in the image. **`format`** string optional Response format (`png`, `jpeg`, `webp`). Default is `png`. **`strength`** string optional Cleanup intensity: `subtle`, `moderate`, or `aggressive`. Default is `moderate`. ## Returns Processed image details. ```json { "data": [ { "url": "https://api.freddy.aitronos.com/cleaned-images/img_abc123.jpg", "cleanup_mask": "https://api.freddy.aitronos.com/masks/cleanup_abc123.png", "objects_removed": [ "trash can" ] } ] } ``` Request ```bash curl -X POST "https://api.freddy.aitronos.com/v1/images/cleanup" \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "image_url": "https://example.com/photo.jpg", "cleanup_instructions": "remove the trash can from the background", "format": "jpeg", "strength": "moderate" }' ``` ```python import requests response = requests.post( "https://api.freddy.aitronos.com/v1/images/cleanup", headers={ "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" }, json={ "image_url": "https://example.com/photo.jpg", "cleanup_instructions": "remove the trash can from the background", "format": "jpeg", "strength": "moderate" } ) response.raise_for_status() cleaned = response.json() ``` ```javascript const response = await fetch( 'https://api.freddy.aitronos.com/v1/images/cleanup', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ image_url: 'https://example.com/photo.jpg', cleanup_instructions: 'remove the trash can from the background', format: 'jpeg', strength: 'moderate' }) } ); if (!response.ok) { throw new Error('Failed to cleanup image'); } const payload = await response.json(); ``` Error Response ```json { "error": { "type": "invalid_request", "message": "cleanup_instructions is required" } } ``` ## Related resources - [Image object](/docs/api-reference/images/objects/image-object) - [Generate image](/docs/api-reference/images/generate) - [Remove background](/docs/api-reference/images/remove-background) - [Replace background](/docs/api-reference/images/replace-background)