Skip to content

Quick Start ​

This page takes you from a new API key to a marked-up PDF. Every command was run against a real server; the answers are shortened only where noted.

Before you start ​

You need:

  • A Plan Count account with a verified email address
  • A few credits (the example uploads a 2-page drawing, which costs 2 credits, and exports one page, which costs 1 credit)
  • curl, and optionally jq to read the answers

1. Create a key ​

  1. Open the Account page and find API keys.
  2. Click Create API key, name it, choose the Personal workspace and tick Read, Upload and Edit.
  3. Click Create key and copy the key. It starts with pc_live_ and is shown only once.

Put it in your shell. The examples use $KEY and https://api.plancount.ai:

bash
export KEY=pc_live_YOUR_KEY
export API=https://api.plancount.ai/api/v1   # the REST API's base address

Check that it works:

bash
curl -s $API/me -H "Authorization: Bearer $KEY"
json
{"userId":"8db9747b-2186-44a1-b174-762f07d64078","workspace":{"type":"personal"},"scopes":["read","upload","edit"],"keyPrefix":"pc_live_AbCd"}

2. Check the price, then upload a drawing ​

Uploading costs 1 credit for each page. Ask first:

bash
curl -s "$API/credits/estimate?operation=upload&pages=2" -H "Authorization: Bearer $KEY"
json
{"operation":"upload","credits":2,"available":20,"sufficient":true,"keyDailyLimit":{"limit":null,"used":0,"held":0,"remaining":null,"nextReleaseAt":null}}

Upload level1.pdf as a new project. max_credits refuses the upload, before anything is charged, if it would cost more than you expect. Idempotency-Key makes it safe to send the same request again if the connection drops.

bash
curl -s -X POST $API/projects \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: quickstart-1" \
  -F name="Level 1" \
  -F max_credits=5 \
  -F "pdf=@level1.pdf;type=application/pdf"
json
{
  "project": {
    "id": "983f904f-8a92-50c0-a20c-a1cd90780943",
    "name": "Level 1",
    "status": "ACTIVE",
    "pdfCount": 1,
    "pageCount": 2,
    "stateVersion": 1,
    "updatedAt": "2026-11-27T12:47:58.292Z",
    "pdfs": [
      {
        "id": "7d205b92-8fe6-4e5b-a5de-d08ad552799d",
        "filename": "level1.pdf",
        "pageCount": 2,
        "pages": [
          { "page": 1, "width": 842, "height": 595, "rotation": 0 },
          { "page": 2, "width": 842, "height": 595, "rotation": 0 }
        ]
      }
    ]
  },
  "credits": { "charged": 2, "balance": 18 },
  "textDetection": { "status": "detected", "symbols": 9 }
}

Save the two ids:

bash
export PROJECT=983f904f-8a92-50c0-a20c-a1cd90780943
export PDF=7d205b92-8fe6-4e5b-a5de-d08ad552799d

A new project starts with the default Lighting detection rules, and the server has already found the symbols: "symbols": 9. Nothing needs to be opened in the app first.

3. Read the counts ​

bash
curl -s $API/projects/$PROJECT/counts -H "Authorization: Bearer $KEY"
json
{"stateVersion":1,"total":9,"byLabel":[{"label":"D1","type":"LIGHTING","count":1},{"label":"D2","type":"LIGHTING","count":1},{"label":"D3","type":"LIGHTING","count":1},{"label":"L1","type":"LIGHTING","count":1},{"label":"L2","type":"LIGHTING","count":1},{"label":"L3","type":"LIGHTING","count":1},{"label":"L4","type":"LIGHTING","count":1},{"label":"L5","type":"LIGHTING","count":1},{"label":"S1","type":"LIGHTING_CONTROL","count":1}],"byType":[{"type":"LIGHTING","count":8},{"type":"LIGHTING_CONTROL","count":1}]}

These are the same numbers the app shows. stateVersion rises by one every time the project's contents change (symbols, pages, rules, zones, measurements, annotations, legends). Renaming the project does not change it. Adding a drawing changes it only when symbols are detected on the new drawing.

4. Look at a page ​

Page text comes with positions, so an agent can find a symbol on the page:

bash
curl -s $API/projects/$PROJECT/pdfs/$PDF/pages/1/text -H "Authorization: Bearer $KEY"
json
{"page":1,"width":842,"height":595,"items":[{"str":"Level 1 lighting plan","x":40,"y":21,"width":123.732,"height":14},{"str":"L1","x":100,"y":85,"width":11.12,"height":10},{"str":"L2","x":250,"y":85,"width":11.12,"height":10}]}

(The answer is shortened to the first three items.) Positions are in page units from the top-left corner. See Coordinates.

To see the page itself, ask for an image. The answer is a PNG, and the headers tell you how pixels map to page units:

bash
curl -s -D - "$API/projects/$PROJECT/pdfs/$PDF/pages/1/image?dpi=72" \
  -H "Authorization: Bearer $KEY" -o page1.png
HTTP/1.1 200 OK
Content-Type: image/png
X-Page-Width: 842
X-Page-Height: 595
X-Scale: 1

5. Place a symbol ​

Place one symbol, centred at (600, 300) on page 1, under the lighting rule. expectedVersion makes the request fail if anyone changed the project since version 1:

