Image Vectorization API

Vectorizer.AI offers a full-fledged bitmap tracing API. The API traces pixels to vectors fully automatically and with best-in-class fidelity.

Get API Key

Quickstart

POST a bitmap image and get a vectorized result back:

$ curl https://vectorizer.ai/api/v1/vectorize \
 -u xyz123:[secret] \
 -F image=@example.jpeg \
 -o result.svg
// Requires: org.apache.httpcomponents.client5:httpclient5-fluent

Request request = Request.post("https://vectorizer.ai/api/v1/vectorize")
   .addHeader("Authorization", "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd")
   .body(
      MultipartEntityBuilder.create()
         .addBinaryBody("image", new File("example.jpeg")) // TODO: Replace with your image
         // TODO: Add more upload parameters here
         .build()
      );
ClassicHttpResponse response = (ClassicHttpResponse) request.execute().returnResponse();

if (response.getCode() == 200) {
   // Write result to disk, TODO: or wherever you'd like
   try (FileOutputStream out = new FileOutputStream("result.svg")) {
      response.getEntity().writeTo(out);
   }
} else {
   System.out.println("Request Failed: Status: " + response.getCode() + ", Reason: " + response.getReasonPhrase());
}
using (var client = new HttpClient())
using (var form = new MultipartFormDataContent())
{
   client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "INSERT_API_KEY_HERE");
   form.Add(new ByteArrayContent(File.ReadAllBytes("example.jpeg")), "image", "example.jpeg"); // TODO: Replace with your image
   // TODO: Add more upload parameters here

   var response = client.PostAsync("https://vectorizer.ai/api/v1/vectorize", form).Result;

   if (response.IsSuccessStatusCode)
   {
      // Write result to disk, TODO: or wherever you'd like
      FileStream outStream = new FileStream("result.svg", FileMode.Create, FileAccess.Write, FileShare.None);
      response.Content.CopyToAsync(outStream).ContinueWith((copyTask) => { outStream.Close(); });
   }
   else
   {
       Console.WriteLine("Request Failed: Status: " + response.StatusCode + ", Reason: " + response.ReasonPhrase);
   }
}
// Requires "request" to be installed (see https://www.npmjs.com/package/request)
var request = require('request');
var fs = require('fs');

request.post({
  url: 'https://vectorizer.ai/api/v1/vectorize',
  formData: {
    image: fs.createReadStream('example.jpeg'), // TODO: Replace with your image
    // TODO: Add more upload options here
  },
  auth: {user: 'xyz123', pass: '[secret]'},
  followAllRedirects: true,
  encoding: null
}, function(error, response, body) {
  if (error) {
    console.error('Request failed:', error);
  } else if (!response || response.statusCode != 200) {
    console.error('Error:', response && response.statusCode, body.toString('utf8'));
  } else {
    // Save result
    fs.writeFileSync("result.svg", body);
  }
});
$ch = curl_init('https://vectorizer.ai/api/v1/vectorize');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
    array('Authorization: Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd'));
curl_setopt($ch, CURLOPT_POSTFIELDS,
    array(
      'image' => curl_file_create('example.jpeg'),
      // TODO: Add more upload options here
    ));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$data = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
  // Save result
  file_put_contents("result.svg", $data);
} else {
  echo "Error: " . $data;
}
curl_close($ch);
# Either use the sample code below, or this SDK: https://pypi.org/project/vectorizer-ai/
# Requires "requests" to be installed (see https://pypi.org/project/requests/)
import requests

response = requests.post(
    'https://vectorizer.ai/api/v1/vectorize',
    files={'image': open('example.jpeg', 'rb')},
    data={
        # TODO: Add more upload options here
    },
    auth=('xyz123', '[secret]')
)
if response.status_code == requests.codes.ok:
    # Save result
    with open('result.svg', 'wb') as out:
        out.write(response.content)
else:
    print("Error:", response.status_code, response.text)
# Requires: gem install httpclient
require 'httpclient'

client = HTTPClient.new default_header: {
  "Authorization" => "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd"
}

