API documentation

Run ByLayer from your own code.

Everything you set up in ByLayer can run from a script, your own app or an automation platform: check, fill and print drawings, create reports and configure products, with the setups you already have.

Quick start

  1. In ByLayer, open your avatar menu → Account Settings → API Key →Create API Key. Copy the key: it is shown once. It starts with byl_live_.
  2. Send it on every call as Authorization: Bearer byl_live_… to https://api.bylayer.ai/v1.
  3. Start a run with a setup you made in ByLayer, then wait for it and download its files.
# 1. Check the key: who it acts as
curl https://api.bylayer.ai/v1/me \
  -H "Authorization: Bearer $BYLAYER_KEY"

# 2. Find a print profile
curl https://api.bylayer.ai/v1/plotter/profiles \
  -H "Authorization: Bearer $BYLAYER_KEY"

# 3. Print a drawing with it: answers 202 at once, with the run
curl https://api.bylayer.ai/v1/plotter/profiles/42/runs/upload \
  -H "Authorization: Bearer $BYLAYER_KEY" \
  -H "Idempotency-Key: order-1042" \
  -F "files=@A-101.dwg"

# 4. Wait for it: 202 while it runs, 200 with its files when done
curl https://api.bylayer.ai/v1/runs/1234/wait \
  -H "Authorization: Bearer $BYLAYER_KEY"

# 5. Download a file of the run
curl -L https://api.bylayer.ai/v1/files/5678/content \
  -H "Authorization: Bearer $BYLAYER_KEY" -o A-101.pdf

Every plan includes the API. A key acts as the person who made it, and never does more than their role in the company allows.

Keys and scopes

Send the key in the Authorization header, as Bearer byl_live_… (the key alone is accepted too). A key made in the portal lasts 30 days, 90 days or a year, as you choose; you can revoke it there at any time, and it stops working on the next call. Each person can have up to 20 keys.

Each call needs the key to hold one scope, listed for every operation in the reference:

ScopeAllows
readList and read setups, runs, sources, integrations, files and usage.
setupCreate and change setups (rulesets, mappings, print profiles, reports, configurations), their templates and samples.
runStart runs, fix issues, cancel and delete runs, and let watched folders and CRM triggers start runs (setting one up, turning its automatic runs on, resuming it). Runs spend credits.
connectionsAdd and remove sources and integrations, their folders and data access.
webhooksManage webhook subscriptions. Making or changing one needs read too.

A key can also be limited to some tools; calls to the others answer 403 tool_not_allowed, and so do /v1/runs calls on their runs, which its list leaves out. A file of another tool's run is not found for it, and a webhook or trigger it makes can be narrowed only to its own tools. Files of no run, sources, integrations, watched folders (/v1/connectors), usage and webhooks are otherwise reached by scope alone.

Runs

Work on drawings runs in the background. A call that starts a run answers 202 straight away with the run, a Location header pointing to /v1/runs/{id}/wait and aRetry-After in seconds.

{
  "id": 1234,
  "tool": "plotter",
  "status": "Running",
  "progressPercent": 40,
  "billableUnits": 1,
  "createdAt": "2026-11-25T10:02:11Z",
  "files": [],
  "nextPollAfterSeconds": 3
}
  • Statuses: Queued, Running, Succeeded, Failed, Cancelled.
  • GET /v1/runs/{id}/wait answers 202 while the run is going, 200 with the run and its files when it succeeded, and 422 run_failed or run_cancelled otherwise. Follow its Retry-After.
  • GET /v1/runs/{id} reads a run at any time; POST /v1/runs/{id}/cancel stops one.
  • DELETE /v1/runs/{id} deletes a finished run with the files it made and the files it was given; DELETE /v1/files/{id} deletes a file no run or setup uses (409 conflict while one does). Runs are kept for 90 days, unused files for 7.
  • Send an Idempotency-Key header when you start a run: a retry with the same key on the same address returns the first run and is charged once.
  • A run takes up to 200 drawings, each at most 50 MB.
  • GET /v1/runs lists runs of every tool, started anywhere: the portal, watched folders or the API.
