Reports

Create reports, collaborate on the JSON payload, and generate PDFs into location documents.

Render a complete client document

Applications that already generate their own HTML can send the finished document to POST /v1/document-libraries/location/{locationId}/documents/render-pdf?folderPath=Aufmass. Use Content-Type: text/html; charset=utf-8 and place the complete HTML in the body. The maximum HTML size is 32 MiB. Embed CSS, fonts and images; scripts and external resource requests are disabled during rendering. Chromium uses the supplied print CSS, page sizes and page breaks, with background graphics enabled.

This endpoint requires LocationDocuments=Write at the exact destination folder, including current organization entitlements and any PAT restrictions. Use an empty folderPath for the document root. A successful response contains PDF bytes with Content-Type: application/pdf; it does not create a report, template or stored document. Upload the returned file through the document upload workflow using the same location and folder. Upload completion independently checks current write access and storage quota. Open the returned document ID after completion.

Rendering requires the configured Chromium background service. Unavailable service returns 503, busy capacity 429, and a rendering timeout 504. Treat all non-2xx responses as errors and never upload an error response as a PDF.

Overview

Reports use their own API routes.

  • GET /v1/reports/templates
  • GET /v1/reports/templates/{key}
  • POST /v1/reports/templates/users/me
  • POST /v1/reports/templates/organizations/{organizationId}
  • PUT /v1/reports/templates/{templateId}
  • DELETE /v1/reports/templates/{templateId}
  • GET /v1/reports/locations/{locationId}
  • POST /v1/reports/locations/{locationId}
  • GET /v1/reports/{reportId}
  • PUT /v1/reports/{reportId}
  • DELETE /v1/reports/{reportId}
  • POST /v1/reports/{reportId}/collaboration/bootstrap
  • POST /v1/reports/{reportId}/generate-pdf
  • GET /v1/reports/jobs/{jobId}
  • GET /v1/reports/structured-capabilities
  • POST /v1/reports/locations/{locationId}/structured-commits
  • GET /v1/reports/locations/{locationId}/structured/{clientReportId}
  • GET /v1/reports/locations/{locationId}/structured
  • GET /v1/reports/{reportId}/revisions/{revision}
  • GET /v1/reports/locations/{locationId}/person-hours

Canonical field reports (opt-in)

The generic template and collaboration workflow below remains available for existing reports. Generic v1 list/get excludes structured report heads because their canonical source is available through the structured list and revision routes; generic update/delete and collaboration checkpoints cannot change them. New field-app Regieberichte, Protokolle and FotoDokus may use a revisioned database source when structured-capabilities advertises schema version 2 and their kind. The endpoint returns empty schemaVersions and kinds until structured source storage is enabled. App and MCP callers receive the same source capabilities. PDF availability is separate: pdfRenderingReady describes renderer/font readiness and scannedPagePdfRenderingReady additionally requires the scan-page processor. A PDF outage never changes an accepted report into a legacy PDF-only upload. A missing endpoint means an older server. Once a client report has a canonical receipt, clients must resume its revisioned flow; they must not upload a generic JSON/PDF replacement.

POST /v1/reports/locations/{locationId}/structured-commits accepts an immutable source snapshot with clientReportId, a unique operationId for that snapshot, expectedRevision (0 creates), kind, schemaVersion:2, title, sourceJson, spatialProjectId (actual server project ID, or null), optional lvStem, businessDate and timeZoneId, renderContext, and ordered assetManifest. The exact UTF-8 source text is retained alongside validated JSONB facts. sourceSha256 in the receipt is SHA-256 of those exact UTF-8 bytes. The request hash also covers scope, context and assets. Repeating the same operation returns its original receipt after current write authorization, even if enrollment has since been paused or an asset has disappeared. Reusing its ID with different content or writing against a stale revision returns 409 with a stable code. 503 report_structured_unavailable means new opt-in writes are disabled.

Shared source contract and editing

The capability response includes sourceSchemas, keyed by regiebericht, protokoll and fotodoku. These version-2 source schemas are also bundled with the iOS client. The commit envelope owns clientReportId, server scope and revision identity. Optional source id must agree with clientReportId; a source projectId is a device-local workspace identifier, never the server project. Missing local identity and display fields are restored by the app from the verified envelope and documented defaults. Existing explicit dates, answers, measurements and attachment versions are retained.

