> ## 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.

# Recraft API

> Generate and edit raster and vector images with Recraft models over one REST API. Get a token, send a prompt, get an image.

<Tip>
  **Building with an AI agent?** Give Claude, Cursor, or ChatGPT this one link. It has every model, parameter, and a working request:

  ```text theme={null}
  https://www.recraft.ai/docs/api-reference/agents.md
  ```

  Using Claude Code? Install the [Recraft skill](/docs/api-reference/ai-tools#claude-code-skill) once and ask for what you need.
</Tip>

## Your first image

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

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

Then send a prompt:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://external.api.recraft.ai/v1/images/generations \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"prompt": "a red fox in a snowy forest, flat vector", "model": "recraftv4_1_vector"}'
  ```

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

  import requests

  response = requests.post(
      'https://external.api.recraft.ai/v1/images/generations',
      headers={'Authorization': f"Bearer {os.environ['RECRAFT_API_TOKEN']}"},
      json={'prompt': 'a red fox in a snowy forest, flat vector', 'model': 'recraftv4_1_vector'},
  )
  if not response.ok:
      raise SystemExit(f'{response.status_code}: {response.text}')
  print(response.json()['data'][0]['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.images.generate(
      prompt='a red fox in a snowy forest, flat vector',
      model='recraftv4_1_vector',
  )
  print(response.data[0].url)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://external.api.recraft.ai/v1/images/generations', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.RECRAFT_API_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ prompt: 'a red fox in a snowy forest, flat vector', model: 'recraftv4_1_vector' }),
  });
  if (!response.ok) throw new Error(await response.text());
  console.log((await response.json()).data[0].url);
  ```
</CodeGroup>

You get a link to an SVG file, valid for about 24 hours:

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

New to the API? The [Quickstart](/docs/api-reference/getting-started) walks through each step.

## Models

<CardGroup cols={3}>
  <Card title="V4.1 Flash" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/lightning.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=26285930d90616311073e3b8ea57af91" href="/docs/api-reference/models/recraft-v4-1-flash" width="16" height="16" data-path="icons/lightning.svg">
    About 1.3 s and \$0.007 per image, quality close to V4.1.

    <Badge size="sm">Raster</Badge> <Badge size="sm" color="green">Fastest</Badge>
  </Card>

  <Card title="V4.1" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/image.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=57a1b5ee2d9c407eb94126a5ff58ff58" href="/docs/api-reference/models/recraft-v4-1" width="16" height="16" data-path="icons/image.svg">
    The default. Photorealism, illustration, and strong short prompts. From \$0.035.

    <Badge size="sm">Raster</Badge> <Badge size="sm">Vector</Badge> <Badge size="sm">Styles</Badge>
  </Card>

  <Card title="V4 Styles" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/styles.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=178fa5dba0923a5452de54941e0169b6" href="/docs/api-reference/models/recraft-v4-styles" width="16" height="16" data-path="icons/styles.svg">
    Match any style from 1 to 10 reference images. From \$0.035.

    <Badge size="sm">Raster</Badge> <Badge size="sm">Vector</Badge> <Badge size="sm" color="purple">Style match</Badge>
  </Card>

  <Card title="V4" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/image-set.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=41ef98347d57b14c32a81f6395b070bd" href="/docs/api-reference/models/recraft-v4" width="16" height="16" data-path="icons/image-set.svg">
    Design taste and production-grade vectors. From \$0.04.

    <Badge size="sm">Raster</Badge> <Badge size="sm">Vector</Badge> <Badge size="sm">Styles</Badge>
  </Card>

  <Card title="V3" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/text.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=d0e57f9a309cae6ca95d55de57f7e6b3" href="/docs/api-reference/models/recraft-v3" width="16" height="16" data-path="icons/text.svg">
    Curated styles, exact text placement, and all editing operations. From \$0.04.

    <Badge size="sm">Inpaint</Badge> <Badge size="sm">Outpaint</Badge> <Badge size="sm">Text layout</Badge>
  </Card>

  <Card title="V2" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/shapes.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=8d6e2531e3e8593d5ddaec900f521688" href="/docs/api-reference/models/recraft-v2" width="16" height="16" data-path="icons/shapes.svg">
    The cheapest vector option, for icons and simple illustration. From \$0.022.

    <Badge size="sm">Raster</Badge> <Badge size="sm">Vector</Badge> <Badge size="sm">Icons</Badge>
  </Card>
</CardGroup>

Not sure which to pick? Compare them in [All models](/docs/api-reference/models/overview).

## What else you can do

<CardGroup cols={3}>
  <Card title="Edit" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/edit-ai.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=47348de3bfbb38fa3d5ff8ad96d3e6cd" href="/docs/api-reference/tools/image-to-image" width="16" height="16" data-path="icons/edit-ai.svg">
    Image to image, inpaint, outpaint, and erase region.
  </Card>

  <Card title="Background" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/change-bg.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=d82fff4c64efa450cfbebab0ca7688ef" href="/docs/api-reference/tools/remove-background" width="16" height="16" data-path="icons/change-bg.svg">
    Remove, replace, or generate a background.
  </Card>

  <Card title="Vectorize" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/vectorize.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=20fed25c6868dbcf06e9bc66a5118c5d" href="/docs/api-reference/tools/vectorize" width="16" height="16" data-path="icons/vectorize.svg">
    Turn a PNG or JPG into SVG for \$0.01.
  </Card>

  <Card title="Upscale" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/upscale.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=bd9eb97686f01416abd88d166630cb1f" href="/docs/api-reference/tools/upscale" width="16" height="16" data-path="icons/upscale.svg">
    Crisp or creative upscale, and refine details.
  </Card>

  <Card title="Styles" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/palette.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=b75ea457dff9ba17e27e2766bb226178" href="/docs/api-reference/styles" width="16" height="16" data-path="icons/palette.svg">
    Save your brand look once, reuse it in every request.
  </Card>

  <Card title="Enhance prompt" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/enhance-prompt.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=81634c78286b1cd112c930db1fd0df74" href="/docs/api-reference/tools/enhance-prompt" width="16" height="16" data-path="icons/enhance-prompt.svg">
    Expand a short prompt into a detailed one.
  </Card>
</CardGroup>

## Reference

* [Endpoints](/docs/api-reference/endpoints): every operation with its parameters.
* [Pricing](/docs/api-reference/pricing) and [Limits and sizes](/docs/api-reference/appendix): prices, sizes, prompt limits, and rate limits.
* [Clients and SDKs](/docs/api-reference/clients): plain HTTP or the OpenAI Python library.
* [Use with AI tools](/docs/api-reference/ai-tools): `llms.txt`, Markdown pages, and the Claude Code skill.


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