String Art AppAPI

String Art API

String art patterns, from one API call.

Send a photo and a few settings. Get back the same patterns String Art App makes: the nail sequence, a preview, a printable nail template and a step-by-step PDF. You own what you generate, including for commercial use.

  • Round black: 4 patterns for the price of 1
  • 25 free test patterns a month
  • Failed calls are never charged
photo.jpg

POST /api/v1/patterns

1 call, billed as 1 pattern

Pattern made with Algorithm A

AAlgorithm A

Pattern made with Algorithm B

BAlgorithm B

Pattern made with Algorithm C

CAlgorithm C

Pattern made with Algorithm D

DAlgorithm D

each: sequence · preview · PDF, + one nail template.pdf

What every call returns

  • Nail sequence

    Every nail in order, numbered from 1 like the printed template, plus wrap directions.

  • Preview image

    A true-to-life JPG of the finished piece to show your customer.

  • Nail template

    A printable PDF at real size, so nails land in the right place.

  • Step-by-step PDF

    The full sequence laid out for building by hand.

How it works

  1. 01

    Create a key

    Sign in with your String Art App account. Sandbox keys are free.

  2. 02

    Send a photo

    Shape, size, nails, lines and thread color. The call answers right away with a pattern id.

  3. 03

    Get the pattern

    Most are ready in 5 to 20 seconds. Check back, or get a webhook.

Free with every pattern

Show the build, thread by thread

Add our free player to your page and any pattern strings itself in front of your customer, the way it will on their wall. Switch between the algorithms, scrub to any thread, or slow it down.

  • One script tag, no video files
  • Runs in the browser, so it never calls the API or uses up patterns
  • Circle or rectangle, black, white or color thread
Add it to your site

Pricing

Pay per pattern. Never for failures.

One pattern is one call that succeeds. Failed calls are never charged.

4 for the price of 1

Every round black pattern comes with all four algorithms

Black and white thread patterns, round or rectangular, are made with all four algorithms, A to D: four different looks from the same photo, and you pay for one pattern. Show your customer all four and let them pick. Want only one? Name it and the pattern is ready sooner, at the same price. Color patterns use one algorithm.

Starter

$29/ month

100 patterns included

Round black: all 4 each

  • $0.40 per extra pattern
  • 20 new patterns a minute
  • 2 running at once

Business

$349/ month

2,500 patterns included

Round black: all 4 each

  • $0.15 per extra pattern
  • Webhooks
  • 120 new patterns a minute
  • 10 running at once

Enterprise

$1,000+/ month

Custom volume and terms

  • 20 running at once
  • Volume pricing
  • Direct support
Contact us

Sandbox Free

25 test patterns a month to build your integration. Previews and PDFs are stamped “SANDBOX” and are not for production use or sale. 5 new patterns a minute, 1 at a time.

Get a free key

Pattern pack $25 once

50 patterns with no stamp, ready to sell, valid for 12 months. No subscription. 20 new patterns a minute, 2 at a time.

Plans renew monthly and can be switched any time (the difference is prorated). Unused included patterns do not roll over. Pack credits are used before overage on a plan. Prices are in US dollars; tax is added where it applies.

Your API

Keys, usage and billing

Docs

Everything you need to integrate

Quick start

  1. Create a key in Your API.
  2. Send a photo. The call answers right away with a pattern id and status: "queued".
  3. Check the pattern until status is succeeded (most take 5 to 20 seconds), or use a webhook.
# 1. Send a photo
curl https://stringartapp.com/api/v1/patterns \
  -H "Authorization: Bearer $STRINGART_KEY" \
  -H "Idempotency-Key: order-1042" \
  -F image=@photo.jpg \
  -F 'settings={"shape":"circular","nails":220,"lines":3000,"diameter_cm":60}'

# 2. Read it back until status is "succeeded"
curl https://stringartapp.com/api/v1/patterns/pat_... \
  -H "Authorization: Bearer $STRINGART_KEY"

You can also send JSON with a public image_url (or image_base64) instead of a file:

JSON body
curl https://stringartapp.com/api/v1/patterns \
  -H "Authorization: Bearer $STRINGART_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_url":"https://example.com/photo.jpg","shape":"rectangular","width_cm":40,"height_cm":50,"lines":4000}'

Idempotency-Key is optional but recommended: sending the same key again returns the first pattern instead of making (and charging for) a new one.

Settings

The same options as the app. Anything you leave out uses the app's default. Unknown settings are refused, so a typo never silently changes a pattern.