response = client.post("https://vectorizer.ai/api/v1/vectorize", {
  "image" => File.open("example.jpeg", "rb"), # TODO: Replace with your image
  # TODO: Add more upload parameters here
})

if response.status == 200 then
  # Write result to disk, TODO: or wherever you'd like
  File.open("result.svg", 'w') { |file| file.write(response.body) }
else
  puts "Error: Code: " + response.status.to_s + ", Reason: " + response.reason
end
$ curl https://vectorizer.ai/api/v1/vectorize \
 -u xyz123:[secret] \
 -F 'image.url=https://example.com/example.jpeg' \
 -o result.svg
// Requires: org.apache.httpcomponents.client5:httpclient5-fluent

Request request = Request.post("https://vectorizer.ai/api/v1/vectorize")
   .addHeader("Authorization", "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd")
   .body(
      MultipartEntityBuilder.create()
         .addTextBody("image.url", "https://example.com/example.jpeg") // TODO: Replace with your image URL
         // TODO: Add more upload parameters here
         .build()
      );
ClassicHttpResponse response = (ClassicHttpResponse) request.execute().returnResponse();

if (response.getCode() == 200) {
   // Write result to disk, TODO: or wherever you'd like
   try (FileOutputStream out = new FileOutputStream("result.svg")) {
      response.getEntity().writeTo(out);
   }
} else {
   System.out.println("Request Failed: Status: " + response.getCode() + ", Reason: " + response.getReasonPhrase());
}
using (var client = new HttpClient())
using (var form = new MultipartFormDataContent())
{
   client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "INSERT_API_KEY_HERE");
   form.Add(new StringContent("https://example.com/example.jpeg"), "image.url"); // TODO: Replace with your image URL
   // TODO: Add more upload parameters here

   var response = client.PostAsync("https://vectorizer.ai/api/v1/vectorize", form).Result;

   if (response.IsSuccessStatusCode)
   {
      // Write result to disk, TODO: or wherever you'd like
      FileStream outStream = new FileStream("result.svg", FileMode.Create, FileAccess.Write, FileShare.None);
      response.Content.CopyToAsync(outStream).ContinueWith((copyTask) => { outStream.Close(); });
   }
   else
   {
       Console.WriteLine("Request Failed: Status: " + response.StatusCode + ", Reason: " + response.ReasonPhrase);
   }
}
// Requires "request" to be installed (see https://www.npmjs.com/package/request)
var request = require('request');
var fs = require('fs');

request.post({
  url: 'https://vectorizer.ai/api/v1/vectorize',
  formData: {
    'image.url': 'https://example.com/example.jpeg', // TODO: Replace with your image
    // TODO: Add more upload options here
  },
  auth: {user: 'xyz123', pass: '[secret]'},
  followAllRedirects: true,
  encoding: null
}, function(error, response, body) {
  if (error) {
    console.error('Request failed:', error);
  } else if (!response || response.statusCode != 200) {
    console.error('Error:', response && response.statusCode, body.toString('utf8'));
  } else {
    // Save result
    fs.writeFileSync("result.svg", body);
  }
});
$ch = curl_init('https://vectorizer.ai/api/v1/vectorize');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
    array('Authorization: Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd'));
curl_setopt($ch, CURLOPT_POSTFIELDS,
    array(
      'image.url' => 'https://example.com/example.jpeg',
      // TODO: Add more upload options here
    ));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$data = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
  // Save result
  file_put_contents("result.svg", $data);
} else {
  echo "Error: " . $data;
}
curl_close($ch);
# Either use the sample code below, or this SDK: https://pypi.org/project/vectorizer-ai/
# Requires "requests" to be installed (see https://pypi.org/project/requests/)
import requests

response = requests.post(
    'https://vectorizer.ai/api/v1/vectorize',
    data={
        'image.url': 'https://example.com/example.jpeg',
        # TODO: Add more upload options here
    },
    auth=('xyz123', '[secret]')
)
if response.status_code == requests.codes.ok:
    # Save result
    with open('result.svg', 'wb') as out:
        out.write(response.content)