ToolStart a runRead it with its results
Standardizer
Check drawings against a ruleset, and fix what it says how to fix.
POST /v1/standardizer/rulesets/{id}/runsGET /v1/standardizer/runs/{runId}
Auto Fill
Fill a DWG template from values, a workbook or CRM records.
POST /v1/auto-fill/mappings/{id}/runs/valuesGET /v1/auto-fill/runs/{runId}
Plotter
Print drawings to PDF with a print profile.
POST /v1/plotter/profiles/{id}/runsGET /v1/plotter/runs/{runId}
Report Generator
Fill your Excel report from drawings.
POST /v1/report-generator/reports/{id}/runsGET /v1/report-generator/runs/{runId}
Product Configurator
Configure a product from its form values and get the PDF.
POST /v1/product-configurator/configurations/{id}/runsGET /v1/product-configurator/runs/{runId}

The Standardizer, the Plotter and the Report Generator also take the drawings in the same call, at…/runs/upload (multipart, files parts); Auto Fill takes its data files there (workbooks, or text files of record ids). A run can instead take fileIds of uploaded files, or a folder of a connected source. The reference has every form.

Files

  • Upload: POST /v1/files, multipart with a file part, for files up to 100 MB.
  • Upload link, for larger files: ask for a link, PUT the bytes to it within an hour (no key needed), then complete it.
  • From an address: POST /v1/files/from-url with a public https address, up to 100 MB.
  • Download: GET /v1/files/{id}/content with the key, orPOST /v1/files/{id}/links for a link that works without the key for 10 minutes.
# Ask for a link, PUT the bytes to it (no key), then complete it
curl https://api.bylayer.ai/v1/files/uploads -H "Authorization: Bearer $BYLAYER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileName":"site-plan.dwg","sizeBytes":184320000}'
# → { "uploadId": "...", "uploadUrl": "https://...", "method": "PUT", "headers": {...}, "completePath": "..." }

curl -X PUT "$UPLOAD_URL" -H "x-ms-blob-type: BlockBlob" --data-binary @site-plan.dwg

curl -X POST https://api.bylayer.ai/v1/files/uploads/$UPLOAD_ID/complete -H "Authorization: Bearer $BYLAYER_KEY"
# → the file, with the id a run takes in "fileIds"

Accepted: .dwg, .xlsx, .xlsm, .xls, .csv, .txt. The type is read from the file name.

Webhooks

Instead of waiting on a run, let ByLayer call you. POST /v1/webhooks with your https address and the events you want; you can narrow it to one tool or one setup. The answer holds the signing secret (whsec_…), shown once.

EventWhen
run.succeededA run finished; the event carries the run and its files.
run.failedA run failed, with its error message.
run.cancelledA run was cancelled.
source.needs_reauthA cloud storage connection needs signing in again (at most daily).
integration.needs_reauthA CRM or data app connection needs signing in again (at most daily).
credits.lowCredits are running low (at most daily).
connection.completedA sign-in started through the API finished.
connection.failedA sign-in started through the API failed.
webhook.testSent by POST /v1/webhooks/{id}/test.

Each delivery is a POST of { id, type, createdAt, data } with the headersByLayer-Event, ByLayer-Delivery and ByLayer-Signature. The event'sid is the same on every retry, so you can drop repeats. Check the signature before you trust a call: an HMAC-SHA256 of "<t>.<raw body>" keyed with the whole secret.

import crypto from 'node:crypto';

// header: the ByLayer-Signature header, "t=1764064931,v1=5f2c…"
// body: the raw request body, exactly as received
// A missing or malformed header is false, never an exception.
export function isFromByLayer(header, body, secret) {
  const parts = Object.fromEntries((header ?? '').split(',').map((p) => p.split('=')));
  const t = Number(parts.t);
  if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false; // no time, or older than 5 minutes
  const expected = Buffer.from(crypto.createHmac('sha256', secret).update(`${parts.t}.${body}`).digest('hex'));
  const given = Buffer.from(parts.v1 ?? '');
  return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}
  • Answer with any 2xx within 10 seconds. Otherwise the call is retried after 1 minute, 5 minutes, 30 minutes, 1 hour, 3 hours and then every 6 hours, for up to 24 hours; after that, if no delivery reached the webhook in those 24 hours, it is turned off and you are emailed.
  • Answer 410 Gone to stop deliveries for good: the webhook is turned off at once.
  • GET /v1/webhooks/{id}/deliveries shows recent attempts; POST /v1/webhooks/{id}/test sends a webhook.test; POST /v1/webhooks/{id}/rotate-secret replaces the secret.
  • Up to 10 webhooks per person.
  • A webhook lasts as long as the key that made it: once that key is revoked or has expired, it is sent nothing more and is no longer listed.

