{"openapi":"3.1.0","info":{"title":"Plan Count API","version":"1","description":"Read and edit Plan Count takeoffs from scripts and agents. Errors are `{ \"error\": { \"code\", \"message\", \"details\"? } }`. Amounts are credits."},"servers":[{"url":"/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key from the Account page (pc_live_…), sent as `Authorization: Bearer <key>`. Each operation names the scope it needs."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"]}},"required":["error"]},"ProjectDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"},"pdfs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"pageCount":{"type":["integer","null"],"minimum":0},"pages":{"type":["array","null"],"items":{"type":"object","properties":{"page":{"type":"integer","exclusiveMinimum":0},"width":{"type":"number"},"height":{"type":"number"},"rotation":{"type":"integer"}},"required":["page","width","height","rotation"]}},"error":{"type":"object","properties":{"code":{"type":"string","enum":["PDF_PROCESSING_FAILED","PDF_BUSY"]},"message":{"type":"string"},"retryable":{"type":"boolean"}},"required":["code","message","retryable"]}},"required":["id","filename","pageCount","pages"]}}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt","pdfs"]},"SymbolOpIssue":{"type":"object","properties":{"index":{"type":"integer"},"code":{"type":"string","enum":["INVALID_BATCH","PDF_NOT_IN_PROJECT","PAGE_OUT_OF_RANGE","OUT_OF_BOUNDS","RULE_NOT_FOUND","SYMBOL_NOT_FOUND","SYMBOL_REMOVED","SYMBOL_REPLACED_BY_AI","INVALID_SIZE"]},"message":{"type":"string"}},"required":["index","code","message"]},"StateOpIssue":{"type":"object","properties":{"index":{"type":"integer"},"code":{"type":"string","enum":["INVALID_BATCH","PDF_NOT_IN_PROJECT","PAGE_OUT_OF_RANGE","OUT_OF_BOUNDS","NOT_FOUND","INVALID_COLOR","TEXT_TOO_LONG","INVALID_VALUE","LIMIT_REACHED","DUPLICATE_REF","UNKNOWN_REF","RULE_KIND_MISMATCH","INVALID_PATTERN","UNSUPPORTED_PATTERN"]},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{}}},"required":["index","code","message"]}},"parameters":{}},"paths":{"/me":{"get":{"summary":"Who this key acts as","description":"The key's owner, workspace, scopes and prefix.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"responses":{"200":{"description":"The key","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid"},"workspace":{"type":"object","properties":{"type":{"type":"string","enum":["personal","team"]},"teamId":{"type":"string","format":"uuid"}},"required":["type"]},"scopes":{"type":"array","items":{"type":"string","enum":["read","upload","edit","ai"]}},"keyPrefix":{"type":"string"}},"required":["userId","workspace","scopes","keyPrefix"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects":{"get":{"summary":"List projects","description":"Projects in the key's workspace, newest first, every status. Page with `cursor` = the previous page's `nextCursor`.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[0-9]{1,15}$"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"A page of projects","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["projects","nextCursor"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a project from a PDF","description":"Creates a project in the key's workspace with the Lighting drawing profile and its default rules, from one PDF. Costs 1 credit per page, counted by the server, charged to the key's workspace. The drawing's text is then matched against the project's rules and the symbols found are stored, so counts are available at once; `textDetection` says how that went. When it is `not_run` or `failed`, the upload still succeeded and the app finds the symbols when the drawing is first opened.\n\nRequired scope: `upload`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"Optional. The same key with the same request within 24 hours returns the first response and charges once; with a different request it is 422."},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","description":"The PDF","format":"binary"},"name":{"type":"string","minLength":1,"maxLength":255},"max_credits":{"type":"integer","minimum":0,"description":"Refuse (402 MAX_CREDITS_EXCEEDED, nothing charged) when the upload would cost more credits than this"},"pages":{"type":"string","description":"Optional. Keep only these pages of the file, as the app's upload page picker does: page numbers and ranges separated by commas, e.g. `1,3,5-7`. Each page once, each in the file. The kept pages are stored in file order as a new drawing numbered from 1, and only they are charged. Not valid: 400 INVALID_PAGE_SELECTION, nothing charged. Pages cannot be selected from an encrypted PDF, including one only secured against changes (400 INVALID_PDF, nothing charged); upload such a file whole, without `pages`.","example":"1,3,5-7"}},"required":["pdf","name"]}}}},"responses":{"201":{"description":"The project and the credits charged","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"},"pdfs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"pageCount":{"type":["integer","null"],"minimum":0},"pages":{"type":["array","null"],"items":{"type":"object","properties":{"page":{"type":"integer","exclusiveMinimum":0},"width":{"type":"number"},"height":{"type":"number"},"rotation":{"type":"integer"}},"required":["page","width","height","rotation"]}},"error":{"type":"object","properties":{"code":{"type":"string","enum":["PDF_PROCESSING_FAILED","PDF_BUSY"]},"message":{"type":"string"},"retryable":{"type":"boolean"}},"required":["code","message","retryable"]}},"required":["id","filename","pageCount","pages"]}}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt","pdfs"]},"credits":{"type":"object","properties":{"charged":{"type":"integer","minimum":0},"balance":{"type":"integer"},"bonus":{"type":"integer","minimum":0}},"required":["charged","balance"]},"textDetection":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["detected"]},"symbols":{"type":"integer","minimum":0}},"required":["status","symbols"]},{"type":"object","properties":{"status":{"type":"string","enum":["not_run"]},"reason":{"type":"string","enum":["TOO_MANY_RULES","PATTERN_TOO_LONG","PATTERN_TOO_COMPLEX","UNSUPPORTED_PATTERN","UNSUPPORTED_TEXT","STATE_TOO_LARGE"]},"skippedRules":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":50},"skippedRuleCount":{"type":"integer","minimum":0}},"required":["status","reason"]},{"type":"object","properties":{"status":{"type":"string","enum":["failed"]},"reason":{"type":"string","enum":["TIMEOUT","PDF_BUSY","PDF_UNREADABLE","TOO_HEAVY","ERROR"]}},"required":["status","reason"]}]}},"required":["project","credits","textDetection"]}}}},"400":{"description":"INVALID_REQUEST (the request), INVALID_PDF (the file is not a readable PDF) or INVALID_PAGE_SELECTION (`pages` is not valid, or names a page the file does not have: details.pageCount). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS (details: required, available, buyCreditsUrl), MAX_CREDITS_EXCEEDED (details: required, maxCredits) or KEY_DAILY_LIMIT_EXCEEDED (details: limit, used, held, required, nextReleaseAt). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE, or a plan limit: PDF_COUNT, STORAGE, PROJECTS (details: current, max, tier)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENT_REQUEST_IN_PROGRESS (a request with this Idempotency-Key is still running) or UPLOAD_CHARGE_MISMATCH (send it again)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"FILE_TOO_LARGE: more than 100 MB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"IDEMPOTENCY_KEY_REUSED: this Idempotency-Key was used for a different request in the last 24 hours","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"PDF_BUSY: another of your PDFs is still being read (Retry-After), or RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy (Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}":{"get":{"summary":"Get a project","description":"The project with its drawings and the size of every page (points, rotation applied). Never includes symbols. A drawing whose pages cannot be measured now has `pageCount` and `pages` null and an `error` (`PDF_PROCESSING_FAILED` or `PDF_BUSY`, with `retryable`); the rest of the project is still returned.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The project","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"},"pdfs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"pageCount":{"type":["integer","null"],"minimum":0},"pages":{"type":["array","null"],"items":{"type":"object","properties":{"page":{"type":"integer","exclusiveMinimum":0},"width":{"type":"number"},"height":{"type":"number"},"rotation":{"type":"integer"}},"required":["page","width","height","rotation"]}},"error":{"type":"object","properties":{"code":{"type":"string","enum":["PDF_PROCESSING_FAILED","PDF_BUSY"]},"message":{"type":"string"},"retryable":{"type":"boolean"}},"required":["code","message","retryable"]}},"required":["id","filename","pageCount","pages"]}}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt","pdfs"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Rename, describe or change the status of a project","description":"Send at least one field. Does not change `stateVersion`.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":["string","null"],"maxLength":1000},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]}},"additionalProperties":false}}}},"responses":{"200":{"description":"The project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]}},"required":["project"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete a project","description":"Deletes the project and its drawings. This cannot be undone, so the body must repeat the project's id as `confirm`. A team project created by someone else can be deleted only when the team's settings allow it.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm":{"type":"string"}},"required":["confirm"]}}}},"responses":{"204":{"description":"Deleted"},"400":{"description":"CONFIRMATION_REQUIRED: `confirm` is missing or is not this project's id; nothing was deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE, or DELETE_NOT_ALLOWED: the team's settings do not let this user delete the project","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/pdfs":{"post":{"summary":"Add a PDF to a project","description":"Adds a drawing to an existing project. Costs 1 credit per page, counted by the server, charged to the key's workspace. The drawing's text is then matched against the project's rules and the symbols found are stored, so counts are available at once; `textDetection` says how that went. When it is `not_run` or `failed`, the upload still succeeded and the app finds the symbols when the drawing is first opened.\n\nRequired scope: `upload`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"Optional. The same key with the same request within 24 hours returns the first response and charges once; with a different request it is 422."},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"pdf":{"type":"string","description":"The PDF","format":"binary"},"max_credits":{"type":"integer","minimum":0,"description":"Refuse (402 MAX_CREDITS_EXCEEDED, nothing charged) when the upload would cost more credits than this"},"pages":{"type":"string","description":"Optional. Keep only these pages of the file, as the app's upload page picker does: page numbers and ranges separated by commas, e.g. `1,3,5-7`. Each page once, each in the file. The kept pages are stored in file order as a new drawing numbered from 1, and only they are charged. Not valid: 400 INVALID_PAGE_SELECTION, nothing charged. Pages cannot be selected from an encrypted PDF, including one only secured against changes (400 INVALID_PDF, nothing charged); upload such a file whole, without `pages`.","example":"1,3,5-7"}},"required":["pdf"]}}}},"responses":{"201":{"description":"The project, the new drawing and the credits charged","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]},"pdf":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"filename":{"type":"string"},"pageCount":{"type":"integer","minimum":0},"pages":{"type":"array","items":{"type":"object","properties":{"page":{"type":"integer","exclusiveMinimum":0},"width":{"type":"number"},"height":{"type":"number"},"rotation":{"type":"integer"}},"required":["page","width","height","rotation"]}}},"required":["id","filename","pageCount","pages"]},"credits":{"type":"object","properties":{"charged":{"type":"integer","minimum":0},"balance":{"type":"integer"},"bonus":{"type":"integer","minimum":0}},"required":["charged","balance"]},"textDetection":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["detected"]},"symbols":{"type":"integer","minimum":0}},"required":["status","symbols"]},{"type":"object","properties":{"status":{"type":"string","enum":["not_run"]},"reason":{"type":"string","enum":["TOO_MANY_RULES","PATTERN_TOO_LONG","PATTERN_TOO_COMPLEX","UNSUPPORTED_PATTERN","UNSUPPORTED_TEXT","STATE_TOO_LARGE"]},"skippedRules":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":50},"skippedRuleCount":{"type":"integer","minimum":0}},"required":["status","reason"]},{"type":"object","properties":{"status":{"type":"string","enum":["failed"]},"reason":{"type":"string","enum":["TIMEOUT","PDF_BUSY","PDF_UNREADABLE","TOO_HEAVY","ERROR"]}},"required":["status","reason"]}]}},"required":["project","pdf","credits","textDetection"]}}}},"400":{"description":"INVALID_REQUEST (the request), INVALID_PDF (the file is not a readable PDF) or INVALID_PAGE_SELECTION (`pages` is not valid, or names a page the file does not have: details.pageCount). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS (details: required, available, buyCreditsUrl), MAX_CREDITS_EXCEEDED (details: required, maxCredits) or KEY_DAILY_LIMIT_EXCEEDED (details: limit, used, held, required, nextReleaseAt). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE, or a plan limit: PDF_COUNT, STORAGE, PROJECTS (details: current, max, tier)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENT_REQUEST_IN_PROGRESS (a request with this Idempotency-Key is still running) or UPLOAD_CHARGE_MISMATCH (send it again)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"FILE_TOO_LARGE: more than 100 MB","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"IDEMPOTENCY_KEY_REUSED: this Idempotency-Key was used for a different request in the last 24 hours","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"PDF_BUSY: another of your PDFs is still being read (Retry-After), or RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy (Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/text-detection":{"post":{"summary":"Detect drawings again","description":"Detects the symbols of the project's drawings that hold none found by detection: a drawing whose upload answered `textDetection` `not_run` or `failed`. A rule change never leaves a drawing undetected (a batch that cannot detect every drawing exactly is refused). One drawing (`pdfId`) or every drawing of the project; for a project too large to detect in one request, detect its drawings one at a time with `pdfId`. Each drawing is matched against the project's rules as after an upload, and `textDetection` says how it went. A drawing that already has its detected symbols is reported `detected` with their count and nothing is changed, so calling this again is harmless. A drawing that could not be detected this time (the reader busy, out of time, a read that failed) is reported `failed` with the reason and nothing of it is changed. Free.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"pdfId":{"type":"string","format":"uuid"}},"additionalProperties":false}}}},"responses":{"200":{"description":"The state version after detecting, and how each drawing went","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"drawings":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"textDetection":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["detected"]},"symbols":{"type":"integer","minimum":0}},"required":["status","symbols"]},{"type":"object","properties":{"status":{"type":"string","enum":["not_run"]},"reason":{"type":"string","enum":["TOO_MANY_RULES","PATTERN_TOO_LONG","PATTERN_TOO_COMPLEX","UNSUPPORTED_PATTERN","UNSUPPORTED_TEXT","STATE_TOO_LARGE"]},"skippedRules":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":50},"skippedRuleCount":{"type":"integer","minimum":0}},"required":["status","reason"]},{"type":"object","properties":{"status":{"type":"string","enum":["failed"]},"reason":{"type":"string","enum":["TIMEOUT","PDF_BUSY","PDF_UNREADABLE","TOO_HEAVY","ERROR"]}},"required":["status","reason"]}]}},"required":["pdfId","textDetection"]}}},"required":["stateVersion","drawings"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace) or PDF_NOT_FOUND (the drawing is not in this project)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"REDETECTION_TOO_LARGE: the drawings to detect are too large for one request (not retryable; details: pages, limit, drawings, estimatedMs, budgetMs); detect them one at a time with `pdfId`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/empty":{"post":{"summary":"Create an empty project","description":"Creates a project with no drawings in the key's workspace, with the drawing profile's default rules (default `LIGHTING`). Add drawings with POST /projects/{id}/pdfs. Free.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","maxLength":1000},"drawingProfile":{"type":"string","enum":["LIGHTING","NETWORK","POWER","FIRE","SECURITY"]}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"The project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]}},"required":["project"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/archive":{"post":{"summary":"Archive a project","description":"Sets the status to `ARCHIVED`.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]}},"required":["project"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/unarchive":{"post":{"summary":"Unarchive a project","description":"Sets the status to `ACTIVE`.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]}},"required":["project"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/duplicate":{"post":{"summary":"Duplicate a project","description":"Copies the project's drawings, rules, symbols and zones into a new project in the key's workspace; annotations, linear measurements, scales and per-page settings are not carried over. Free. Your plan's storage and drawing limits apply.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255}},"additionalProperties":false}}}},"responses":{"201":{"description":"The new project","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]}},"required":["project"]}}}},"400":{"description":"INVALID_REQUEST, or PROJECT_HAS_NO_PDFS: a project without drawings cannot be duplicated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE, or a plan limit: PDF_COUNT, STORAGE (details: current, max, tier)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/pdfs/{pdfId}":{"delete":{"summary":"Remove a drawing from a project","description":"Removes the drawing and everything stored for it: its file, symbols, zones, cloud boxes, notes, highlights, linear paths and rings, excluded pages, scale and legend placements. Rules, linear rules and hidden labels belong to the project and stay. This cannot be undone, so the body must repeat the drawing's id as `confirm`. A project keeps at least one drawing. Raises `stateVersion`. Free.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"pdfId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm":{"type":"string"}},"required":["confirm"]}}}},"responses":{"204":{"description":"Removed"},"400":{"description":"CONFIRMATION_REQUIRED: `confirm` is missing or is not this drawing's id; or LAST_PDF: the project's only drawing (delete the project instead). Nothing was removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace) or PDF_NOT_FOUND (the drawing is not in this project)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/pdfs/order":{"put":{"summary":"Reorder a project's drawings","description":"`pdfIds` lists every one of the project's drawings exactly once, in the new order.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"pdfIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1}},"required":["pdfIds"],"additionalProperties":false}}}},"responses":{"200":{"description":"The project and its drawings in order","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["DRAFT","ACTIVE","ARCHIVED"]},"pdfCount":{"type":"integer","minimum":0},"pageCount":{"type":"integer","minimum":0},"stateVersion":{"type":"integer","minimum":0},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","status","pdfCount","pageCount","stateVersion","updatedAt"]},"pdfIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["project","pdfIds"]}}}},"400":{"description":"INVALID_REQUEST, or INVALID_ORDER: not every drawing of the project exactly once (details.expected)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/symbols":{"get":{"summary":"A project's symbols","description":"Symbols with their state version; filter by drawing and page.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"},{"schema":{"type":"string","pattern":"^[1-9][0-9]{0,5}$"},"required":false,"name":"page","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"includeRemoved","in":"query"}],"responses":{"200":{"description":"The symbols","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"symbols":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"type":{"type":"string"},"label":{"type":"string"},"ruleId":{"type":["string","null"]},"color":{"type":["string","null"]},"isManual":{"type":"boolean"},"source":{"type":["string","null"],"enum":["api","ai"]},"removed":{"type":"boolean"}},"required":["id","pdfId","page","x","y","width","height","center","type","label","ruleId","color","isManual","source","removed"]}}},"required":["stateVersion","symbols"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PDF_PROCESSING_FAILED: a stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/symbols/batch":{"post":{"summary":"Place, move, remove or restore symbols","description":"Applies 1–500 operations in order, all or nothing. 422 VALIDATION_FAILED lists every invalid operation (details.ops); 422 SYMBOL_LIMIT_EXCEEDED; 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale.\n\nRequired scope: `edit`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["place"]},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"ruleId":{"type":"string","minLength":1,"maxLength":200},"label":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[^\\u0000-\\u001f\\u007f]+$"},"width":{"type":"number"},"height":{"type":"number"}},"required":["op","pdfId","page","center","ruleId"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["move"]},"id":{"type":"string","minLength":1,"maxLength":512},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"required":["op","id","center"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["remove"]},"id":{"type":"string","minLength":1,"maxLength":512}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["restore"]},"id":{"type":"string","minLength":1,"maxLength":512}},"required":["op","id"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and each operation's symbol","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"type":{"type":"string"},"label":{"type":"string"},"ruleId":{"type":["string","null"]},"color":{"type":["string","null"]},"isManual":{"type":"boolean"},"source":{"type":["string","null"],"enum":["api","ai"]},"removed":{"type":"boolean"}},"required":["id","pdfId","page","x","y","width","height","center","type","label","ruleId","color","isManual","source","removed"]}}},"required":["stateVersion","results"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), SYMBOL_LIMIT_EXCEEDED, STATE_TOO_LARGE or PDF_PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/pdfs/{pdfId}/file":{"get":{"summary":"Download a PDF","description":"The drawing as it was uploaded, as an attachment.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"pdfId","in":"path"}],"responses":{"200":{"description":"The PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace), PDF_NOT_FOUND (the PDF is not in this project) or PAGE_NOT_FOUND (the page is not in this PDF)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PDF_PROCESSING_FAILED: the stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/pdfs/{pdfId}/pages/{page}/text":{"get":{"summary":"A page's text","description":"The page's words with their boxes, as the app's text detection sees them: glyphs drawn one by one are joined into words, and whitespace separates words. Boxes are in viewport units: points at scale 1 with the page's rotation applied, origin at the top-left, y increasing downwards (the units of the page sizes in GET /projects/{id} and of every symbol). A page with more text than can be returned is 422 PDF_PROCESSING_FAILED with `retryable: false`.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"pdfId","in":"path"},{"schema":{"type":"string","pattern":"^[0-9]{1,6}$"},"required":true,"name":"page","in":"path"}],"responses":{"200":{"description":"The page's text","content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"integer","exclusiveMinimum":0},"width":{"type":"number"},"height":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"str":{"type":"string"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}},"required":["str","x","y","width","height"]}}},"required":["page","width","height","items"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace), PDF_NOT_FOUND (the PDF is not in this project) or PAGE_NOT_FOUND (the page is not in this PDF)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PDF_PROCESSING_FAILED: a stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"PDF_BUSY: another of your page reads is still running (Retry-After), or RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/pdfs/{pdfId}/pages/{page}/image":{"get":{"summary":"A page as an image","description":"The page drawn as a PNG at `dpi` dots per inch (default 100), on white, with the page's rotation applied. The image is `ceil(width × dpi / 72)` × `ceil(height × dpi / 72)` pixels (computed exactly), `scale = dpi / 72`, and width and height are the page's size in viewport units (points at scale 1 with the rotation applied, origin at the top-left, y increasing downwards: the units of the page sizes in GET /projects/{id} and of every symbol, zone and path). So pixel (px, py) is the point (px / scale, py / scale). The response headers `X-Page-Width` and `X-Page-Height` give the page's size in viewport units and `X-Scale` the scale. A page too large to draw at the requested dpi is 400 RENDER_TOO_LARGE with the highest dpi it can be drawn at in `details.maxDpi` (null when it cannot be drawn at any). A page that could not be drawn is 422 RENDER_FAILED; `details.retryable` says whether trying the same request again may help, and `details.reason` says why: `memory` (the page could not be drawn within the memory the server has for it; a lower dpi may help a large page, but pages with large images or transparency cannot be drawn at any dpi, so try a lower dpi at most once), `image_too_large` (a lower dpi helps), `draw_failed`, `timeout` or `internal`.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"pdfId","in":"path"},{"schema":{"type":"string","pattern":"^[0-9]{1,6}$"},"required":true,"name":"page","in":"path"},{"schema":{"type":"string","pattern":"^[0-9]{1,3}$","default":"100"},"required":false,"name":"dpi","in":"query"}],"responses":{"200":{"description":"The page as a PNG","headers":{"X-Page-Width":{"description":"The page's width in viewport units","schema":{"type":"number"}},"X-Page-Height":{"description":"The page's height in viewport units","schema":{"type":"number"}},"X-Scale":{"description":"dpi / 72: pixel (px, py) is the point (px / scale, py / scale)","schema":{"type":"number"}}},"content":{"image/png":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST (details.issues; `dpi` must be a whole number from 36 to 200), or RENDER_TOO_LARGE: the page is too large to draw at this dpi (details.maxDpi)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace), PDF_NOT_FOUND (the PDF is not in this project) or PAGE_NOT_FOUND (the page is not in this PDF)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"RENDER_FAILED: the page could not be drawn (details.retryable, details.reason), or PDF_PROCESSING_FAILED: the stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"PDF_BUSY: another of your page images is still being drawn (Retry-After), or RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the server is busy drawing or sending other page images; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/counts":{"get":{"summary":"Visible symbol counts","description":"The symbol totals the app shows, per type and per label, for the whole project, one PDF (`pdfId`) or one page of it (`pdfId` and `page`). Removed symbols, hidden labels, excluded pages and symbols whose centre lies inside an exclusion zone are not counted; inclusion and area zones never change the totals. Counts the project's saved symbols. Without `pdfId` it also counts any symbols still stored for a PDF that is no longer in the project, which `GET /projects/{id}/takeoff` leaves out, so on an older project the two totals can differ.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,6}$"},"required":false,"name":"page","in":"query"}],"responses":{"200":{"description":"The counts","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"byLabel":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"type":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["label","type","count"]}},"byType":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["type","count"]}}},"required":["stateVersion","total","byLabel","byType"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace), PDF_NOT_FOUND (the PDF is not in this project) or PAGE_NOT_FOUND (the page is not in this PDF)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PDF_PROCESSING_FAILED: a stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/takeoff":{"get":{"summary":"Takeoff numbers","description":"The numbers of the app's takeoff export, for the whole project, one PDF (`pdfId`) or one page of it (`pdfId` and `page`). Free. `symbols`: the counted symbols by type, by label (with the rule that found them; \"Manual\" when none) and by page; symbols are counted as in `GET /projects/{id}/counts`: removed symbols, hidden labels, excluded pages and symbols whose centre lies inside an exclusion zone (shown or hidden) are not counted. `zones`: each zone; an inclusion zone lists the counted symbols whose centre is inside it (inclusion zones group and never change the totals; a symbol inside two inclusion zones is listed in both), inclusion and area zones give their area at the PDF's scale (1:100 metric when the PDF has none), exclusion zones only remove symbols. `linear`: each enabled linear rule with paths in scope, its total length (a ring counts its circumference) and lengths needed, per PDF (`byPdf`) and summed, and each path with its length, lengths needed and, for a ring, its diameter. Lengths are in metres; `pdfs[].scale.unit` says which unit the app shows them in. Lists are in the order of the app's CSV export. Symbols, zones and paths still stored for a PDF that is no longer in the project are left out, whereas the project-wide `GET /projects/{id}/counts` includes any such stored symbols, so on an older project the two totals can differ.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,6}$"},"required":false,"name":"page","in":"query"}],"responses":{"200":{"description":"The takeoff","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer","minimum":0},"scope":{"type":"object","properties":{"pdfId":{"type":["string","null"]},"page":{"type":["integer","null"]}},"required":["pdfId","page"]},"pdfs":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"filename":{"type":"string"},"scale":{"type":"object","properties":{"ratio":{"type":"number"},"unit":{"type":"string","enum":["metric","imperial"]},"label":{"type":"string"},"isDefault":{"type":"boolean","description":"True when the drawing has no scale of its own and 1:100 metric is used"}},"required":["ratio","unit","label","isDefault"]}},"required":["pdfId","filename","scale"]}},"symbols":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"byType":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["type","count"]}},"byLabel":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"type":{"type":"string"},"ruleId":{"type":["string","null"]},"ruleName":{"type":"string","description":"\"Manual\" when the symbol has no rule"},"count":{"type":"integer","minimum":0}},"required":["label","type","ruleId","ruleName","count"]}},"byPage":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"page":{"type":"integer"},"total":{"type":"integer","minimum":0}},"required":["pdfId","page","total"]}}},"required":["total","byType","byLabel","byPage"]},"zones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"name":{"type":"string"},"type":{"type":"string","enum":["INCLUSION","EXCLUSION","AREA"]},"area":{"type":["object","null"],"properties":{"squareMeters":{"type":"number"},"value":{"type":"number","description":"The area in the drawing's unit: square metres, or square feet for a drawing set to an imperial scale"},"unit":{"type":"string","enum":["m2","ft2"]}},"required":["squareMeters","value","unit"],"description":"Inclusion and area zones; null for exclusion zones"},"symbols":{"type":["object","null"],"properties":{"total":{"type":"integer","minimum":0},"byLabel":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"type":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["label","type","count"]}}},"required":["total","byLabel"],"description":"Inclusion zones only: the counted symbols whose centre is inside the zone"}},"required":["id","pdfId","page","name","type","area","symbols"]}},"linear":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"totalLengthMeters":{"type":"number","description":"Total length in metres; a ring counts its circumference"},"unitsNeeded":{"type":"integer","minimum":0,"description":"Lengths needed, as the app shows them: the straight paths' total divided by the unit length and rounded up, plus each ring rounded up on its own"},"pathCount":{"type":"integer","minimum":0},"ringCount":{"type":"integer","minimum":0},"ruleId":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"isRingRule":{"type":"boolean"},"displayMode":{"type":"string","enum":["unit","length"]},"unitLength":{"type":"number"},"byPdf":{"type":"array","items":{"type":"object","properties":{"totalLengthMeters":{"type":"number","description":"Total length in metres; a ring counts its circumference"},"unitsNeeded":{"type":"integer","minimum":0,"description":"Lengths needed, as the app shows them: the straight paths' total divided by the unit length and rounded up, plus each ring rounded up on its own"},"pathCount":{"type":"integer","minimum":0},"ringCount":{"type":"integer","minimum":0},"pdfId":{"type":"string"}},"required":["totalLengthMeters","unitsNeeded","pathCount","ringCount","pdfId"]}}},"required":["totalLengthMeters","unitsNeeded","pathCount","ringCount","ruleId","name","symbol","isRingRule","displayMode","unitLength","byPdf"]}},"paths":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"identifier":{"type":"string"},"kind":{"type":"string","enum":["path","ring"]},"pdfId":{"type":"string"},"page":{"type":"integer"},"ruleId":{"type":"string"},"name":{"type":["string","null"]},"lengthMeters":{"type":"number","description":"Length in metres at the drawing's scale; a ring's is its circumference"},"units":{"type":"integer","minimum":0},"diameterMeters":{"type":["number","null"],"description":"Rings only"}},"required":["id","identifier","kind","pdfId","page","ruleId","name","lengthMeters","units","diameterMeters"]}}},"required":["rules","paths"]}},"required":["stateVersion","scope","pdfs","symbols","zones","linear"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace), PDF_NOT_FOUND (the PDF is not in this project) or PAGE_NOT_FOUND (the page is not in this PDF)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PDF_PROCESSING_FAILED: a stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/exports/estimate":{"get":{"summary":"Estimate an export","description":"What an export would cost now and whether it can be paid: within `available` and the key's daily limit. Charged as the app charges an export, to the key's workspace: free on paid plans and for teams; otherwise a CSV costs 1 credit and a PDF export 1 credit per page. A PDF export covering one PDF (`pdfId`, `pdfIds` with one id, or neither on a project with one PDF) is charged for that PDF's pages with at least one counted symbol, as the app's Export button; with no counted symbol it costs nothing. One covering several PDFs (`pdfIds`, or neither: every PDF) is charged for every page that is not excluded, as the app's Export All. Pages are counted by the server. Free; changes nothing.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["pdf","csv"]},"required":true,"name":"format","in":"query"},{"schema":{"type":"string","format":"uuid","description":"format=csv: the PDF (required). format=pdf: one PDF, as the app's Export button (not with pdfIds)"},"required":false,"description":"format=csv: the PDF (required). format=pdf: one PDF, as the app's Export button (not with pdfIds)","name":"pdfId","in":"query"},{"schema":{"type":"string","description":"format=pdf: PDF ids separated by commas, in output order, as the app's Export All; default every PDF. One PDF is priced on its pages with a visible symbol, several on every page not excluded"},"required":false,"description":"format=pdf: PDF ids separated by commas, in output order, as the app's Export All; default every PDF. One PDF is priced on its pages with a visible symbol, several on every page not excluded","name":"pdfIds","in":"query"}],"responses":{"200":{"description":"The estimate","content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["pdf","csv"]},"pages":{"type":"integer"},"credits":{"type":"integer"},"unlimitedExports":{"type":"boolean","description":"True when the workspace's plan exports free"},"available":{"type":"integer"},"sufficient":{"type":"boolean","description":"False when credits exceed what is available or the key's remaining daily limit"},"keyDailyLimit":{"type":"object","properties":{"limit":{"type":["integer","null"]},"used":{"type":"integer"},"held":{"type":"integer"},"remaining":{"type":["integer","null"]},"nextReleaseAt":{"type":["string","null"],"format":"date-time"}},"required":["limit","used","held","remaining","nextReleaseAt"]}},"required":["format","pages","credits","unlimitedExports","available","sufficient","keyDailyLimit"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace) or PDF_NOT_FOUND (a PDF that is not in this project)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PDF_PROCESSING_FAILED: a stored drawing could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/exports":{"post":{"summary":"Create an export","description":"Makes an export of the project as it is saved now and keeps it for download for 7 days (`expiresAt`); downloading it again in that time costs nothing. `format: \"csv\"` is the app's takeoff CSV of one PDF, as the app writes it (its \"Generated:\" line is the server's time in UTC). `format: \"pdf\"` is the app's marked-up PDF (symbols, zones, linear paths and rings, annotations and the legend, in named layers), made on the server by the same code as the app's export; `pdfId` gives the Export button's file, `pdfIds` the Export All file with the PDFs in the order given. One marked-up PDF export at a time per user. Charged as the app charges an export, to the key's workspace: free on paid plans and for teams; otherwise a CSV costs 1 credit and a PDF export 1 credit per page. A PDF export covering one PDF (`pdfId`, `pdfIds` with one id, or neither on a project with one PDF) is charged for that PDF's pages with at least one counted symbol, as the app's Export button; with no counted symbol it costs nothing. One covering several PDFs (`pdfIds`, or neither: every PDF) is charged for every page that is not excluded, as the app's Export All. Pages are counted by the server. `stateVersion` is the project state version the export was made from. With an `Idempotency-Key`, the same request within 24 hours returns the first export and charges once; after that it is a new, charged export. A request that fails after it was charged is refunded.\n\nRequired scope: `upload`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":200,"description":"Optional. The same key with the same request within 24 hours returns the first response and charges once; with a different request it is 422."},"required":false,"name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"format":{"type":"string","enum":["csv"]},"pdfId":{"type":"string","format":"uuid","description":"The PDF the takeoff CSV is for (the app's CSV covers one PDF)"},"max_credits":{"type":"integer","minimum":0,"description":"Refuse (402 MAX_CREDITS_EXCEEDED, nothing charged) when the export would cost more credits than this"}},"required":["format","pdfId"],"additionalProperties":false},{"type":"object","properties":{"format":{"type":"string","enum":["pdf"]},"pdfId":{"type":"string","format":"uuid","description":"One PDF, exported as the app's Export button does it and charged for its pages with a visible symbol (not with pdfIds)"},"pdfIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"description":"The PDFs to export together, in output order, exported as the app's Export All does it; default every PDF in the project's order. Charged for every page not excluded when it covers two or more PDFs; when it covers one PDF, for that PDF's pages with a visible symbol, as pdfId is"},"max_credits":{"type":"integer","minimum":0,"description":"Refuse (402 MAX_CREDITS_EXCEEDED, nothing charged) when the export would cost more credits than this"}},"required":["format"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"The export and the credits charged","content":{"application/json":{"schema":{"type":"object","properties":{"export":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"format":{"type":"string","enum":["pdf","csv"]},"pdfIds":{"type":"array","items":{"type":"string","format":"uuid"},"description":"The PDFs exported, in output order"},"stateVersion":{"type":"integer","description":"The project state version the export was made from"},"pages":{"type":"integer","description":"The page count the export was priced on"},"sizeBytes":{"type":"integer"},"filename":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","description":"Downloadable until then; after that a new export is needed"},"downloadUrl":{"type":"string","description":"GET this path (with the API key) to download the file"}},"required":["id","format","pdfIds","stateVersion","pages","sizeBytes","filename","createdAt","expiresAt","downloadUrl"]},"credits":{"type":"object","properties":{"charged":{"type":"integer"},"balance":{"type":"integer"}},"required":["charged","balance"]}},"required":["export","credits"]}}}},"400":{"description":"INVALID_REQUEST (details.issues), PROJECT_HAS_NO_PDFS, or EXPORT_HAS_NO_PAGES (every page of the PDFs is excluded). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS (details: required, available, buyCreditsUrl), MAX_CREDITS_EXCEEDED (details: required, maxCredits) or KEY_DAILY_LIMIT_EXCEEDED (details: limit, used, held, required, nextReleaseAt). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace) or PDF_NOT_FOUND (a PDF that is not in this project)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENT_REQUEST_IN_PROGRESS (a request with this Idempotency-Key is still running) or EXPORT_CHARGE_MISMATCH (refunded; send it again)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"EXPORT_TOO_LARGE: the PDF, or the PDFs together, are too large to export through the API (details: sourceMegabytes, limit); export fewer PDFs at a time, or export from the app. Checked on the stored files before anything is charged: nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"IDEMPOTENCY_KEY_REUSED (this Idempotency-Key was used for a different request in the last 24 hours), PDF_PROCESSING_FAILED (a stored drawing could not be read; details.retryable), EXPORT_LIMIT_REACHED (the project holds as many exports as it can; wait for older exports to expire; nothing charged), or EXPORT_FAILED (the marked-up PDF could not be made; details: retryable, reason: unreadable, memory, output_too_large, timeout or internal; the charge was refunded)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"EXPORT_BUSY: another marked-up PDF export of yours is still being made (Retry-After). Nothing was charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the server is busy making other exports, or the request ran out of time (Retry-After). Nothing was charged, or the charge was refunded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"List exports","description":"The project's exports that can still be downloaded, newest first.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The exports","content":{"application/json":{"schema":{"type":"object","properties":{"exports":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"format":{"type":"string","enum":["pdf","csv"]},"pdfIds":{"type":"array","items":{"type":"string","format":"uuid"},"description":"The PDFs exported, in output order"},"stateVersion":{"type":"integer","description":"The project state version the export was made from"},"pages":{"type":"integer","description":"The page count the export was priced on"},"sizeBytes":{"type":"integer"},"filename":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","description":"Downloadable until then; after that a new export is needed"},"downloadUrl":{"type":"string","description":"GET this path (with the API key) to download the file"}},"required":["id","format","pdfIds","stateVersion","pages","sizeBytes","filename","createdAt","expiresAt","downloadUrl"]}}},"required":["exports"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/exports/{exportId}/file":{"get":{"summary":"Download an export","description":"The export file, as an attachment. Already paid for: downloading costs nothing.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"exportId","in":"path"}],"responses":{"200":{"description":"The file","content":{"text/csv":{"schema":{"type":"string"}},"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND (no such project in the key's workspace) or EXPORT_NOT_FOUND (no such export in this project)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"EXPORT_EXPIRED: the export is past its `expiresAt`; create a new one","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"EXPORT_FILE_UNAVAILABLE: the stored file could not be read (details.retryable)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/page-setup":{"get":{"summary":"A project's page setup","description":"Every drawing in order with its scale and its pages (size in points with rotation applied, and whether the page is excluded from takeoff), the labels hidden from totals, and the project's drawing profile. A drawing whose pages cannot be measured now has `pages` null and an `error` (`PDF_PROCESSING_FAILED` or `PDF_BUSY`, with `retryable`).\n\nRequired scope: `read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"A project's page setup","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"drawingProfile":{"type":"string"},"hiddenLabels":{"type":"array","items":{"type":"string"}},"pdfs":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string","format":"uuid"},"filename":{"type":"string"},"orderIndex":{"type":"integer"},"scale":{"type":"object","properties":{"ratio":{"type":"number"},"unit":{"type":"string","enum":["metric","imperial"]},"label":{"type":"string"},"isDefault":{"type":"boolean"}},"required":["ratio","unit","label","isDefault"]},"pages":{"type":["array","null"],"items":{"type":"object","properties":{"page":{"type":"integer"},"width":{"type":"number"},"height":{"type":"number"},"rotation":{"type":"integer"},"excluded":{"type":"boolean"}},"required":["page","width","height","rotation","excluded"]}},"error":{"type":"object","properties":{"code":{"type":"string","enum":["PDF_PROCESSING_FAILED","PDF_BUSY"]},"message":{"type":"string"},"retryable":{"type":"boolean"}},"required":["code","message","retryable"]}},"required":["pdfId","filename","orderIndex","scale","pages"]}}},"required":["stateVersion","drawingProfile","hiddenLabels","pdfs"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/page-setup/batch":{"post":{"summary":"Exclude or include pages, set or clear scales, hide or show labels","description":"Operations: `excludePages` / `includePages` (`pdfId`, `pages`; a page already in that state is not an error), `setScale` (`pdfId`, `scale: { ratio, unit, label? }`; without `label` the app's preset label for that ratio, else \"1:<ratio>\"; stored uncalibrated, as the app's scale picker does), `clearScale` (`pdfId`; the default 1:100 metric applies again), `hideLabels` / `showLabels` (`labels`: symbol labels left out of, or counted again in, totals). Per-operation codes: PDF_NOT_IN_PROJECT, PAGE_OUT_OF_RANGE, INVALID_VALUE, TEXT_TOO_LONG, LIMIT_REACHED.\n\nApplies 1–500 operations in order, all or nothing, and raises the project's state version by one. 422 VALIDATION_FAILED lists every invalid operation (details.ops, each with its index and code); 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale (details.currentVersion).\n\nRequired scope: `edit`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["excludePages"]},"pdfId":{"type":"string","format":"uuid"},"pages":{"type":"array","items":{"type":"integer"}}},"required":["op","pdfId","pages"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["includePages"]},"pdfId":{"type":"string","format":"uuid"},"pages":{"type":"array","items":{"type":"integer"}}},"required":["op","pdfId","pages"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["setScale"]},"pdfId":{"type":"string","format":"uuid"},"scale":{"type":"object","properties":{"ratio":{"type":"number"},"unit":{"type":"string","enum":["metric","imperial"]},"label":{"type":"string"}},"required":["ratio","unit"],"additionalProperties":false}},"required":["op","pdfId","scale"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["clearScale"]},"pdfId":{"type":"string","format":"uuid"}},"required":["op","pdfId"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["hideLabels"]},"labels":{"type":"array","items":{"type":"string"}}},"required":["op","labels"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["showLabels"]},"labels":{"type":"array","items":{"type":"string"}}},"required":["op","labels"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and one result per operation, in order","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"op":{"type":"string","enum":["excludePages","includePages"]},"pdfId":{"type":"string","format":"uuid"},"excludedPages":{"type":"array","items":{"type":"integer"}}},"required":["op","pdfId","excludedPages"]},{"type":"object","properties":{"op":{"type":"string","enum":["setScale","clearScale"]},"pdfId":{"type":"string","format":"uuid"},"scale":{"type":"object","properties":{"ratio":{"type":"number"},"unit":{"type":"string","enum":["metric","imperial"]},"label":{"type":"string"},"isDefault":{"type":"boolean"}},"required":["ratio","unit","label","isDefault"]}},"required":["op","pdfId","scale"]},{"type":"object","properties":{"op":{"type":"string","enum":["hideLabels","showLabels"]},"labels":{"type":"array","items":{"type":"string"}},"hidden":{"type":"boolean"}},"required":["op","labels","hidden"]}]}}},"required":["stateVersion","results"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), STATE_TOO_LARGE or PDF_PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/linear":{"get":{"summary":"A project's linear rules and paths with measured lengths","description":"The project's linear rules and the paths and rings drawn on them (optionally of one drawing `pdfId` and `page`). A line rule is for paths (straight and curved segments); a ring rule is for rings (a circle by centre and radius). Each path has its `identifier` as the app shows it (the rule's symbol and the path's number, e.g. `LED.1`), its `length` in the drawing's own unit (`unit` is `m` or `ft`; a ring's length is its circumference) computed with the drawing's own scale, else 1:100 metric, as the CSV export does, and `units`, the lengths needed. A ring also has its `diameter`. Each rule has `totals` per drawing: path and ring counts, total length and the lengths needed (`units`) as the app shows them (every ring is rounded up to whole lengths and the counts are added).\n\nRequired scope: `read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"},{"schema":{"type":"string","pattern":"^[1-9][0-9]{0,5}$"},"required":false,"name":"page","in":"query"}],"responses":{"200":{"description":"A project's linear rules and paths with measured lengths","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"unitLength":{"type":"number"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayMode":{"type":"string","enum":["unit","length"]},"isRingRule":{"type":"boolean"},"totals":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"unit":{"type":"string","enum":["m","ft"]},"pathCount":{"type":"integer"},"ringCount":{"type":"integer"},"lengthMeters":{"type":"number"},"length":{"type":"number"},"units":{"type":"integer"}},"required":["pdfId","unit","pathCount","ringCount","lengthMeters","length","units"]}}},"required":["id","name","symbol","unitLength","color","enabled","displayMode","isRingRule","totals"]}},"paths":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"identifier":{"type":"string"},"kind":{"type":"string","enum":["path","ring"]},"pdfId":{"type":"string"},"page":{"type":"integer"},"ruleId":{"type":"string"},"name":{"type":["string","null"]},"start":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"segments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["STRAIGHT"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"required":["type","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["CURVE"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cp1":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cp2":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"required":["type","to","cp1","cp2"]}]}},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"radius":{"type":"number"},"visible":{"type":"boolean"},"color":{"type":["string","null"]},"unit":{"type":"string","enum":["m","ft"]},"lengthMeters":{"type":"number"},"length":{"type":"number"},"units":{"type":["integer","null"]},"diameterMeters":{"type":"number"},"diameter":{"type":"number"}},"required":["id","identifier","kind","pdfId","page","ruleId","name","visible","color","unit","lengthMeters","length","units"]}}},"required":["stateVersion","rules","paths"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/linear/batch":{"post":{"summary":"Create, change and delete linear rules, paths and rings","description":"Operations: `createRule` (`name`, `symbol` up to 5 characters, optional `unitLength` in metres (default 5 for a line rule, 1 for a ring rule), `color`, `enabled`, `displayMode` `length` or `unit`, `isRingRule`, `ref`), `updateRule`, `deleteRule` (deletes the rule's paths and rings too, as the app does), `createPath` (`pdfId`, `page`, `rule`, `start`, `segments`: STRAIGHT with `to`, or CURVE with `to` and bezier controls `cp1`, `cp2`), `createRing` (`pdfId`, `page`, `rule`, `center`, `radius`), `updatePath` (`start`, `segments`, `name`, `color`, `visible`), `updateRing` (`center`, `radius`, ...), `deletePath` (a path or a ring). A path goes on a line rule and a ring on a ring rule (`RULE_KIND_MISMATCH` otherwise). Wherever an id is wanted, `{ ref }` names an item created earlier in the same batch, so one batch can create a rule and its paths. Points are in page points with the origin top-left and y down, and must lie on the page; a ring's whole circle must. Names and symbols may not contain control characters. A path or ring never moves to another drawing or page: delete it and create another. Lengths are computed by the server from the geometry and the drawing's scale; they are never sent. Per-operation codes: PDF_NOT_IN_PROJECT, PAGE_OUT_OF_RANGE, OUT_OF_BOUNDS, NOT_FOUND, INVALID_COLOR, TEXT_TOO_LONG, INVALID_VALUE, LIMIT_REACHED, RULE_KIND_MISMATCH, DUPLICATE_REF, UNKNOWN_REF.\n\nApplies 1–500 operations in order, all or nothing, and raises the project's state version by one. 422 VALIDATION_FAILED lists every invalid operation (details.ops, each with its index and code); 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale (details.currentVersion).\n\nRequired scope: `edit`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["createRule"]},"ref":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"unitLength":{"type":"number"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayMode":{"type":"string","enum":["unit","length"]},"isRingRule":{"type":"boolean"}},"required":["op","name","symbol"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["updateRule"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"name":{"type":"string"},"symbol":{"type":"string"},"unitLength":{"type":"number"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayMode":{"type":"string","enum":["unit","length"]},"isRingRule":{"type":"boolean"}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["deleteRule"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["createPath"]},"ref":{"type":"string"},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"rule":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"start":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"segments":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["STRAIGHT"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"required":["type","to"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["CURVE"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"cp1":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"cp2":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"required":["type","to","cp1","cp2"],"additionalProperties":false}]}},"name":{"type":"string"},"color":{"type":"string"},"visible":{"type":"boolean"}},"required":["op","pdfId","page","rule","start","segments"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["createRing"]},"ref":{"type":"string"},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"rule":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"radius":{"type":"number"},"name":{"type":"string"},"color":{"type":"string"},"visible":{"type":"boolean"}},"required":["op","pdfId","page","rule","center","radius"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["updatePath"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"start":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"segments":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["STRAIGHT"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"required":["type","to"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["CURVE"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"cp1":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"cp2":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"required":["type","to","cp1","cp2"],"additionalProperties":false}]}},"name":{"type":"string"},"color":{"type":"string"},"visible":{"type":"boolean"}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["updateRing"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"radius":{"type":"number"},"name":{"type":"string"},"color":{"type":"string"},"visible":{"type":"boolean"}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["deletePath"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]}},"required":["op","id"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and one result per operation, in order","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"op":{"type":"string","enum":["createRule"]},"id":{"type":"string"},"ref":{"type":"string"},"rule":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"unitLength":{"type":"number"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayMode":{"type":"string","enum":["unit","length"]},"isRingRule":{"type":"boolean"}},"required":["id","name","symbol","unitLength","color","enabled","displayMode","isRingRule"]}},"required":["op","id","rule"]},{"type":"object","properties":{"op":{"type":"string","enum":["updateRule"]},"id":{"type":"string"},"rule":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"unitLength":{"type":"number"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayMode":{"type":"string","enum":["unit","length"]},"isRingRule":{"type":"boolean"}},"required":["id","name","symbol","unitLength","color","enabled","displayMode","isRingRule"]}},"required":["op","id","rule"]},{"type":"object","properties":{"op":{"type":"string","enum":["deleteRule"]},"id":{"type":"string"},"deletedPaths":{"type":"integer"}},"required":["op","id","deletedPaths"]},{"type":"object","properties":{"op":{"type":"string","enum":["createPath","createRing"]},"id":{"type":"string"},"ref":{"type":"string"},"path":{"type":"object","properties":{"id":{"type":"string"},"identifier":{"type":"string"},"kind":{"type":"string","enum":["path","ring"]},"pdfId":{"type":"string"},"page":{"type":"integer"},"ruleId":{"type":"string"},"name":{"type":["string","null"]},"start":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"segments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["STRAIGHT"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"required":["type","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["CURVE"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cp1":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cp2":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"required":["type","to","cp1","cp2"]}]}},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"radius":{"type":"number"},"visible":{"type":"boolean"},"color":{"type":["string","null"]},"unit":{"type":"string","enum":["m","ft"]},"lengthMeters":{"type":"number"},"length":{"type":"number"},"units":{"type":["integer","null"]},"diameterMeters":{"type":"number"},"diameter":{"type":"number"}},"required":["id","identifier","kind","pdfId","page","ruleId","name","visible","color","unit","lengthMeters","length","units"]}},"required":["op","id"]},{"type":"object","properties":{"op":{"type":"string","enum":["updatePath","updateRing"]},"id":{"type":"string"},"path":{"type":"object","properties":{"id":{"type":"string"},"identifier":{"type":"string"},"kind":{"type":"string","enum":["path","ring"]},"pdfId":{"type":"string"},"page":{"type":"integer"},"ruleId":{"type":"string"},"name":{"type":["string","null"]},"start":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"segments":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["STRAIGHT"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"required":["type","to"]},{"type":"object","properties":{"type":{"type":"string","enum":["CURVE"]},"to":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cp1":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"cp2":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"required":["type","to","cp1","cp2"]}]}},"center":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]},"radius":{"type":"number"},"visible":{"type":"boolean"},"color":{"type":["string","null"]},"unit":{"type":"string","enum":["m","ft"]},"lengthMeters":{"type":"number"},"length":{"type":"number"},"units":{"type":["integer","null"]},"diameterMeters":{"type":"number"},"diameter":{"type":"number"}},"required":["id","identifier","kind","pdfId","page","ruleId","name","visible","color","unit","lengthMeters","length","units"]}},"required":["op","id"]},{"type":"object","properties":{"op":{"type":"string","enum":["deletePath"]},"id":{"type":"string"}},"required":["op","id"]}]}}},"required":["stateVersion","results"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), STATE_TOO_LARGE or PDF_PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/annotations":{"get":{"summary":"A project's annotations","description":"Cloud boxes, text notes and highlights, optionally of one drawing (`pdfId`) and page (`page`). Coordinates are page points, origin top-left, rotation applied. `visible`, the text alignments and `fontScale` show the app's defaults (visible, center, middle, 1) for an item that never set them; a highlight has no text, alignment or font scale.\n\nRequired scope: `read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"},{"schema":{"type":"string","pattern":"^[1-9][0-9]{0,5}$"},"required":false,"name":"page","in":"query"}],"responses":{"200":{"description":"A project's annotations","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"cloudBoxes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"color":{"type":"string"},"name":{"type":"string"},"visible":{"type":"boolean"},"text":{"type":"string"},"textAlignH":{"type":"string","enum":["left","center","right"]},"textAlignV":{"type":"string","enum":["top","middle","bottom"]},"fontScale":{"type":"number"}},"required":["id","pdfId","page","x","y","width","height","color","visible","text","textAlignH","textAlignV","fontScale"]}},"textNotes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"color":{"type":"string"},"name":{"type":"string"},"visible":{"type":"boolean"},"text":{"type":"string"},"textAlignH":{"type":"string","enum":["left","center","right"]},"textAlignV":{"type":"string","enum":["top","middle","bottom"]},"fontScale":{"type":"number"}},"required":["id","pdfId","page","x","y","width","height","color","visible","text","textAlignH","textAlignV","fontScale"]}},"highlights":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"color":{"type":"string"},"name":{"type":"string"},"visible":{"type":"boolean"}},"required":["id","pdfId","page","x","y","width","height","color","visible"]}}},"required":["stateVersion","cloudBoxes","textNotes","highlights"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/annotations/batch":{"post":{"summary":"Create, update and delete cloud boxes, text notes and highlights","description":"Operations: `create` (`kind` cloudBox, textNote or highlight; `pdfId`, `page`, `x`, `y`, `width`, `height`; optional `ref`, `color` as #rrggbb, `name`, `visible`, and for cloud boxes and text notes `text` (required for a text note), `textAlignH` left/center/right, `textAlignV` top/middle/bottom, `fontScale` 0.5 to 2), `update` (`kind`, `id` or `{ ref }`, and any of the fields above except `pdfId`, `page` and `ref`; `name: null` removes the name), `delete` (`kind`, `id` or `{ ref }`). The whole box must lie on its page; it is checked whenever a position or size is sent. Per-operation codes: PDF_NOT_IN_PROJECT, PAGE_OUT_OF_RANGE, OUT_OF_BOUNDS, NOT_FOUND, INVALID_COLOR, INVALID_VALUE, TEXT_TOO_LONG, LIMIT_REACHED, DUPLICATE_REF, UNKNOWN_REF.\n\nApplies 1–500 operations in order, all or nothing, and raises the project's state version by one. 422 VALIDATION_FAILED lists every invalid operation (details.ops, each with its index and code); 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale (details.currentVersion).\n\nRequired scope: `edit`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["create"]},"kind":{"type":"string","enum":["cloudBox","textNote","highlight"]},"ref":{"type":"string"},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"color":{"type":"string"},"name":{"type":"string"},"text":{"type":"string"},"visible":{"type":"boolean"},"textAlignH":{"type":"string"},"textAlignV":{"type":"string"},"fontScale":{"type":"number"}},"required":["op","kind","pdfId","page","x","y","width","height"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["update"]},"kind":{"type":"string","enum":["cloudBox","textNote","highlight"]},"id":{"anyOf":[{"type":"string","minLength":1},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"color":{"type":"string"},"name":{"type":["string","null"]},"text":{"type":"string"},"visible":{"type":"boolean"},"textAlignH":{"type":"string"},"textAlignV":{"type":"string"},"fontScale":{"type":"number"}},"required":["op","kind","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["delete"]},"kind":{"type":"string","enum":["cloudBox","textNote","highlight"]},"id":{"anyOf":[{"type":"string","minLength":1},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]}},"required":["op","kind","id"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and one result per operation, in order","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"op":{"type":"string","enum":["create","update","delete"]},"kind":{"type":"string","enum":["cloudBox","textNote","highlight"]},"id":{"type":"string"},"ref":{"type":"string"}},"required":["op","kind","id"]}}},"required":["stateVersion","results"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), STATE_TOO_LARGE or PDF_PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/legends":{"get":{"summary":"Legend placement per drawing page","description":"One entry per page of each drawing (optionally of one drawing, `pdfId`): the legend's position and size in page points (origin top-left), whether it is shown and its font size. A page that was never set shows the default placement with `isDefault` true. A drawing whose pages cannot be measured now is listed in `errors` instead.\n\nRequired scope: `read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"}],"responses":{"200":{"description":"Legend placement per drawing page","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"legends":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"visible":{"type":"boolean"},"fontSize":{"type":"number"},"isDefault":{"type":"boolean"}},"required":["pdfId","page","x","y","width","height","visible","fontSize","isDefault"]}},"errors":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"code":{"type":"string","enum":["PDF_PROCESSING_FAILED","PDF_BUSY"]},"message":{"type":"string"},"retryable":{"type":"boolean"}},"required":["pdfId","code","message","retryable"]}}},"required":["stateVersion","legends"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/legends/batch":{"post":{"summary":"Set or reset the legend placement of drawing pages","description":"Operations: `set` (`pdfId`, `page`, and any of `x`, `y`, `width`, `height`, `visible`, `fontSize`; merged over the stored placement or the default; the whole box must lie on the page, checked only when a position or size is sent) and `reset` (`pdfId`, `page`; the default applies again). Per-operation codes: PDF_NOT_IN_PROJECT, PAGE_OUT_OF_RANGE, OUT_OF_BOUNDS, INVALID_VALUE.\n\nApplies 1–500 operations in order, all or nothing, and raises the project's state version by one. 422 VALIDATION_FAILED lists every invalid operation (details.ops, each with its index and code); 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale (details.currentVersion).\n\nRequired scope: `edit`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["set"]},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"visible":{"type":"boolean"},"fontSize":{"type":"number"}},"required":["op","pdfId","page"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["reset"]},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"}},"required":["op","pdfId","page"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and one result per operation, in order","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"op":{"type":"string","enum":["set","reset"]},"legend":{"type":"object","properties":{"pdfId":{"type":"string"},"page":{"type":"integer"},"x":{"type":"number"},"y":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"},"visible":{"type":"boolean"},"fontSize":{"type":"number"},"isDefault":{"type":"boolean"}},"required":["pdfId","page","x","y","width","height","visible","fontSize","isDefault"]}},"required":["op","legend"]}}},"required":["stateVersion","results"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), STATE_TOO_LARGE or PDF_PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/zones":{"get":{"summary":"A project's zones with their measured areas","description":"The inclusion, exclusion and area zones of the project (optionally of one drawing `pdfId` and `page`), each with its type, name, points, colour, visibility and measured `area`: square metres and the value in the drawing's own unit (square feet for an imperial drawing), as the app shows it. The area uses the drawing's scale; a drawing with no scale set uses the default, 1:100 metric (`scaleIsDefault` is true). Inclusion zones group: they give a per-zone breakdown and never change totals. Exclusion zones remove from every total the symbols whose centre is inside them, whether or not the zone is shown. Area zones only measure.\n\nRequired scope: `read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"pdfId","in":"query"},{"schema":{"type":"string","pattern":"^[1-9][0-9]{0,5}$"},"required":false,"name":"page","in":"query"}],"responses":{"200":{"description":"A project's zones with their measured areas","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"zones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"name":{"type":"string"},"type":{"type":"string","enum":["INCLUSION","EXCLUSION","AREA"]},"points":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"visible":{"type":"boolean"},"color":{"type":["string","null"]},"area":{"type":"object","properties":{"squareMeters":{"type":"number"},"value":{"type":"number"},"unit":{"type":"string","enum":["m2","ft2"]},"formatted":{"type":"string"},"scaleIsDefault":{"type":"boolean"}},"required":["squareMeters","value","unit","formatted","scaleIsDefault"]}},"required":["id","pdfId","page","name","type","points","visible","color","area"]}}},"required":["stateVersion","zones"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/zones/batch":{"post":{"summary":"Create, change and delete zones","description":"Operations: `create` (`pdfId`, `page`, `type`, `points`, optional `name`, `color`, `visible`, `ref`; defaults as the app's zone tools: names \"Zone n\", \"Exclude n\", \"Area n\", the app's colours, shown), `update` (`id` or `{ ref }`, and any of `name`, `points` (reshape; the zone keeps its id), `type` (retype), `color`, `visible` (show or hide)), `delete` (`id` or `{ ref }`). A zone never moves to another drawing or page: delete it and create another. Points are in page points with the origin top-left and y down, and must lie on the page; a polygon has at least 3 points and must enclose an area. Polygons that cross themselves are accepted, as in the app. Per-operation codes: PDF_NOT_IN_PROJECT, PAGE_OUT_OF_RANGE, OUT_OF_BOUNDS, NOT_FOUND, INVALID_COLOR, TEXT_TOO_LONG, INVALID_VALUE, LIMIT_REACHED, DUPLICATE_REF, UNKNOWN_REF.\n\nApplies 1–500 operations in order, all or nothing, and raises the project's state version by one. 422 VALIDATION_FAILED lists every invalid operation (details.ops, each with its index and code); 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale (details.currentVersion).\n\nRequired scope: `edit`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["create"]},"ref":{"type":"string"},"pdfId":{"type":"string","format":"uuid"},"page":{"type":"integer"},"type":{"type":"string","enum":["INCLUSION","EXCLUSION","AREA"]},"points":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"name":{"type":"string"},"color":{"type":"string"},"visible":{"type":"boolean"}},"required":["op","pdfId","page","type","points"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["update"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"name":{"type":"string"},"points":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}},"type":{"type":"string","enum":["INCLUSION","EXCLUSION","AREA"]},"color":{"type":"string"},"visible":{"type":"boolean"}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["delete"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]}},"required":["op","id"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and one result per operation, in order","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"op":{"type":"string","enum":["create"]},"id":{"type":"string"},"ref":{"type":"string"},"zone":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"name":{"type":"string"},"type":{"type":"string","enum":["INCLUSION","EXCLUSION","AREA"]},"points":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"visible":{"type":"boolean"},"color":{"type":["string","null"]},"area":{"type":"object","properties":{"squareMeters":{"type":"number"},"value":{"type":"number"},"unit":{"type":"string","enum":["m2","ft2"]},"formatted":{"type":"string"},"scaleIsDefault":{"type":"boolean"}},"required":["squareMeters","value","unit","formatted","scaleIsDefault"]}},"required":["id","pdfId","page","name","type","points","visible","color","area"]}},"required":["op","id","zone"]},{"type":"object","properties":{"op":{"type":"string","enum":["update"]},"id":{"type":"string"},"zone":{"type":"object","properties":{"id":{"type":"string"},"pdfId":{"type":"string"},"page":{"type":"integer"},"name":{"type":"string"},"type":{"type":"string","enum":["INCLUSION","EXCLUSION","AREA"]},"points":{"type":"array","items":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"]}},"visible":{"type":"boolean"},"color":{"type":["string","null"]},"area":{"type":"object","properties":{"squareMeters":{"type":"number"},"value":{"type":"number"},"unit":{"type":"string","enum":["m2","ft2"]},"formatted":{"type":"string"},"scaleIsDefault":{"type":"boolean"}},"required":["squareMeters","value","unit","formatted","scaleIsDefault"]}},"required":["id","pdfId","page","name","type","points","visible","color","area"]}},"required":["op","id","zone"]},{"type":"object","properties":{"op":{"type":"string","enum":["delete"]},"id":{"type":"string"}},"required":["op","id"]}]}}},"required":["stateVersion","results"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), STATE_TOO_LARGE or PDF_PROCESSING_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the PDF reader is busy; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/rules":{"get":{"summary":"A project's detection rules and drawing profile","description":"The rules that turn drawing text into symbols, in the order they are tried (the first rule whose pattern matches a text takes it), and the project's drawing profile. A rule with an empty pattern (`kind: manual`) is a manual-only item type: its symbols are placed with the symbols batch, never detected. `serverDetection` says whether the server can detect a rule's pattern (`on`), or not (`off`: a rule written in the app that the server's engine does not run; `invalid`: not a valid regular expression, it matches nothing). While an enabled rule is `off`, batches that change what rules match are refused until that rule is changed in the app, or disabled or deleted.\n\nRequired scope: `read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"A project's detection rules and drawing profile","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"drawingProfile":{"type":"string"},"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"pattern":{"type":"string"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayLabel":{"type":"string"},"kind":{"type":"string","enum":["text","manual"]},"serverDetection":{"type":["string","null"],"enum":["on","off","invalid"]}},"required":["id","name","type","pattern","color","enabled","displayLabel","kind","serverDetection"]}}},"required":["stateVersion","drawingProfile","rules"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/projects/{id}/rules/batch":{"post":{"summary":"Create, change, enable, disable and delete rules; set the drawing profile","description":"Operations: `create` (`name`, `type`, and `pattern` or `match` for a text rule, neither for a manual-only rule; optional `color` (default: the app's colour for the type), `enabled` (default true), `displayLabel`, `ref`), `update` (`id` or `{ ref }`, and any of `name`, `type`, `pattern` or `match`, `color`, `enabled` (enable or disable), `displayLabel`), `delete` (`id` or `{ ref }`: the rule and all its symbols go, placed ones included, as in the app), `setDrawingProfile` (`profile`; `replaceRules: true` makes the rules that profile's defaults, false only sets the profile). A rule made here is the rule the app's rule form makes.\n\nWhat happens to symbols, as in the app: symbols of a rule take its new colour, type and display label; when the batch changes what rules match (a text rule created, a pattern changed, a rule enabled or disabled or deleted, the rules replaced), every drawing of the project is detected again with the rules the batch leaves, keeping placed symbols and the positions of symbols the user moved. `textDetection.drawings` gives each drawing's detected symbols. The server writes a drawing's exact detection or nothing, never a partial one, so when a drawing cannot be detected exactly the whole batch is refused and nothing is applied: REDETECTION_NOT_POSSIBLE (not retryable) when the rules the batch leaves include an enabled rule the server cannot run (`details.ruleIds` and `details.ruleCount`; change it in the app, or disable or delete it in the batch), or a drawing holds text or a file the server cannot handle (`details.pdfId`); PDF_BUSY (503) or PDF_PROCESSING_FAILED (retryable) when the cause may pass: send it again. A project too large to detect again in one request is refused up front (REDETECTION_TOO_LARGE, not retryable): change its rules in the app. Patterns are accepted only when the server can detect them: INVALID_PATTERN (not a valid regular expression) and UNSUPPORTED_PATTERN (`details.reason`: a construct or characters the server's engine does not run, for example non-ASCII characters or lookahead). Other fields of a stored rule the server cannot run (name, colour, type, label, disabling it) can still be changed. Per-operation codes: NOT_FOUND, INVALID_COLOR, TEXT_TOO_LONG, INVALID_VALUE, INVALID_PATTERN, UNSUPPORTED_PATTERN, LIMIT_REACHED, DUPLICATE_REF, UNKNOWN_REF. Free.\n\nApplies 1–500 operations in order, all or nothing, and raises the project's state version by one. 422 VALIDATION_FAILED lists every invalid operation (details.ops, each with its index and code); 422 STATE_TOO_LARGE when the project's contents would become too large to save; 409 VERSION_CONFLICT when `expectedVersion` is stale (details.currentVersion).\n\nRequired scope: `edit`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["create"]},"ref":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["LIGHTING","EMERGENCY_LIGHTING","LIGHTING_CONTROL","POWER","FIRE","DATA","SECURITY","MECHANICAL","UNKNOWN"]},"pattern":{"type":"string"},"match":{"type":"object","properties":{"mode":{"type":"string","enum":["startsWithNumber","startsWith","exact"]},"value":{"type":"string"}},"required":["mode","value"],"additionalProperties":false},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayLabel":{"type":"string"}},"required":["op","name","type"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["update"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]},"name":{"type":"string"},"type":{"type":"string","enum":["LIGHTING","EMERGENCY_LIGHTING","LIGHTING_CONTROL","POWER","FIRE","DATA","SECURITY","MECHANICAL","UNKNOWN"]},"pattern":{"type":"string"},"match":{"type":"object","properties":{"mode":{"type":"string","enum":["startsWithNumber","startsWith","exact"]},"value":{"type":"string"}},"required":["mode","value"],"additionalProperties":false},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayLabel":{"type":"string"}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["delete"]},"id":{"anyOf":[{"type":"string","minLength":1,"maxLength":512},{"type":"object","properties":{"ref":{"type":"string"}},"required":["ref"],"additionalProperties":false}]}},"required":["op","id"],"additionalProperties":false},{"type":"object","properties":{"op":{"type":"string","enum":["setDrawingProfile"]},"profile":{"type":"string","enum":["LIGHTING","NETWORK","POWER","FIRE","SECURITY"]},"replaceRules":{"type":"boolean"}},"required":["op","profile","replaceRules"],"additionalProperties":false}]},"minItems":1,"maxItems":500},"expectedVersion":{"type":"integer","minimum":0}},"required":["ops"],"additionalProperties":false}}}},"responses":{"200":{"description":"The new state version and one result per operation, in order","content":{"application/json":{"schema":{"type":"object","properties":{"stateVersion":{"type":"integer"},"results":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"op":{"type":"string","enum":["create"]},"id":{"type":"string"},"ref":{"type":"string"},"rule":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"pattern":{"type":"string"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayLabel":{"type":"string"},"kind":{"type":"string","enum":["text","manual"]},"serverDetection":{"type":["string","null"],"enum":["on","off","invalid"]}},"required":["id","name","type","pattern","color","enabled","displayLabel","kind","serverDetection"]}},"required":["op","id","rule"]},{"type":"object","properties":{"op":{"type":"string","enum":["update"]},"id":{"type":"string"},"rule":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"pattern":{"type":"string"},"color":{"type":"string"},"enabled":{"type":"boolean"},"displayLabel":{"type":"string"},"kind":{"type":"string","enum":["text","manual"]},"serverDetection":{"type":["string","null"],"enum":["on","off","invalid"]}},"required":["id","name","type","pattern","color","enabled","displayLabel","kind","serverDetection"]}},"required":["op","id","rule"]},{"type":"object","properties":{"op":{"type":"string","enum":["delete"]},"id":{"type":"string"},"symbolsDeleted":{"type":"integer"}},"required":["op","id","symbolsDeleted"]},{"type":"object","properties":{"op":{"type":"string","enum":["setDrawingProfile"]},"drawingProfile":{"type":"string","enum":["LIGHTING","NETWORK","POWER","FIRE","SECURITY"]},"rulesReplaced":{"type":"boolean"}},"required":["op","drawingProfile","rulesReplaced"]}]}},"textDetection":{"type":"object","properties":{"redetected":{"type":"boolean"},"drawings":{"type":"array","items":{"type":"object","properties":{"pdfId":{"type":"string"},"status":{"type":"string","enum":["detected"]},"symbols":{"type":"integer","minimum":0}},"required":["pdfId","status","symbols"]}}},"required":["redetected","drawings"]}},"required":["stateVersion","results","textDetection"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"PROJECT_NOT_FOUND: no such project in the key's workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"VERSION_CONFLICT (details.currentVersion)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"VALIDATION_FAILED (details.ops), STATE_TOO_LARGE, SYMBOL_LIMIT_EXCEEDED (details: kind, limit, current, requested), PDF_PROCESSING_FAILED (a drawing could not be detected again this time; details: reason, retryable, pdfId), REDETECTION_NOT_POSSIBLE (the result cannot be detected exactly on the server; not retryable; details: reason, ruleIds?, ruleCount?, pdfId?), or REDETECTION_TOO_LARGE: the drawings of the project are too large to detect again in one request (not retryable; details: pages, limit, drawings, estimatedMs, budgetMs); nothing was applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"PDF_BUSY: the drawings could not be detected again in time, or the PDF reader is busy (details.reason TIMEOUT or PDF_BUSY); nothing was applied; retry after Retry-After seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/credits":{"get":{"summary":"Credit balance","description":"The workspace's balance and what can be spent now (`available`, the balance minus active holds), and this key's daily credit limit. The key can spend at most the smaller of `available` and a non-null `keyDailyLimit.remaining`.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Credits","content":{"application/json":{"schema":{"type":"object","properties":{"pool":{"type":"string","enum":["personal","team"]},"balance":{"type":"integer"},"available":{"type":"integer"},"buyCreditsUrl":{"type":"string"},"keyDailyLimit":{"type":"object","properties":{"limit":{"type":["integer","null"]},"used":{"type":"integer"},"held":{"type":"integer"},"remaining":{"type":["integer","null"]},"nextReleaseAt":{"type":["string","null"],"format":"date-time"}},"required":["limit","used","held","remaining","nextReleaseAt"]}},"required":["pool","balance","available","buyCreditsUrl","keyDailyLimit"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/credits/transactions":{"get":{"summary":"Recent credit transactions","description":"The workspace's most recent ledger rows, newest first. A personal key sees its owner's ledger. A team key sees the whole team ledger when its user is the team's OWNER or ADMIN; for any other role only the rows that user caused (uploads, exports, AI takeoffs and their refunds), never grants, adjustments, packs or seat changes.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[0-9]{1,3}$"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Transactions","content":{"application/json":{"schema":{"type":"object","properties":{"transactions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"amount":{"type":"integer"},"type":{"type":"string"},"description":{"type":["string","null"]},"projectId":{"type":["string","null"],"format":"uuid"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","amount","type","description","projectId","createdAt"]}}},"required":["transactions"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/credits/estimate":{"get":{"summary":"Estimate an operation","description":"What an upload of `pages` pages would cost, and whether it can be paid now: within `available` (plus `firstLimitBonus`, the one-time bonus a free account still owed it is granted by the upload) and the key's daily limit. Free; changes nothing.\n\nRequired scope: `read`.","security":[{"apiKey":[]}],"parameters":[{"schema":{"type":"string","enum":["upload"]},"required":true,"name":"operation","in":"query"},{"schema":{"type":"string","pattern":"^[0-9]{1,6}$"},"required":true,"name":"pages","in":"query"}],"responses":{"200":{"description":"The estimate","content":{"application/json":{"schema":{"type":"object","properties":{"operation":{"type":"string","enum":["upload"]},"credits":{"type":"integer"},"available":{"type":"integer"},"sufficient":{"type":"boolean"},"firstLimitBonus":{"type":"integer"},"keyDailyLimit":{"type":"object","properties":{"limit":{"type":["integer","null"]},"used":{"type":"integer"},"held":{"type":"integer"},"remaining":{"type":["integer","null"]},"nextReleaseAt":{"type":["string","null"],"format":"date-time"}},"required":["limit","used","held","remaining","nextReleaseAt"]}},"required":["operation","credits","available","sufficient","keyDailyLimit"]}}}},"400":{"description":"INVALID_REQUEST: the request is not valid (details.issues)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY: missing, invalid, expired or revoked key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"INSUFFICIENT_SCOPE: the key lacks the scope this operation needs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMITED: more than 120 requests a minute for this key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"INTERNAL_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"summary":"This document","description":"No key needed. At most 60 requests a minute per IP.","security":[],"responses":{"200":{"description":"The OpenAPI 3.1 document","content":{"application/json":{"schema":{"type":"object","properties":{}}}}}}}}},"webhooks":{}}