else:
    print("Error:", response.status_code, response.text)
# Requires: gem install httpclient
require 'httpclient'

client = HTTPClient.new default_header: {
  "Authorization" => "Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd"
}

response = client.post("https://vectorizer.ai/api/v1/vectorize", {
  "image.url" => "https://example.com/example.jpeg", # TODO: Replace with your image URL
  # TODO: Add more upload parameters here
})

if response.status == 200 then
  # Write result to disk, TODO: or wherever you'd like
  File.open("result.svg", 'w') { |file| file.write(response.body) }
else
  puts "Error: Code: " + response.status.to_s + ", Reason: " + response.reason
end

API Chatbot

We have created a custom ChatGPT that can help you with your API integration. It can answer questions about the API documentation, and provide sample code in your preferred language tailored to your use-case.

Chat with the Vectorizer.AI API Chatbot

The chatbot is in beta and makes mistakes. Double-check the answers, and ask it to revise the code to fix errors and omissions.

How To Use This API

The API is designed to support many different use-cases. Here are a few common ones:

Single Image Submit a bitmap, get a vector result, done

Use the Vectorize endpoint and the code samples above.

Preview First Show a preview to your prospect before they buy

If you need to make a lot of API calls to make a sale, you can use the lower cost previews until you actually convert a customer.

  1. Use the Vectorize endpoint with mode=preview and policy.retention_days > 0 to get the preview, making sure to retain the Image Token returned in the X-Image-Token response header.

  2. After converting, use the Download endpoint with the Image Token to download the full result.

  3. Optional: if you need additional result formats (e.g. PNG, PDF, etc), be sure to retain the Receipt returned in the X-Receipt download response header. Then use the Download endpoint with the Image Token and Receipt to download the remaining formats.

Multi-Format You need e.g. both PNG and SVG results

  1. Use the Vectorize endpoint with policy.retention_days > 0 to get the first result, making sure to retain the Image Token returned in the X-Image-Token response header.

  2. Use the Download endpoint with the Image Token to download the other formats.

Multi-Option You need to process each image with multiple processing options

  1. Use the Vectorize endpoint with policy.retention_days > 0 to get the first result, making sure to retain the Image Token returned in the X-Image-Token response header.

  2. Use the Vectorize endpoint with the Image Token to iterate over the remaining processing options you need.

  3. Alternatively you can process each image individually and not worry about the Image Token. The Image Token saves you a bit of bandwidth and latency.

Pricing

ActionCreditsDescription
Testing0.00

It is free to integrate with and test the API, no subscription required.

Use mode=test and mode=test_preview for development.

You can assess the result quality using the interactive Web App on the front page.

Preview0.20

We offer preview results that you can show your end-users before they make a purchase.

Previews are PNG images four times larger than your input, and come with a discreet watermark.

Use mode=preview to get a preview result.

Vectorize1.00 Vectorize a bitmap image to a vector image.
Upgrade Preview0.90 Download the production result after a preview API call. Discounted compared to vectorizing it from scratch.
Download Format0.10 Download another format (e.g. SVG, PNG, PDF, etc) of the result. Discounted compared to vectorizing it from scratch.
Storage Day0.01 Price per day for storing a result beyond the first day, which is free.

Please see the pricing page for the subscription plans.

Authentication & Security

The API uses standard HTTP basic access authentication. All requests to the API must be made over HTTPS and include your API Credentials, with the API Id as the user and API Secret as the password.

Your http client library must support Server Name Indication (SNI) to successfully make requests. If you're getting weird handshake errors, this is most likely it.

Rate Limiting

Usage of the API is rate limited with generous allowances and no hard upper bound.

During normal end-user-driven operation you are unlikely to run into any rate limiting as usage then tends to ebb and flow in a way that the service handles gracefully.

However, for batch jobs we recommend starting out with at most 5 threads, adding 1 new thread every 5 minutes until you have reached the desired level of parallelism. Please reach out before starting if you need more than 100 concurrent threads.

