# Edit

Edit images based on a text description. To learn more about the pricing for this endpoint, visit the [pricing page](https://api.reve.com/console/pricing).

POST https://api.reve.com/v1/image/edit

### Playground

API Key

Reference Image (1/1)

0

Edit Instruction

Aspect Ratio

16:93:24:31:13:42:39:16 auto

Version

latest

latest

latest-fast

reve-edit@20250915

reve-edit-fast@20251030

reve-edit-passthrough@20260625

Test Time Scaling

Postprocessing

Add Post-processor

Generate Image

### Result

## Request Headers

- **Authorization**: The API Key provided as a bearer token.
- **Accept**: One of image/png, image/jpeg, image/webp or application/json. For images, the response will be the bytes directly with the additional information provided as custom headers. For JSON, the response will be an object with the image base64 encoded (png) with additional information provided as separate properties.

Default: application/json

## Request Body

- **edit_instruction**: The text description of how to edit the provided image. The maximum length is 2560 characters. This instruction will be automatically enhanced by the model.
- **reference_image**: A base64 encoded image to use as reference for the edit.
- **aspect_ratio**: The desired aspect ratio of the generated image: One of 16:9, 9:16, 3:2, 2:3, 4:3, 3:4, or 1:1.

Default: If not provided, the aspect ratio of the reference image will be used.

- **version**: The specific model version to use when generating the image. Using latest will default to our most recently released image model. The only supported version strings are:
  - latest-fast
  - latest
  - reve-edit-fast@20251030
  - reve-edit@20250915

Default: latest

- **postprocessing**: An optional argument. If you include it, the image will be processed further after generation. The supported postprocessing operations are:
    - **upscale** to upscale the image after generation with factors 2, 3, and 4.
    - **remove_background** to keep only the central subject, making the background transparent.
    - **fit_image** to resize the image while preserving aspect ratio.
    - **effect** to apply a post-processing effect to the image.

Default: none

- **test_time_scaling**: An optional argument. If it is included, the model will spend more effort in making better images. Acceptable values are between 1 and 15.

Default: 1

## JSON Request

```curl
REVE_API_KEY=""

# Make the API request
curl -X POST https://api.reve.com/v1/image/edit \
  -H "Authorization: Bearer $REVE_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "edit_instruction": "Make this into an impasto painting.",
    "reference_image": "'"$(base64 < reference.jpg | tr -d '\n')"'",
    "aspect_ratio": "16:9",
    "version": "latest"
  }'
```

## JSON Response Body (default)

### For successful responses (200 status code)

- **image**: The base64 encoded image data.
- **version**: The specific model version used in the generation process.
- **content_violation**: Indicates whether the generated image violates the content policy.
- **request_id**: A unique id for the request.
- **credits_used**: The number of credits used for this request.
- **credits_remaining**: The number of credits remaining in your budget.

### For failure (non-200 HTTP status code)

- **error_code**: The type of error.
- **message**: More information about the error.
- **params**: Specific parameters related to the error, if applicable.

### Successful JSON Response (200)

```json
// Status: 200
// Content-Type: application/json
// X-Reve-Content-Violation: false
// X-Reve-Request-Id: rsid-...

{
  "image": "...",
  "version": "reve-edit@20250915",
  "content_violation": false,
  "request_id": "rsid-...",
  "credits_used": 30,
  "credits_remaining": 970
}
```

## Image Response Body

Successful responses (200 status code) with no content policy violations will return a base64 encoded image.
