Vectorizer API

The Vectorizer.AI API is currently in beta.
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);
# Requires "requests" to be installed (see python-requests.org)
import requests

response = requests.post(
    'https://vectorizer.ai/api/v1/vectorize',
    files={'image': open('example.jpeg', 'rb')},
    data={
        # TODO: Add more upload options here
    },
    headers={
        'Authorization':
        'Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd'
    },
)
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);
# Requires "requests" to be installed (see python-requests.org)
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
    },
    headers={
        'Authorization':
        'Basic dmt5YzY3a3FhMjd5aWRkOltzZWNyZXRd'
    },
)
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

Pricing Guidance

The service is currently in beta and free to use. When we come out of beta, we expect to charge $0.05 to $0.20 per image, depending on monthly volume. API users will be notified well in advance of starting to charge for the service. We expect to come out of beta in Q3 or Q4 of 2023.

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

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.

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.


Integer, 100 to 2097252, 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 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.


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


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

Get API Key