If you submit too many requests you will start getting 429 Too Many Requests responses. When this happens you should apply linear back off: on the first such response, wait 5 seconds until submitting the next request. On the second consecutive 429 response, wait 2*5=10 seconds until submitting the next request. On the third wait 3*5=15 seconds, etc.

You can reset the back off counter after a successful request, and you should apply the back off on a per-thread basis (i.e. the threads should operate independently of each other).

Timeouts

While API requests are normally completed within seconds, it is possible during transient load spikes to experience longer processing times.

To ensure your client library doesn't prematurely terminate API requests it should be configured with an idle timeout of at least 180 seconds.

Error JSON

We use conventional HTTP statuses to indicate success or failure of an API request, and include important error information in the returned Error JSON Object.

We strive to always return an Error JSON Object with any problematic request. However, it is always theoretically possible to have internal server failures that lead to a non-JSON error response.

Attributes

statusThe HTTP status of the response, repeated here to help with debugging.
codeVectorizer.AI internal error code.
messageHuman-readable error message, intended to be helpful in debugging.

If the HTTP status for your request is 200 then no Error JSON Object will be returned, and you can safely assume that the request broadly speaking succeeded.

Some HTTP Client libraries raise exceptions for HTTP statuses in the 400-599 range. You will need to catch those exceptions and handle them appropriately.

HTTP StatusMeaning
200-299

Success

400-499

There's a problem with the information provided in the request (e.g. a parameter was missing). Please review the error message to figure out how to fix it.

500-599

There's been a Vectorizer.AI internal error. Wait a moment then try again, and if the problem persists please email us.

Example Error Response

{
  "error" : {
    "status" : 400,
    "code" : 1006,
    "message" : "Failed to read the supplied image. "
  }
}

Recent API errors are listed on your account page for your debugging convenience.

There's also a list of all error responses returned by the API.

Response Headers

Here are the custom response headers we use:

HeaderDescription
X-Image-Token

Returned when your vectorization request has policy.retention_days > 0. Can be used to:

  1. Download the production result after a preview API call at a discount compared to vectorizing it from scratch.

  2. Download additional formats (e.g. SVG, PNG, PDF, etc) of the result at a reduced rate compared to vectorizing them from scratch.

  3. Re-vectorize the same image with different processing options.

X-Receipt

Returned when you download a production result using a preview Image Token. Can be used to download additional formats (e.g. SVG, PNG, PDF, etc) of the result at the download format rate instead of the upgrade preview rate.

X-Credits-Calculated

Returned with test requests to show the cost that would have been incurred if it had been a regular request.

X-Credits-Charged

Returned with all requests to show the cost incurred. Always 0 for test requests.

Vectorize POST
https://api.vectorizer.ai/api/v1/vectorize

To vectorize an image, you do a standard HTTP POST file upload. Keep in mind that the Content-Type has to be multipart/form-data when uploading binary files.

The table below lays out all the API parameters in a working try-it-now form. Each parameter has a brief description, but be sure to check out the detailed Output Options Documentation.

Parameters

The input image must be provided as one of:


Binary

A binary file.


String

A base64-encoded string. The string can be at most 1 megabyte in size.


String

A URL to fetch and process.


An Image Token, returned in the X-Image-Token header in an earlier vectorization API call where policy.retention_days > 0.

Must be a .bmp, .gif, .jpeg, .png, or .tiff file.

The maximum image upload size (= width × height) is 33,554,432 pixels, which gets shrunk to input.max_pixels.


Enum, default: production
Value Processing Mode Credits
production

This mode is intended for production use and all parameters are supported.

1.00
preview

This mode is intended for when you want to show your end-user a preview before they make a purchase.

It produces a 4x PNG result with a discreet watermark, ignoring any contradictory parameters.

0.20
test, test_preview

These modes are intended for developer use when integrating with the service. All parameters are supported, but there's significant watermarking.

Test results are free and do not require an active subscription, so you can integrate with the service free of charge.