Errors

Errors are application/problem+json with a stable code to branch on and amessage to show a person. A field that is wrong is listed in errors with its path in your request.

{
  "type": "about:blank",
  "title": "Bad request",
  "status": 400,
  "code": "validation_failed",
  "detail": "Give either source or fileIds.",
  "message": "Give either source or fileIds.",
  "instance": "/v1/plotter/profiles/42/runs",
  "traceId": "00-4bf92f…",
  "errors": [
    { "path": "source", "code": "required", "message": "Give either source (a folder of a connected source) or fileIds (uploaded files)." }
  ]
}
StatusCodeMeans
400validation_failedA field is wrong; errors[] says which, where and what is allowed.
400invalid_requestThe request cannot be read.
401unauthorizedNo key was sent.
401invalid_api_keyThe key is wrong. Also api_key_revoked, api_key_expired, user_inactive, left_organization.
402insufficient_creditsNot enough credits to start the run.
403billing_suspendedThe billing account is suspended, so a run cannot start.
403missing_scopeThe key lacks the scope the call needs; the message names it.
403tool_not_allowedThe key is limited to other tools.
404not_foundNo such resource, or not one this key may see.
409conflictThe setup changed since the baseVersion the save sent; read it again and save on that version.
413file_too_largeThe file is over the limit. A JSON body over 4 MB gives payload_too_large.
413storage_fullFrom the /files uploads: the account already stores 10 GB of files that no run used. They are deleted after 7 days; DELETE /v1/files/{id} frees room now.
422run_failedFrom /runs/{id}/wait: the run failed (run_cancelled when cancelled).
429rate_limitedToo many calls; wait the seconds in Retry-After.

Send us the traceId when you write about an error: it finds the call on our side.

Limits and pages

  • 600 calls a minute per key. Calls that start work (runs, scans, previews, fixes, a Plotter template or a report's sample drawing, files from an address, webhook tests) have their own limit of 60 a minute, and /runs/{id}/wait its own of 1,200. All of a person's keys and the portal together make at most 10,000 requests a minute.
  • A person has at most 20 connection links at once (each is kept for an hour). A new one takes the place of the oldest that is no longer waiting, which answers 404 from then on; while all 20 are still waiting to be finished, the next answers 429 too_many_pending_connections.
  • Over a limit the call answers 429 rate_limited with Retry-After in seconds.
  • Setup steps that cost nothing (scans, learning, a Plotter template's page setups, previews, test reports) are also limited to 5 waiting or running per person: the next one answers 429 rate_limited until one has finished.
  • A preview's and a test report's files are marked PREVIEW: a Configurator preview is the print's PDF with the mark on every page (the filled drawing is not handed out), a test report's workbook and PDF carry it on every sheet and page. Files without the mark come from a run. A person can make 20 test reports in 24 hours; the next answers 429 rate_limited.
  • A JSON body may be up to 4 MB; drawings go as files. A setup document (a mapping, rules, a profile, a report, a configuration) may be up to 100,000 characters.
  • An answer lists at most 100 errors, the first ones; a refusal's message counts them all.
  • Lists of runs are paged: pass limit (1–100, 20 by default) and the cursor from the last answer's nextCursor, until it is null. Lists of setups come whole.
  • The API is versioned in its address. Within /v1, nothing you rely on is removed or renamed; new fields and operations are added.
Next

Every endpoint, model and scope

The reference is drawn from the API's own OpenAPI document, so it is always what the API does today.

Help

Stuck on something?

Write to josip@bylayer.ai with the run ID or the error'straceId, or see Support. Your keys are inAccount Settings.