Skip to content
English

Recraft V4 Vector API

POST Base URL: https://api.hiapi.ai /v1/tasks

Image, video, and audio models are called through theUnified Async API POST /v1/tasks endpoint; only the input fields differ (see input parameters below).

Model summary

Model name recraft-v4/text-to-vector
Type Image generation (text-to-vector SVG)
Endpoint POST /v1/tasks
Pricing See HiAPI Pricing

Recraft V4 Vector: one description becomes an editable SVG vector file for logos, icons and flat illustration.

Production guidance

Production guidance
  • For production, pass callback.url at the top level of the request body so HiAPI can notify your service when the task reaches a terminal state.
  • GET /v1/tasks/:id is better for local debugging, low-volume jobs, or fallback reconciliation if a callback is missed.
  • Result URLs expire — copy the output to your own storage once the task succeeds.
  • The output is an SVG vector file. If your pipeline needs raster images, rasterize it after download; do not treat the bytes as JPEG/PNG.

Best suited for

Logos and brand marks

Geometric marks and wordmark lockups you can keep editing.

promptcolors
Icon systems

Generate a consistent icon set, then split it in a design tool.

promptimage_size
Flat illustration and layouts

Article art, landing-page heroes and scalable graphic bases.

prompt

Request parameters

model string required

Fixed value recraft-v4/text-to-vector.

example recraft-v4/text-to-vector
input object required

Business parameters.

prompt string required

Vector artwork description: subject, shapes, style and any text to draw. 1–10,000 characters.

image_size enum optional

Canvas ratio preset. The preset sets the canvas orientation and ratio; the SVG output scales without loss.

default square_hd enum: square_hdsquareportrait_4_3portrait_16_9landscape_4_3landscape_16_9
colors array optional

Preferred palette as an array of RGB objects; each object contains r, g and b from 0 to 255.

r integer required

0–255, red

g integer required

0–255, green

b integer required

0–255, blue

background_color object optional

Preferred background color as an RGB object; r, g and b range from 0 to 255.

r integer required

0–255, red

g integer required

0–255, green

b integer required

0–255, blue

callback object optional

Optional callback configuration. When set, HiAPI notifies your service when the task reaches a terminal state.

url string required

Required when callback is set; HTTPS URL that receives terminal task notifications.

example https://your-domain.com/hiapi/callback
when enum optional

Callback trigger timing. Use final.

default final enum: final

Example requests

Set a brand palette

colors sets deep green and sand, while background_color sets cream; the SVG paths stay within that palette.

Request body
{
  "model": "recraft-v4/text-to-vector",
  "input": {
    "prompt": "A minimal geometric mountain mark for an outdoor brand, flat vector, centered",
    "image_size": "square_hd",
    "colors": [
      {
        "r": 22,
        "g": 61,
        "b": 52
      },
      {
        "r": 232,
        "g": 212,
        "b": 178
      }
    ],
    "background_color": {
      "r": 250,
      "g": 246,
      "b": 238
    }
  }
}

Getting the result

  1. The response returns a taskId immediately without waiting for generation to finish.
  2. In production, prefer waiting for callback.url to receive the terminal notification. For local debugging, poll GET /v1/tasks/:id.
  3. When status=success, download the SVG file from output[].url.
  4. Open the file in a browser, Figma, Illustrator or Sketch. SVG is a text-based vector format.
  5. When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.

FAQ

What format is the output?

An editable SVG vector file, one file per request at output[].url in the task result.

How is it different from Recraft V4 Pro Vector?

Both take the same inputs. V4 Vector is faster and cheaper for batches and simple shapes; Pro focuses on detail and finish.

Which canvas sizes are supported?

image_size accepts square_hd (default), square, portrait_4_3, portrait_16_9, landscape_4_3 and landscape_16_9.

How do I set colors?

Pass colors (an array of RGB objects) and background_color (one RGB object), each channel 0–255.

Do I need a reference image?

No. It is a text-to-vector model.

Can I keep editing the file?

Yes. SVG opens in Figma, Illustrator, Sketch and similar tools for node, color and text edits and export at any size.

How accurate is in-image text?

Short headlines and wordmarks are usually stable. Put the text in quotes and describe placement, case and type style.

How is it billed?

Per output SVG file, one file per request. See the live pricing page for the current rate.

Next steps