We include an X-Credits-Calculated header in the response so you can affirmatively know what you would have been charged for the corresponding production calls.

Free

Integer, 100 to 3145828, default: 2097252

The maximum input image size (= width × height in pixels). Images larger than this will be shrunk to this size before processing.


Integer, 0 to 30, default: 0

The number of days to retain the input image and its result for. When you specify policy.retention_days > 0 we include an X-Image-Token header in the response.

This has three primary uses:

  1. After making a preview API call you can later download the production result quickly and at a discount.

  2. After vectorizing an image you can then download multiple output formats for the same image and processing options without having to vectorize them all from scratch. This saves significantly on both credits and latency.

  3. When you want to re-vectorize the same image with different processing options. This allows you to reduce the call latency and save on bandwidth.

The first day of storage is free, then a charge of 0.01 credits per day applies.

See also the Download endpoint.


Integer, 0 to 256, default: 0

The maximum number of colors to use for the result.

0 means unlimited. 1 and 2 both mean two colors, e.g. black-and-white. N>=2 means that number of colors.

Note that if output.gap_filler.enabled=true (the default) then the result will also contain mixtures of the selected colors. Disable the gap filler to get a result with only the selected colors.


Format: '[color][-> remapped][~ tolerance];'
#00000000;
#FFFFFF ~ 0.1;
#0000FF -> #00FF00;
#FF0000 -> #00FF00 ~ 0.1;

Default:   (empty)

This is a very powerful and flexible mechanism to control the colors in the result.

Colors detected in the image that are within the tolerance of any of the palette colors will be snapped to the nearest such palette color, and remapped if that palette color has a remapping specified. Unmatched colors are left unchanged.

Examples

To snap the detected colors to the nearest of red, green, and blue, use:

#FF0000; 
#00FF00; 
#0000FF;

To clean up detected colors close to red, green, and blue, but leave others unchanged, use:

#FF0000 ~ 0.02; 
#00FF00 ~ 0.02; 
#0000FF ~ 0.02;

To turn detected colors close to red into green, leaving everything else unchanged, use:

#FF0000 -> #00FF00 ~ 0.02;

To snap anything close to red, green, and blue to those colors, but snap all other colors to transparent black (thereby removing them from the result), use:

#FF0000 ~ 0.02; 
#00FF00 ~ 0.02; 
#0000FF ~ 0.02; 
#00000000; // Transparent => removed

Colors

Colors are specified using basic CSS color syntax. For (partially) transparent colors we recommend using #RRGGBBAA. For opaque colors we recommend using #RRGGBB.

Fully transparent colors are omitted from the result. Together with the color remapping capability you can use that to remove select colors from the result.

You can use a maximum of 1,024 colors.

Tolerance