bash
curl -s -X POST $API/projects/$PROJECT/symbols/batch \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"ops":[{"op":"place","pdfId":"'$PDF'","page":1,"ruleId":"lighting","center":{"x":600,"y":300},"label":"L9"}],"expectedVersion":1}'
json
{"stateVersion":2,"results":[{"id":"manual-3924acda-3e75-4f77-8d99-1de8d5d94e55","pdfId":"7d205b92-8fe6-4e5b-a5de-d08ad552799d","page":1,"x":594,"y":295,"width":12,"height":10,"center":{"x":600,"y":300},"type":"LIGHTING","label":"L9","ruleId":"lighting","color":"#eab308","isManual":true,"source":"api","removed":false}]}

Open the project in the app. The new L9 symbol is on page 1. If the project was already open in a browser tab, the tab picks the change up within about 10 seconds while it is visible, once you are not in the middle of an edit, without reloading.

The counts now show 10 symbols.

6. Exclude a page and add an exclusion zone ​

Leave page 2 out of the takeoff:

bash
curl -s -X POST $API/projects/$PROJECT/page-setup/batch \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"ops":[{"op":"excludePages","pdfId":"'$PDF'","pages":[2]}]}'
json
{"stateVersion":3,"results":[{"op":"excludePages","pdfId":"7d205b92-8fe6-4e5b-a5de-d08ad552799d","excludedPages":[2]}]}

Page 2 held three symbols, so the total drops from 10 to 7.

Now add an exclusion zone around the symbol you placed. Symbols whose centre is inside an exclusion zone are removed from every total:

bash
curl -s -X POST $API/projects/$PROJECT/zones/batch \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"ops":[{"op":"create","type":"EXCLUSION","name":"Plant room","pdfId":"'$PDF'","page":1,"points":[{"x":550,"y":250},{"x":700,"y":250},{"x":700,"y":350},{"x":550,"y":350}]}]}'
json
{"stateVersion":4,"results":[{"op":"create","id":"186olp4bg","zone":{"id":"186olp4bg","pdfId":"7d205b92-8fe6-4e5b-a5de-d08ad552799d","page":1,"name":"Plant room","type":"EXCLUSION","points":[{"x":550,"y":250},{"x":700,"y":250},{"x":700,"y":350},{"x":550,"y":350}],"visible":true,"color":"#ef4444","area":{"squareMeters":18.667824074074073,"value":18.667824074074073,"unit":"m2","formatted":"19 m²","scaleIsDefault":true}}}]}

7. Read the takeoff ​

The takeoff holds symbol totals, zones with their areas, and line and ring lengths. It is free:

bash
curl -s "$API/projects/$PROJECT/takeoff?pdfId=$PDF&page=1" -H "Authorization: Bearer $KEY"

The symbols total is now 6: ten symbols, minus the three on the excluded page, minus the one inside the exclusion zone. An exclusion zone has no area or symbol list in the takeoff. See REST API for the full shape.

8. Export the marked-up PDF ​

Ask what the export costs. It is priced the same way the app prices it:

bash
curl -s "$API/projects/$PROJECT/exports/estimate?format=pdf&pdfId=$PDF" -H "Authorization: Bearer $KEY"
json
{"format":"pdf","pages":1,"credits":1,"unlimitedExports":false,"available":18,"sufficient":true,"keyDailyLimit":{"limit":null,"used":2,"held":0,"remaining":null,"nextReleaseAt":"2026-11-28T12:47:57.773Z"}}

Make the export. The Idempotency-Key is for retrying this same request after a dropped connection: for 24 hours the same key returns this first export, even if the project has changed, so use a new key for each new export. Only page 1 has symbols that count, so it is 1 page and 1 credit:

bash
curl -s -X POST $API/projects/$PROJECT/exports \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: quickstart-export-1" \
  -d '{"format":"pdf","pdfId":"'$PDF'","max_credits":2}'
json
{"export":{"id":"ae7c1d85-0c71-5111-8b4a-2a7311df6ea2","format":"pdf","pdfIds":["7d205b92-8fe6-4e5b-a5de-d08ad552799d"],"stateVersion":4,"pages":1,"sizeBytes":3428,"filename":"takeoff_level1.pdf","createdAt":"2026-11-27T12:48:27.454Z","expiresAt":"2026-12-04T12:48:27.454Z","downloadUrl":"/api/v1/projects/983f904f-8a92-50c0-a20c-a1cd90780943/exports/ae7c1d85-0c71-5111-8b4a-2a7311df6ea2/file"},"credits":{"charged":1,"balance":17}}

Download it. You can download the same export again, free, until expiresAt (7 days):

bash
curl -s -D - $API/projects/$PROJECT/exports/ae7c1d85-0c71-5111-8b4a-2a7311df6ea2/file \
  -H "Authorization: Bearer $KEY" -o takeoff_level1.pdf
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="takeoff_level1.pdf"

9. Check your credits ​

bash
curl -s "$API/credits/transactions?limit=5" -H "Authorization: Bearer $KEY"
json
{"transactions":[{"id":"90b88b24-3eb6-44d2-93d6-ed6337a9cac4","amount":-1,"type":"EXPORT_PDF","description":"PDF export: takeoff_level1.pdf (1 pages)","projectId":"983f904f-8a92-50c0-a20c-a1cd90780943","createdAt":"2026-11-27T12:48:27.453Z"},{"id":"18799772-e03a-4986-9cda-cd98d239e486","amount":-2,"type":"PDF_UPLOAD","description":"PDF upload - 2 page(s)","projectId":null,"createdAt":"2026-11-27T12:47:57.773Z"}]}

The upload cost 2 credits, the export 1. Everything else in this walkthrough was free.

Next steps ​

Plan Count User Guide