SettingValuesDefault
shapecircular or rectangularcircular
colorblack, white (on a dark board), color, or black_white (black and white thread together on the board you choose)black
boardblack_white only: white or black boardwhite
nailsWhole number, 120 to 350220
linesWhole number, 1,000 to 12,0003000 (2000 for white, 12000 for black_white: it stops by itself once more thread no longer helps)
thread_thickness_mm0.10 to 2.00, in 0.01 steps0.2
diameter_cmCircular only. 20 to 200, in 0.1 steps60
width_cm, height_cmRectangular only. 20 to 200, in 0.1 steps60 × 60
nail_diameter_mmBlack and white thread. 0.5 to 6, in 0.1 steps. Nails plus thread must fit between neighbouring nails.2
algorithmBlack and white thread: all returns all four algorithms, A to D (the app's four tabs, A is the newest). A, B, C or D returns only that one, sooner. Either way it is one pattern.all
remove_backgroundBlack and white thread: true puts the main subject on a plain backdrop, as the app does; false keeps the photo's backgroundtrue
nail_layoutRectangular black or white: uniform or ruler-v2uniform
paletteColor only: cmyk, rgb or customcmyk
custom_colorsWith palette: "custom": 2 to 6 colors like "#1A2B3C"None
crop{"x","y","width","height"} as fractions of the photo (0 to 1). Without it the photo is centre-cropped to the frame.None
webhook_urlPublic https:// address to call when the pattern is done (Growth and Business)None

Photos: JPEG, PNG, WebP, GIF or HEIC, up to 12 MB and 8 million pixels. Photos are deleted as soon as the pattern is made. Patterns and files are kept for 7 days.

Results

A finished pattern has one entry in results per algorithm, plus file links: four for a black or white pattern, round or rectangular (one if you named an algorithm), and one for color. Nails are numbered from 1, as on the printed template.

GET /api/v1/patterns/{id}
{
  "id": "pat_8fK2...",
  "object": "pattern",
  "status": "succeeded",            // queued, running, succeeded or failed
  "progress": 100,
  "billed_as": "plan",              // plan, overage, pack or sandbox
  "settings": { "shape": "circular", "color": "black", "algorithm": "all", "nails": 220, ... },
  "results": [
    {
      "algorithm": "A",
      "nails": 220,
      "lines": 3000,
      "sequence": [1, 97, 12, ...],          // lines + 1 nail numbers
      "wraps": ["cw", "ccw", ...],           // circular black: which way to wrap each nail
      "thread_length_m": 1843.6,
      "background_removed": true,            // circular black: the subject was found and put on a plain backdrop
      "nail_positions_mm": [[300, 0], ...]   // mm from the frame centre, x right, y down
    },
    { "algorithm": "B", ... }, { "algorithm": "C", ... }, { "algorithm": "D", ... }
  ],
  "files": {
    "A": { "preview_jpg": { "url": "...", "signed_url": "..." }, "sequence_pdf": { ... } },
    "B": { ... }, "C": { ... }, "D": { ... },
    "template_pdf": { "url": "...", "signed_url": "..." }
  },
  "expires_at": "2026-11-16T10:00:00Z"
}

url downloads the file with your API key. signed_url works without a key for one hour, so you can hand it to a browser. Color and black_white patterns also list palette, line_colors (one per line), strands (the sequence for each color) and color_changes; black_white patterns also give their board.

POST/api/v1/patternsMake a pattern
GET/api/v1/patterns/{id}Read one pattern
GET/api/v1/patternsRecent patterns (limit, before)
GET/api/v1/accountYour plan and usage

Animation player Free

Every pattern already holds what it takes to replay the build: the nail positions and the sequence. The player draws it on a canvas in your visitor's browser at the true thread width, with the thread being pulled shown in amber. It never calls the API, so it costs nothing and needs no key.

HTML
<script src="https://stringartapp.com/static/api/string-art-player-v1.js"></script>

<string-art-player id="build" controls autoplay></string-art-player>

<script>
  // The pattern JSON from GET /api/v1/patterns/{id}, passed on by your server.
  // Never put your API key in a web page.
  document.getElementById('build').pattern = patternJson;
</script>

Or point src at a URL on your own server that returns the pattern JSON. To try it now, use our sample: src="https://stringartapp.com/static/api/sample-pattern.json". You can also download the script and host it yourself.

AttributeWhat it doesDefault
srcURL of a pattern JSON to load (or set the pattern property)None
algorithmWhich result to play: A, B, C or D. With more than one in the pattern, the controls show a switch.A
controlsPlay/pause, a thread slider, the thread count and speedOff
autoplay, loopStart when on screen; start over after a short pause. Without autoplay it shows the finished piece.Off
durationSeconds to string the whole pattern at 1× speed30
easinglinear (steady, for following along) or showcase (a few threads first, then it fills in)linear
background, thread-colorOverride the board and thread colors. By default the board is white, or near black for white thread.From the pattern
show-nailsfalse hides the nail dotstrue

From script: play(), pause(), seek(line), and the line, lines, speed and playing properties. Events: load, play, pause, progress (with line, from and to nail numbers, and color) and end. Style it with the CSS variables --sap-accent, --sap-bar and --sap-text, or the ::part(controls) and ::part(canvas) selectors.

Drawing it in a native app

On iOS or Android, draw the same thing with your own canvas (Core Graphics, SwiftUI Canvas, Android Canvas or Compose):

  1. Take the frame size from settings: a circle of diameter_cm, or width_cm × height_cm. Positions in nail_positions_mm are millimetres from the frame centre, with x to the right and y down.
  2. Pick a scale so the frame fits your view: scale = 0.975 × view size ÷ frame size in mm. A nail lands at centre + position × scale.
  3. Fill the board white (or near black for color: "white"). Set the line width to thread_thickness_mm × scale, times 0.65 for circular black, as the app draws it.
  4. For each thread i from 1 to lines, stroke one line from nail sequence[i-1] to nail sequence[i], in black, white, or line_colors[i-1] for color. Skip it when that color is null, because the thread jumps behind the board there. Use one stroke per thread so crossings get darker the way real thread does.
  5. To animate, add a few threads every frame and keep the board between frames rather than redrawing it.

Webhooks Growth and Business

Add webhook_url to a request and we POST to it when the pattern finishes (up to 3 tries):

Webhook body
{"type": "pattern.succeeded", "pattern_id": "pat_8fK2...", "created": 1762682400}

Then fetch the pattern for its results. Check the StringArt-Signature header, t=<unix time>,v1=<hex>, where v1 is HMAC-SHA256 of t + "." + body with your webhook signing secret:

Node.js
const [t, v1] = header.split(',').map(part => part.split('=')[1]);
const expected = crypto.createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex');
const valid = crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected))
  && Math.abs(Date.now() / 1000 - Number(t)) < 300;