A FotoDoku can be created, read and edited before any PDF exists. originalPdf is optional evidence, not a prerequisite for recovering the source. Native iOS capture continues to render its local PDF and keeps the original as evidence. Updating the source creates a new report revision; it does not overwrite that original file. Keep the FotoDoku source title equal to the envelope title, each photo caption equal to its manifest caption, and scanPageCount equal to the page list length. FotoDoku uses only photo, originalPdf and scan-pages-pdf bindings; each PDF reference has order zero and no caption. These checks prevent accepting sources that a native editor cannot restore.

For MCP editing, get_site_report returns canonicalRevision with the complete sourceJson, revision, clientReportId, physical project/LV identity, render context and immutable asset manifest. Submit the edited source with that expectedRevision and a new operationId through commit_site_report. Preserve unchanged context and asset references. A transport retry repeats the exact operation and payload; a conflicting revision requires reading and reconciling the current source. List results remain summaries. Reads still require live report authorization.

MCP report preview, commit and draft-save requests accept up to 1 MiB of serialized JSON; the source itself remains limited to 512 KiB and the manifest to 500 entries. Single-report and draft reads allow up to 4 MiB for MCP's text and structured copies. Other tools retain their smaller request/response limits. Older generic/PDF-only reports are preserved and are not silently converted or duplicated.

When an LV is bound, clients first require structured-capabilities.supportsLvSourceIdentity: true and submit lvSourceArtifactId as the server-proven canonical source artifact ID. The server checks independent document read access and exact owner/location/project scope, then pins that ID on the report head and every revision. The commit receipt echoes the accepted ID; a client must retain a pending operation if the echo is absent or different. The source ID is visible only while the caller can independently read that document in the report scope; a redacted null response is not evidence that the stored binding is legacy or absent. Exact source filtering also requires document read. The structured list and revision responses expose the pinned ID, and the list accepts an exact lvSourceArtifactId filter. Two independent LVs may share a stem without sharing reports. A bound source ID cannot change on later revisions; lvStem remains a display label and may be renamed after binding. Older clients that omit lvSourceArtifactId on an update or tombstone inherit the existing bound ID under their report write permission. The server checks the stored source's scope and identity internally; the client does not need document read permission to keep that binding. Its submitted operation keeps the original retry hash, and the receipt omits the source ID unless it is independently readable. Supplying a different ID is rejected; explicitly supplying the existing ID still requires document read. Historical reports with no source ID remain null and are never silently attributed to a new LV. Null-only historical operations retain their original idempotency hash and replay behavior. The source artifact cannot be deleted while a retained report references it.

Each asset manifest entry names an authorized document ID, exact version, SHA-256, binding, order and optional caption. Images must be pinned PNG/JPEG; FotoDoku scan pages require one pinned scan-pages-pdf PDF (at most 8 MB), with pages and scanPageCount in source. The source may also retain an originalPdf evidence reference. An asset from a different location or project is rejected. A client-local projectId inside sourceJson is provenance only; it never chooses server access or output destination.

The commit receipt contains reportId, clientReportId, operationId, revision, sourceSha256, assetsReady, pdfReady, pdfDocumentId and pdfSha256 when a verified PDF is available. A client can recover the current accepted source by clientReportId, or read an exact older revision by report ID and revision. Exact revision reads also return locationId and spatialProjectId, so a shared PDF can be matched to its report scope. Scope-aware list supports scope=building|project|all, spatialProjectId, lvScope=none|stem|all, lvStem, offset and limit. These are bounded, report-authorized reads; a server project can contain several LV workspaces. isDeleted:true with a new operation and current expected revision records a tombstone and excludes that report from effective totals while retaining history. The tombstone retains the previous exact source/context/manifest, so deleted assets need not still be live.

Canonical PDF generation uses the existing POST /v1/reports/{reportId}/generate-pdf route with sourceRevision set to the accepted revision. Poll the existing job route and read GET /v1/reports/{reportId}/revisions/{revision} for pdfReady, the exact authorized pdfDocumentId and pdfSha256; the job also supplies documentSha256 when its output is still valid. Match the downloaded PDF bytes to that SHA-256 before sharing or caching them. A document ID can retain its identity after an in-place upload changes its bytes, so the server withdraws PDF readiness and the job download URL if the artifact's checksum, type or scope no longer matches the published revision. structured-capabilities.maxPdfBytes is 128000000; a larger rendered canonical PDF fails with report_pdf_too_large before storage reservation or publication, leaving the accepted facts intact. The task pins source, display context, organization branding/logo, authorized asset versions, renderer and font identity before rendering. Successful publication places a project report in that server project's document library and a building report in its location library. Accepted facts stay in the database if PDF generation fails. A deleted report or unsupported worker cannot silently publish an older or generic PDF.

