Skip to article
Open PerfectVector
Browse docsFor AI agents
APIGet started

PerfectVector API for AI agents

Keys, endpoints, prices, limits, errors and a full example, on one page for coding agents.

9 min read
On this page

This page is for AI coding agents and the people who use them. It puts what you need to write an integration in one place, and each section links to the guide with the details.

The PerfectVector API converts PNG, JPEG and WebP images into SVG files. You send an image with an API key, and you get the SVG back.

Using an AI assistant instead? See the MCP docs.

Before you start

  • Base URL: https://api.perfectvector.com/v1
  • An API key. Someone signed in to perfectvector.com creates it on the Developer API page of their account. An API key cannot manage keys.
  • A server or a script. The API sends no CORS headers, so browsers block calls from web pages, and an API key in a web page would be public.

API keys

PrefixModeWhat it does
pv_test_testReturns a fixed sample SVG and never uses credits.
pv_live_liveConverts your image and uses API credits when the conversion succeeds.
  • Start with a test key. It runs the whole request at no cost: the key check, the file checks, the rate limits and the response shape work as they do in live mode.
  • Send the key only in the Authorization header: Authorization: Bearer <key>. A key in the URL is ignored, and the request fails with 401 invalid_api_key.
  • Keep the key out of your code. The examples read it from the PERFECTVECTOR_API_KEY environment variable.
  • We show a key once, when it is created. An account can have up to 10 active keys, live and test together.
  • GET /v1/account shows which key you are using, your API balance, prices and limits.

See Authentication and Test mode.

Endpoints

MethodPathWhat it doesCredits
POST/v1/vectorizationsConvert one image. Waits for the result, or answers at once and lets you poll.1 on success
GET/v1/vectorizations/{id}The conversion's status and result links.0
GET/v1/vectorizations/{id}/resultDownload the SVG.0
GET/v1/vectorizations/{id}/results/{index}Download the SVG of one result, by its position (0 in v1).0
DELETE/v1/vectorizations/{id}Delete the conversion's image and SVG now.0
GET/v1/accountYour API balance, prices, limits and the key you used.0

There is no endpoint that lists your conversions. Keep the id of each conversion you create.

  • Requests: POST /v1/vectorizations takes multipart/form-data with the field image (required) and the field options (optional; leave it out in v1). No other fields. The other endpoints take no body.
  • Responses: JSON, except the SVG itself. Errors are application/problem+json.
  • IDs: vec_… for conversions, key_… for keys, req_… for requests. Times are RFC 3339 in UTC.
  • Headers on every response: X-Request-ID and X-Credits-Charged.
  • New fields: we may add fields to responses. Ignore fields you do not know.

A complete example

Convert logo.png with a test key. Send an Idempotency-Key with every POST, so a retry after a network error never converts or charges twice:

Example request
curl https://api.perfectvector.com/v1/vectorizations \
  -H "Authorization: Bearer $PERFECTVECTOR_API_KEY" \
  -H "Idempotency-Key: logo-0001" \
  -F image=@logo.png

When the conversion has finished, the answer is 201 Created:

Example request
HTTP/1.1 201 Created
Content-Type: application/json
Location: /v1/vectorizations/vec_6Jd2LpQ8sV1nX4cR7tY0aB
X-Credits-Charged: 0
X-Credits-Would-Charge: 1
X-Request-ID: req_4Tq8WmX2r9LcB0vZs7KpY1
Example request
{
  "id": "vec_6Jd2LpQ8sV1nX4cR7tY0aB",
  "object": "vectorization",
  "mode": "test",
  "status": "succeeded",
  "request_type": "single",
  "created_at": "2026-10-26T09:30:12Z",
  "completed_at": "2026-10-26T09:30:12Z",
  "input": { "filename": "logo.png", "width": 1024, "height": 1024, "bytes": 182311 },
  "results": [
    {
      "index": 0,
      "status": "succeeded",
      "options": {},
      "result": {
        "format": "svg",
        "url": "https://api.perfectvector.com/v1/vectorizations/vec_6Jd2LpQ8sV1nX4cR7tY0aB/results/0",
        "expires_at": "2026-10-27T09:30:12Z"
      },
      "error": null
    }
  ],
  "result_counts": { "total": 1, "succeeded": 1, "failed": 0, "pending": 0 },
  "credits_charged": 0,
  "deleted_at": null
}

Download the SVG with the same API key. -OJ saves it under the name the API gives it (logo.svg):

Example request
curl -OJ https://api.perfectvector.com/v1/vectorizations/vec_6Jd2LpQ8sV1nX4cR7tY0aB/result \
  -H "Authorization: Bearer $PERFECTVECTOR_API_KEY"

A test key returns a fixed sample SVG and charges nothing; X-Credits-Would-Charge shows what a live key would have paid. With a live key (pv_live_…) the same request converts your image and uses 1 API credit when it succeeds.

Handle every answer

