> ## Documentation Index
> Fetch the complete documentation index at: https://www.recraft.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Refine details

> Re-render a raster image with Recraft V4.1 Pro for sharper textures and finer details for $0.21 per request.

Refine details re-renders a raster image with Recraft V4.1 Pro. It sharpens textures and fine details and keeps the composition.

<CardGroup cols={3}>
  <Card title="$0.21" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/credits-fill.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=411698b1ce815a1634dd83c0b7332cff" width="16" height="16" data-path="icons/credits-fill.svg">per request, Recraft V4.1 Pro</Card>
  <Card title="PNG, JPG, WEBP" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/image.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=57a1b5ee2d9c407eb94126a5ff58ff58" width="16" height="16" data-path="icons/image.svg">up to 10 MB, 16 MP</Card>
  <Card title="POST /v1/images/refineDetails" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/api.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=eace772046907259477c5fa36adeb139" width="16" height="16" data-path="icons/api.svg">endpoint</Card>
</CardGroup>

## Try it

Get an API token on your [profile page](https://app.recraft.ai/profile/api) (it needs a positive API units balance) and set it once per terminal session:

```bash theme={null}
export RECRAFT_API_TOKEN=your_token
```

Then run. The request refines a public sample illustration:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://external.api.recraft.ai/v1/images/refineDetails \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "image_url": "https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png"
    }'
  ```

  ```python Python theme={null}
  # pip install requests
  import os

  import requests

  response = requests.post(
      'https://external.api.recraft.ai/v1/images/refineDetails',
      headers={'Authorization': f"Bearer {os.environ['RECRAFT_API_TOKEN']}"},
      json={
          'image_url': 'https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png',
      },
  )
  if not response.ok:
      raise SystemExit(f'{response.status_code}: {response.text}')
  print(response.json()['image']['url'])
  ```

  ```javascript JavaScript theme={null}
  // Node.js 18+, run as an ES module (file.mjs)
  const response = await fetch('https://external.api.recraft.ai/v1/images/refineDetails', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.RECRAFT_API_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      image_url: 'https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png',
    }),
  });
  if (!response.ok) throw new Error(await response.text());
  const result = await response.json();
  console.log(result.image.url);
  ```

  ```python Python (OpenAI SDK) theme={null}
  # pip install openai
  import os

  from openai import OpenAI

  client = OpenAI(
      base_url='https://external.api.recraft.ai/v1',
      api_key=os.environ['RECRAFT_API_TOKEN'],
  )

  response = client.post(
      path='/images/refineDetails',
      cast_to=object,
      body={
          'image_url': 'https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png',
      },
  )
  print(response['image']['url'])
  ```
</CodeGroup>

## Response

```json theme={null}
{
  "created": 1759140000,
  "credits": 210,
  "image": {
    "image_id": "0e6a1b8c-5b1f-4a8e-9f3a-2c7d4e8b9a10",
    "url": "https://..."
  }
}
```

* The result is a single `image`, not a `data` array. `image.url` points to a raster file in the `image_format` you choose.
* The result is rendered at Recraft V4.1 Pro resolution for the aspect ratio of the source image.
* Image URLs are temporary: files are kept for about 24 hours, so download them. See [Limits and sizes](/docs/api-reference/appendix#image-storage).
* `credits` is the number of API units charged for the request.

## Parameters

| Parameter | Type, default | Description |
| - | - | - |
| `image_url` | string, **required** in JSON | URL or data URL of the input image. |
| `file` | file, **required** in multipart | The input image, uploaded instead of `image_url`. |
| `refinement` | string, `moderate` | How much the details may change. `subtle` keeps the source as close as possible. `moderate` allows more generative detail. |
| `response_format` | string, `url` | `url`, `b64_json`, or `multipart`. See [Image inputs and results](/docs/api-reference/image-inputs-and-results#image-results). |
| `image_format` | string, `webp` | `webp` (lossless) or `png`. See [Image format](/docs/api-reference/image-inputs-and-results#image-format). |

The input image must be PNG, JPG, or WEBP, under 10 MB, up to 16 MP, with sides between 256 and 4096 px. An image larger than 2048 px on its longest side is downscaled before refining. See [Input images](/docs/api-reference/appendix#input-images).

## Examples

<AccordionGroup>
  <Accordion title="Upload a local file">
    `refinement` goes in a form field next to the file.

    <CodeGroup>
      ```bash cURL theme={null}
      curl https://external.api.recraft.ai/v1/images/refineDetails \
        -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
        -F "file=@image.png" \
        -F "refinement=subtle"
      ```

      ```python Python theme={null}
      import os

      import requests

      with open('image.png', 'rb') as image:
          response = requests.post(
              'https://external.api.recraft.ai/v1/images/refineDetails',
              headers={'Authorization': f"Bearer {os.environ['RECRAFT_API_TOKEN']}"},
              data={'refinement': 'subtle'},
              files={'file': image},
          )
      if not response.ok:
          raise SystemExit(f'{response.status_code}: {response.text}')
      print(response.json()['image']['url'])
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Stay close to the source">
    `subtle` preserves the source as closely as possible. Use it when the image is already right and you only want sharper detail.

    ```bash theme={null}
    curl https://external.api.recraft.ai/v1/images/refineDetails \
      -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "image_url": "https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png",
        "refinement": "subtle"
      }'
    ```
  </Accordion>

  <Accordion title="Allow more generative detail">
    `moderate` is the default. Set it explicitly when you want the result to add more detail than `subtle` does.

    ```bash theme={null}
    curl https://external.api.recraft.ai/v1/images/refineDetails \
      -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "image_url": "https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png",
        "refinement": "moderate"
      }'
    ```
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Upscale" href="/docs/api-reference/tools/upscale">
    Increase resolution with crisp or creative upscale.
  </Card>

  <Card title="Pricing" href="/docs/api-reference/pricing">
    Prices of every model and tool.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.