An MCP connection can create these same canonical revisions only after the user grants the reports.write consent option together with pixatlas.write. The MCP tools expose current creation capabilities and exact, SHA-256-pinned native protocol templates, validate a typed source in preview_site_report, commit it through the same revision-checked service in commit_site_report, and queue an exact accepted revision through queue_site_report_pdf. Accepted revisions retain the server-resolved user, agent, connection and grant; technician names and signatures remain facts in the report source. A revoked or expired grant prevents queued PDF execution or publication.

Protocol attachments with the known general role retain their exact source and asset manifest binding. The native protocol PDF does not place this role on a page, so the canonical renderer explicitly keeps it out of the visible PDF while still verifying its authorized version and checksum. Unknown asset roles are rejected. The same immutable image may appear in more than one attachment relation with distinct binding, field target or order. Repeated relations must use the same document version, checksum and caption so another device can reconstruct the shared image without losing placement or metadata.

GET /v1/reports/locations/{locationId}/person-hours?fromBusinessDate=yyyy-MM-dd&throughBusinessDate=yyyy-MM-dd returns exact decimal crew person-hours for the authorized, current, nondeleted Regiebericht revisions. Optional spatialProjectId narrows scope. It reports excluded ambiguous dates and conflicted/overprecise hours with coverageComplete; it does not guess worker identity, civil dates or material units.

Protocol templates

An organization's own protocol templates are JSON documents in its organization library. The document type protocol-template is the published template, and each publication is a new version of that document. protocol-template-draft is its draft, a separate document paired by customMetadata.templateId. List both with the organization library's document list and documentTypes=protocol-template,protocol-template-draft. Every write of a template's content requires ReportTemplatesManage on top of the library's Write: an upload, a new version, a revert, a publication from the collaborative text editor and an MCP publication or restore. GET /v1/reports/protocol-template-starters returns the eleven ready-made templates to copy from.

structured-capabilities.protocolTemplateSchemaVersions lists the template formats a protocol may pin; a server without that field accepts format 1 only. Format 2 adds the field kind number with a unit of up to 20 characters, the field flags required and photoRequired for the form, and signatures, a list of up to ten signers with id, title and rule (required or present). A typed answer to a number field is {"number":{"_0":2.5}}. The source carries signatures as signatures, an object from signer ID to a base64 PNG or JPEG. A format 2 protocol prints what its template names: it has no fixed free texts, customer block or signature pair.

Canonical Project report view

When GET /v1/reports/structured-capabilities advertises supportsCanonicalProjectContext: true, a Project view may request GET /v1/reports/locations/{locationId}/structured?scope=project&spatialProjectId={projectId}&canonicalContext=true. This adds building-scoped structured reports whose pinned lvSourceArtifactId is associated with that Project. A derived row is returned only when the actor has both ReportsRead and independent Document Read on the source. The row's canonicalProjectId identifies the effective Project; spatialProjectId retains its physical report scope. Omit the flag to keep the original physical Project list. The list does not infer membership from lvStem or other client-supplied metadata. An older client may keep writing a building-scoped report against its building-scoped LV after association; its accepted revisions, operation receipts and hashes remain unchanged. New Project-scoped reports may pin an actively associated building LV source. Detaching the LV prevents new attribution to that Project, but accepted report revisions retain their source pin and remain readable under current report and document permissions. A later retry of an accepted operation returns its original receipt.

Workflow

  1. Create or list templates owned by an accessible organization. Private user templates remain available only to their owning interactive session for legacy compatibility.
  2. Load one template by key.
  3. Read contentTemplateJson from that template.
  4. Fill the JSON on the client, including normal fields, image references, and the main markdown body.
  5. Create a report row for the target location with that filled JSON.
  6. Edit the report JSON directly or bootstrap collaboration for that report.
  7. Call generate-pdf when the report is ready.
  8. Poll GET /v1/reports/jobs/{jobId} until the PDF is ready.

The editable report draft stays separate from the generated PDF. When generation finishes, the PDF appears in the location document library.

Access requirements

For location reports, PixService evaluates the exact current actor and the current PAT ceiling when a personal access token is used. ReportsRead and ReportsWrite may be assigned at organization, cluster, or location scope, and PixService decides them in two steps:

  1. Organization first. Whoever holds the capability for the organization may use the reports of every location in it. A cluster or location assignment of None does not take that away.
  2. Only when the organization refuses, PixService decides again at the report's location. There the nearest explicit assignment wins along the organization → cluster → location path, so a cluster or location grant gives report access to someone without an organization grant.