The unit is in fractional ARGB color distance, where 1.0 is the distance from opaque red (#FFFF0000) to opaque black (#FF000000).

The maximum tolerance is 2.0, which is the distance from transparent black (#00000000) to opaque white (#FFFFFFFF).

The default tolerance is 2.0, so by default detected colors will snap to their nearest palette color, even if it is far away. You can restrict the snapping to individual palette colors by specifying custom tolerances.

If you're used to working with colors in the 0-255 range, then just divide by 255 to get the fractional value.


Enum, default: svg

Output file format.

SVG Options:


Enum, default: svg_1_1

Specify the SVG version attribute in the SVG tag. Details


Boolean, default: false

Whether to include the image size attributes in the SVG tag. When true viewers will typically render the SVG at a fixed size. When false viewers will typically let the SVG scale to fit the available space. Details


Boolean, default: false

When true we disable options that Adobe Illustrator cannot import. Details

DXF Options:


Enum, default: lines_and_arcs

DXF readers vary wildly in their abilities. This option allows you to restrict the output to the drawing primitives that your DXF reader actually supports. Details

Bitmap Options:


Enum, default: anti_aliased
Value Anti-Aliasing Mode
anti_aliased Pixels along the boundary between shapes have their colors blended according to the fraction of the pixel's area covered by each shape.
aliased Pixels are assigned the color of the shape that contains the geometric center of the pixel.

Enum, default: fill_shapes

Specify how you want the output to be stroked or filled. There's a subtle difference between stroking the shapes and stroking the edges between them. Please see the detailed documentation for an explanation


Enum, default: cutouts

Determines if shapes are placed in cut-outs in the shapes below (cutouts) or if they're stacked on top of each other (stacked). Details


Enum, default: none
Value Shape grouping
none No grouping
color By color, interacts with output.shape_stacking
parent By containing shape
layer By draw order Layer
Details

Boolean, default: false

Flatten identified circles, ellipses, rectangles, triangles, and stars to ordinary curves. Details

Curves:


Boolean, default: true

Whether to allow Quadratic Bézier Curves. Details


Boolean, default: true

Whether to allow Cubic Bézier Curves. Details


Boolean, default: true

Whether to allow Circular Arcs. Details


Boolean, default: true

Whether to allow Elliptical Arcs. Details


Float, 0.001 to 1.0, default: 0.1

Maximum distance in pixels between a curve and the line that approximates it. Details

Gap Filler:


Boolean, default: true

Whether to work around the white line rendering bugs common in vector viewers. Details


Boolean, default: false

Whether to clip the gap filler strokes. When output.shape_stacking=stacked either clip or use non-scaling strokes. Details


Boolean, default: true

Whether to use non-scaling gap filler strokes. When output.shape_stacking=stacked either clip or use non-scaling strokes. Details


Float, 0.0 to 5.0, default: 2.0

Width of the gap filler strokes. Details

Stroke style when output.draw_style is stroke_shapes or stroke_edges


Boolean, default: true

Whether to use a non-scaling stroke. Details


Boolean, default: false

Whether to use an override color, or the estimated color of the shape. Details


Format: '#RRGGBB', e.g. #FF00FF, default: #000000

The override color. Details


Float, 0.0 to 5.0, default: 1.0

Width of the stroke. Details

Output Size:


Float, 0.0 to 1000.0

Uniform scale factor. If specified, this takes precedence over output.size.width and output.size.height.


Float, 0.0 to 1.0E12

Width in units specified by output.size.unit. If only one of width and height is specified, the other is computed automatically to preserve the aspect ratio.


Float, 0.0 to 1.0E12

Height in units specified by output.size.unit. If only one of width and height is specified, the other is computed automatically to preserve the aspect ratio.


Enum, default: none

The unit of measurement for the width and height. Of these, pt, in, cm, and mm are physical units, and none and px are non-physical units. These distinctions interact with output.size.input_dpi and output.size.output_dpi.


Enum, default: preserve_inset

Value Scaling Rule
preserve_inset Scale uniformly to fit the tighter dimension, so there is no overflow but is empty space in the other dimension
preserve_overflow Scale uniformly to fit the less tight dimension, overflowing the tighter dimension
stretch Non-uniformly scale to fit the specified width and height
For either preserve option, the position in the unconstrained dimension is controlled by output.size.align_x or output.size.align_y.


Float, 0.0 to 1.0, default: 0.5

Horizontal alignment for output.size.aspect_ratio = preserve_inset or preserve_overflow.

Value Horizontal Alignment
0.0 Left aligned
0.5 Centered horizontally
1.0 Right aligned
Can be any value between 0.0 and 1.0.


Float, 0.0 to 1.0, default: 0.5

Vertical alignment for output.size.aspect_ratio = preserve_inset or preserve_overflow.

Value Vertical Alignment
0.0 Top aligned
0.5 Centered vertically
1.0 Bottom aligned
Can be any value between 0.0 and 1.0.


Float, 1.0 to 1000000.0

The DPI of the input image is read from the file when available. This parameter allows you to override that value. The resultant value is used to compute the physical size of the input image, which is used to compute the output size if physical units are specified for the output, but not an explicit width or height.


Float, 1.0 to 1000000.0

The DPI of the output image. This is used to compute the pixel size of the bitmap output when physical units are specified.

Download POST
https://api.vectorizer.ai/api/v1/download

This endpoint allows you to:

  1. Download the full production result after a preview API call.

    We include an X-Receipt header in the response so you can download additional output formats at the reduced download format rate afterwards.

  2. Download multiple output formats for the same image and processing options at the reduced download format rate and without having to vectorize them all from scratch.

Parameters


An Image Token, returned in the X-Image-Token header in an earlier vectorization API call where policy.retention_days > 0.


String
Optional

A receipt, returned in the X-Receipt header in an earlier download API call where you upgraded a preview to a production result.

When submitting a preview Image Token you must include the receipt to get the reduced download format rate.


Enum, default: svg

Output file format.

SVG Options:


Enum, default: svg_1_1

Specify the SVG version attribute in the SVG tag. Details


Boolean, default: false

Whether to include the image size attributes in the SVG tag. When true viewers will typically render the SVG at a fixed size. When false viewers will typically let the SVG scale to fit the available space. Details


Boolean, default: false

When true we disable options that Adobe Illustrator cannot import. Details

DXF Options:


Enum, default: lines_and_arcs

DXF readers vary wildly in their abilities. This option allows you to restrict the output to the drawing primitives that your DXF reader actually supports. Details

Bitmap Options:


Enum, default: anti_aliased
Value Anti-Aliasing Mode
anti_aliased Pixels along the boundary between shapes have their colors blended according to the fraction of the pixel's area covered by each shape.
aliased Pixels are assigned the color of the shape that contains the geometric center of the pixel.

Enum, default: fill_shapes

Specify how you want the output to be stroked or filled. There's a subtle difference between stroking the shapes and stroking the edges between them. Please see the detailed documentation for an explanation


Enum, default: cutouts

Determines if shapes are placed in cut-outs in the shapes below (cutouts) or if they're stacked on top of each other (stacked). Details


Enum, default: none
Value Shape grouping
none No grouping
color By color, interacts with output.shape_stacking
parent By containing shape
layer By draw order Layer
Details

Boolean, default: false

Flatten identified circles, ellipses, rectangles, triangles, and stars to ordinary curves. Details

Curves:


Boolean, default: true

Whether to allow Quadratic Bézier Curves. Details


Boolean, default: true

Whether to allow Cubic Bézier Curves. Details


Boolean, default: true

Whether to allow Circular Arcs. Details


Boolean, default: true

Whether to allow Elliptical Arcs. Details


Float, 0.001 to 1.0, default: 0.1

Maximum distance in pixels between a curve and the line that approximates it. Details

Gap Filler:


Boolean, default: true

Whether to work around the white line rendering bugs common in vector viewers. Details


Boolean, default: false

Whether to clip the gap filler strokes. When output.shape_stacking=stacked either clip or use non-scaling strokes. Details


Boolean, default: true

Whether to use non-scaling gap filler strokes. When output.shape_stacking=stacked either clip or use non-scaling strokes. Details


Float, 0.0 to 5.0, default: 2.0

Width of the gap filler strokes. Details

Stroke style when output.draw_style is stroke_shapes or stroke_edges


Boolean, default: true

Whether to use a non-scaling stroke. Details


Boolean, default: false

Whether to use an override color, or the estimated color of the shape. Details


Format: '#RRGGBB', e.g. #FF00FF, default: #000000

The override color. Details


Float, 0.0 to 5.0, default: 1.0

Width of the stroke. Details

Output Size:


Float, 0.0 to 1000.0

Uniform scale factor. If specified, this takes precedence over output.size.width and output.size.height.


Float, 0.0 to 1.0E12

Width in units specified by output.size.unit. If only one of width and height is specified, the other is computed automatically to preserve the aspect ratio.


Float, 0.0 to 1.0E12

Height in units specified by output.size.unit. If only one of width and height is specified, the other is computed automatically to preserve the aspect ratio.


Enum, default: none

The unit of measurement for the width and height. Of these, pt, in, cm, and mm are physical units, and none and px are non-physical units. These distinctions interact with output.size.input_dpi and output.size.output_dpi.


Enum, default: preserve_inset

Value Scaling Rule
preserve_inset Scale uniformly to fit the tighter dimension, so there is no overflow but is empty space in the other dimension
preserve_overflow Scale uniformly to fit the less tight dimension, overflowing the tighter dimension
stretch Non-uniformly scale to fit the specified width and height
For either preserve option, the position in the unconstrained dimension is controlled by output.size.align_x or output.size.align_y.


Float, 0.0 to 1.0, default: 0.5

Horizontal alignment for output.size.aspect_ratio = preserve_inset or preserve_overflow.

Value Horizontal Alignment
0.0 Left aligned
0.5 Centered horizontally
1.0 Right aligned
Can be any value between 0.0 and 1.0.


Float, 0.0 to 1.0, default: 0.5

Vertical alignment for output.size.aspect_ratio = preserve_inset or preserve_overflow.

Value Vertical Alignment
0.0 Top aligned
0.5 Centered vertically
1.0 Bottom aligned
Can be any value between 0.0 and 1.0.


Float, 1.0 to 1000000.0

The DPI of the input image is read from the file when available. This parameter allows you to override that value. The resultant value is used to compute the physical size of the input image, which is used to compute the output size if physical units are specified for the output, but not an explicit width or height.


Float, 1.0 to 1000000.0

The DPI of the output image. This is used to compute the pixel size of the bitmap output when physical units are specified.

Delete POST
https://api.vectorizer.ai/api/v1/delete

Images vectorized with policy.retention_days > 0 are stored for the requested time period and deleted automatically shortly thereafter.

There is normally no need to call this endpoint. It is provided so you can delete images before the retention period expires. Deleting an image early does not give you a refund for the remaining storage days.

Parameters


An Image Token, returned in the X-Image-Token header in an earlier vectorization API call where policy.retention_days > 0.

Response Attributes

success

true The Image Token has been affirmatively deleted.

Example Response

{
  "success" : true
}

Account Status GET
https://api.vectorizer.ai/api/v1/account

Fetch basic information about your account, such as your subscription status and number of credits left.

Parameters

None

Response Attributes

subscriptionPlan

The subscription plan you're currently subscribed to, or 'none'.

subscriptionState

The state of your current subscription ('active' or 'pastDue') or 'ended' if not subscribed.

credits

The number of API credits left in your account. 0 if not currently subscribed, or subscribed to a non-API plan. Can be fractional, so be sure to parse as a Double.

Username = API Id, Password = API Secret

cURL

$ curl "https://api.vectorizer.ai/api/v1/account" \
 -u vkyc67kqa27yidd:[secret]

Example Response

{
  "subscriptionPlan" : "none",
  "subscriptionState" : "ended",
  "credits" : 0
}

API Changelog

DateChange
Oct 1, 2024 Added an AI chatbot to assist in integrating with the API.
Sep 23, 2024 Greatly expanded the API to enable more modes of operation. Added Image Tokens, Receipts, per-call charge headers, and the Download and Delete endpoints.
Jun 11, 2024 Added processing.palette
Mar 4, 2024 Added section about timeouts.
Jan 24, 2024 Added the Account Status endpoint. Added recent API errors to the Account page. Added listing of all API error responses.
Jan 16, 2024 Documented the Error JSON Object.
Oct 3, 2023 Clarified that output.gap_filler.enabled=true leads to more colors in the result than requested in processing.max_colors.
Sep 20, 2023 Added mode
Aug 1, 2023 Added a full-featured output size options group with the following options: output.size.scale, output.size.width, output.size.height, output.size.unit, output.size.aspect_ratio, output.size.align_x, output.size.align_y, output.size.input_dpi, and output.size.output_dpi. Added a bitmap output options group with one option: output.bitmap.anti_aliasing_mode.
Jun 7, 2023 Added processing.max_colors
May 31, 2023 Greatly expanded the API parameters. Updated the API endpoint.
Mar 10, 2023 Initial release.
Get API Key