Errors and limits

Errors use HTTP status codes and a JSON body like {"error": {"code": "invalid_settings", "message": "...", "field": "nails"}}.

StatusCodeMeaning
400invalid_settings invalid_image invalid_requestFix the request; field names the setting.
401invalid_keyMissing, wrong or revoked key.
402quota_exhausted spend_cap_reachedOut of free or pack patterns, or your spending limit is reached.
403webhooks_unavailableWebhooks need Growth or Business.
409idempotency_conflictThat Idempotency-Key was used for a different request.
413invalid_imageThe photo is over 12 MB.
429rate_limited too_many_jobsToo many new patterns a minute for your plan, more than 120 status checks and downloads a minute per key, or too many patterns running at once. Retry after a short wait.
503unavailableTemporary. Retry with the same Idempotency-Key.

A pattern that fails after it was accepted has status: "failed" and an error; it is not charged.

Questions

Who owns the patterns I generate?

You do, including for commercial use. Sell kits, prints or finished pieces made from paid patterns. Sandbox patterns are stamped and are only for testing.

What do I get for one black pattern?

For a black or white thread pattern, round or rectangular, four for the price of one: all four algorithms (A, B, C and D) come back, each with its own sequence, preview and step-by-step PDF, billed as one pattern.

Can my customers watch their piece being strung?

Yes. Our free animation player replays any pattern thread by thread on your page, with a switch between algorithms, speed and a slider. It runs in the browser from the pattern you already have, so it never uses up patterns.

Am I charged when a pattern fails?

No. Only patterns that succeed count. A damaged photo or a failed run is refunded automatically, and a repeated Idempotency-Key never charges twice.

What happens to the photos I send?

Photos are deleted as soon as the pattern is made. Patterns and their files are kept for 7 days, so download what you need to keep.

Can I control what I spend?

Yes. Set a monthly spending limit in Your API and new patterns stop once you reach it. You can also stick to packs, which never bill more than you bought.

Can packs refill themselves?

Yes. Turn on Auto top-up in Your API and pick 5 or 10 patterns. When your pack balance falls that low, we buy another 50-pattern pack with the card you saved through Stripe and email you a note. If the card is declined or your bank asks you to confirm the payment, auto top-up turns itself off and we let you know. Turn it off any time.

How do I cancel or change plans?

Switch plans from Your API; the difference is prorated. Cancel or update your card from “Manage billing”.

I need more volume or a custom setup.

Email support@stringartapp.com and we will put together an Enterprise plan.

Start building for free

25 sandbox patterns a month. No card needed.

Get a free API key