To keep a group out of one location's reports, do not give it the capability for the organization; grant it on the clusters or locations it may use instead. A shared-cluster workflow can grant these capabilities explicitly within its cluster, but a document or cluster-view grant alone does not grant report access. Legacy Contributor cluster shares are the exception: they grant ReportsRead and ReportsWrite, including delete, in every location of their cluster. No assignment narrows that; only a different share role or removing the share does. The report's actual location and parent cluster determine the scope; report IDs are evaluation contexts, not separate assignment targets.

  • Discovering the location requires LocationView=Read.
  • Listing and reading reports requires ReportsRead, decided as above.
  • Creating, changing, deleting, or generating reports requires ReportsWrite, decided as above.
  • Reading organization templates requires organization-scoped ReportsRead; template management remains under organization-scoped ReportTemplatesManage.
  • PDF publication requires LocationDocuments=Write at the exact destination folder path.
  • Referenced report images require LocationDocuments=Read at their exact source paths.
  • Organization branding is included only with OrganizationBrandingRead.

These are final tier-capped decisions. A PAT can only reduce the user's effective access. Private user-owned templates and legacy user-owned reports are session-only compatibility surfaces; PATs cannot use them and they never grant organization access.

Template Model

Each template record stores:

  • the template key and display name
  • the HTML shell template
  • the CSS stylesheet template
  • the CSS media type
  • contentTemplateJson, which is the JSON skeleton clients can fetch and fill
  • bodyFieldPath, which tells PixService where the main markdown body lives inside the report JSON

Templates can use values from the JSON payload plus reserved metadata under:

  • report.*
  • location.*
  • template.*
  • branding.*

The main report body is markdown stored inside the report JSON. Raw HTML in that markdown is preserved, so the body can mix markdown and HTML freely.

If a template leaves htmlLayoutTemplate empty, PixService uses a default wrapper layout.

Example image helpers:

{{ image "imageInputs.coverImage" }}

{{ image_list "imageInputs.gallery" 2 }}

Inside the HTML shell, body_html contains the rendered body content and stylesheet_css contains the rendered stylesheet.

Image Inputs

Image values can be:

  • a string path such as photos/cover.jpg
  • an object with documentPath and optional caption
  • an array of those values for image galleries

Preferred paths are stable location-document paths relative to documents/. If a document has multiple versions, omit the v00000001 segment and PixService uses the latest matching version.

Branding Variables

Branding is template-controlled. Templates receive a branding object and decide whether and where to place colors, names, or logos.

Typical examples:

  • branding.organization_name
  • branding.brand_name
  • branding.slogan
  • branding.primary_color
  • branding.secondary_color
  • branding.accent_color
  • branding.logo_data_url
  • branding.banner_data_url

For organization-owned locations, branding comes from the organization's branding settings when the current actor has OrganizationBrandingRead.

Use the Organization Branding workflow to manage brand name, slogan, colors, logo, and banner for one organization.

Legacy user-owned locations, organizations without configured branding, or actors without branding read access may render with an empty or partial branding object, so templates should keep fallbacks.

Collaboration

Use POST /v1/reports/{reportId}/collaboration/bootstrap to open the existing collaboration flow for a report draft.

Collaboration edits the report JSON draft directly. If the report was created without contentJson, the initial draft comes from the selected template's contentTemplateJson.

The normal publish action does not apply to report drafts. Generate the PDF from the report instead.

PDF Output

Call POST /v1/reports/{reportId}/generate-pdf when the report is ready.

The response gives you a job id. Poll GET /v1/reports/jobs/{jobId} until the job finishes.

When the job succeeds, the generated PDF is added to the location document library and becomes the latest generated PDF for that report.

Generation is a requester-attributed durable task. PixService records the actor and current entitlement/policy fingerprint at scheduling, reserves the Document destination, then rechecks the live requester, report, template, source images, destination path, and actual output size immediately before publication. A task that loses authority ends as AuthorizationChanged; a task that loses capacity ends as CapacityChanged.

Job status and report responses include generated-document metadata only while the polling actor can currently read that Document. A successful task can therefore remain successful while its document id, filename, size, and download URL are omitted after access changes.

The current API does not provide recurring report schedules, recipient delivery, or a separate rendered-output cache. LatestGeneratedDocumentId points to the latest ordinary location Document, which is re-authorized whenever it is returned.

ZIP export is not part of the current workflow.

On this page