AnswerWhat to do
201 with "status": "succeeded"Download results[0].result.url with the same key. The result stays available for 24 hours, so keep your own copy.
202 AcceptedNot finished within the wait. Poll GET /v1/vectorizations/{id} about every 2 seconds until status is succeeded or failed.
201 with "status": "failed"No charge. results[0].error.code says why. Retry with a new Idempotency-Key.
4xx or 5xxAn error: see Errors below.
  • Waiting: POST /v1/vectorizations waits up to 120 seconds by default. Set your HTTP client's timeout above that, or send Prefer: wait=N (1 to 120 seconds) or Prefer: respond-async.
  • The SVG in one call: send Accept: image/svg+xml. When the conversion succeeds within the wait, the 201 body is the SVG itself. Check the Content-Type header before you save the body.
  • Retries: the same Idempotency-Key with the same image within 24 hours returns the same conversion, never charged twice. The same key with another image answers 409 idempotency_conflict. A key is 8 to 128 letters, digits, - and _.

Complete Python and Node.js programs that create, poll and save are in the Quickstart. See also Waiting and async, Idempotency and Results.

Prices

  • A live request uses 1 API credit when its conversion succeeds. GET /v1/account shows the current price in pricing.credits_per_request.
  • Free: failed and timed-out conversions; requests the API refuses, including 402, 429 and 503 answers; status checks, GET /v1/account and DELETE; downloading a result again while it is available; repeating a request with the same Idempotency-Key within 24 hours; every call with a test key.
  • API credits are separate from the credits used on the website, and the two never convert into each other. They are bought as one-time packs on the Developer API page, with no subscription and no automatic top-up.
  • There is no overdraft: when your available credits are lower than the price, POST /v1/vectorizations answers 402 insufficient_credits before any work starts.

The current API credit packs:

API credits are separate from website credits. A live API request uses 1 API credit only when its conversion succeeds; test keys are free. During the beta, every pack is 20% off at checkout; the regular price is listed for reference.

PackAPI creditsRegular pricePrice at checkoutPer conversionPacks per orderCredit expiry
Starter10USD 5.00USD 4.00USD 0.40up to 1012 months after purchase
Bulk 100100USD 20.00USD 16.00USD 0.16up to 1012 months after purchase
Bulk 1,0001000USD 100.00USD 80.00USD 0.08up to 1012 months after purchase

For 10000 API credits or more, email sales@perfectvector.com for custom pricing.

API pricing

Lemon Squeezy, our Merchant of Record, may add tax at checkout. See Credits.

Limits

LimitValueWhen you reach it
Conversions created per minute20429 rate_limited
POST /v1/vectorizations attempts per minute (every POST, also replays and refused requests)about 40429 rate_limited
Other requests per minute (status, downloads, DELETE, GET /v1/account)about 120429 rate_limited
Live conversions in progress at once1 (test keys: no limit)429 too_many_in_flight
Active API keys10, live and test together
File limitValue
FormatsPNG, JPEG, WebP (checked from the file's content, not its name)
File size5 MiB (5,242,880 bytes)
Image size100 to 4096 pixels on each side
FramesOne. Animated images are refused.
  • Limits apply to the whole account, across all of its keys. Test keys have their own counters.
  • One live conversion at a time. Send the next image when the first one has finished. Requests are not queued for you.
  • On 429 and 503, wait the Retry-After seconds, then retry with the same Idempotency-Key.
  • GET /v1/account returns your current limits in limits. If you need more, email contact@perfectvector.com.

See Limits.

Errors

Every error is RFC 9457 problem details, with Content-Type: application/problem+json. Branch on code, never on title or detail. Errors are never charged.

Example request
{
  "type": "https://perfectvector.com/docs/api/errors#insufficient_credits",
  "title": "Not enough API credits",
  "status": 402,
  "detail": "This request needs 1 API credit. Available: 0.",
  "code": "insufficient_credits",
  "request_id": "req_4Tq8WmX2r9LcB0vZs7KpY1",
  "credits_required": 1,
  "credits_available": 0
}
codeHTTPRetry?
invalid_request400After fixing the request
invalid_api_key401After fixing the key
insufficient_credits402After buying credits
account_suspended403No; contact us
access_not_granted403No; contact us
not_found404No
method_not_allowed405No
idempotency_conflict409With a new key
conversion_in_progress409After it finishes
result_not_ready409After it succeeds
result_expired410No
file_too_large413With a smaller file
unsupported_media_type415With PNG, JPEG or WebP
invalid_image422With another image
rate_limited429After Retry-After
too_many_in_flight429When the running one finishes
internal_error500Yes, with the same Idempotency-Key
service_busy503After Retry-After
api_paused503After Retry-After

A failed conversion is not an error: it answers 201 or 200 with "status": "failed", and costs nothing.

error.codeWhat to do
processing_failedCheck the image; another image may work.
timeoutRetry with a new Idempotency-Key.
provider_unavailableRetry later with a new Idempotency-Key.

A 403 or 429 whose body is not problem details comes from our network edge, not from the API. Slow down and retry later. See Errors for every code.

Privacy

From the API Privacy Notice: "Your images are never used to train AI models and never sold."

  • Results stay available for 24 hours after the conversion completes. We delete images and results from storage within 48 hours.
  • DELETE /v1/vectorizations/{id} deletes a conversion's image and SVG at once.
  • With a test key, we check the image and then discard it.

Terms and support

Reviewed