tracer.ch ordering API

English · Deutsch · Français · Italiano

Send us a PDF, print options and a delivery address in one request. We print it and ship it to that address.

Quickstart

One request places an order. The document is analysed, the options checked against what it turns out to be, and the order priced and placed before you get a response — so if something is wrong, the response says exactly what.

curl -X POST https://app.tracer.ch/api/v1/test/orders \
  -H 'Idempotency-Key: my-order-4711' \
  -F 'files[]=@plan.pdf;type=application/pdf' \
  -F 'order={
        "reference": "MY-ORDER-4711",
        "address": {
          "billing": {
            "firstName": "Ada", "lastName": "Lovelace",
            "address": "Bahnhofstrasse 1", "postalCode": "8001", "city": "Zürich",
            "email": "ada@example.ch", "invoiceEmail": "billing@example.ch",
            "phone": "+41 44 000 00 00"
          },
          "shipping": { "sameAsBilling": true },
          "project": { "name": "Course 2026-11" }
        }
      };type=application/json'

That is the whole minimum: a file and an address. Every print option defaults to what our order page would show immediately after uploading that document, so you only send the ones you want to change.

The example goes to the test server, so nothing is printed. Read Testing below before you send an order to the live address.

Testing

Build against the test server, https://app.tracer.ch/api/v1/test: the same API, and nothing is printed. An order sent there is analysed, checked, priced and stored exactly like a real one, and answered with "test": true. It is never printed, nobody is e-mailed, and it is never invoiced.

A test order stays pending, and it is read from the test server: GET https://app.tracer.ch/api/v1/test/orders/{orderId}.

When you are done, change https://app.tracer.ch/api/v1/test to https://app.tracer.ch/api/v1 — nothing else changes: the requests, the responses, the errors and the prices are the same. An Idempotency-Key you used on the test server is still free on the live one, so the first live request places a real order rather than replaying a test one.

An order sent to https://app.tracer.ch/api/v1 is a real order: printed, shipped and invoiced.

Print options

Options belong to an item, and an item belongs to a document. Which values are available depends on the size the document prints at — so scaling an A4 up to A3 changes what it can be folded and finished with.

Omit items entirely and each file is printed as it comes. Two items may point at the same file (fileIndex) to order it twice with different options. GET /options answers these tables as JSON, so you can build a form without hard-coding our values.

Large format is anything bigger than A3, priced by area.

color

Format Available
A6 (postcard) bw colored
A5 bw colored
A4 bw colored
A3 bw colored
Large format bw colored

sides

Format Available
A6 (postcard) single double
A5 single double
A4 single double
A3 single
Large format single

paperQuality

Format Available
A6 (postcard) quality80 quality120 quality160 quality200 quality300 qualityTransparent
A5 quality80 quality120 quality160 quality200 quality300 qualityTransparent
A4 quality80 quality120 quality160 quality200 quality300 qualityTransparent
A3 quality80 quality120 quality160 quality200 quality300 qualityTransparent
Large format quality90 quality60 quality120 quality200 qualityTransparent

finishing

Format Available
A6 (postcard) none
A5 none
A4 none stapled punched stapleAndPunch wireBindingBlack wireBindingWhite thermalBindingBlack thermalBindingWhite laminated
A3 none stapled punched stapleAndPunch wireBindingBlack wireBindingWhite thermalBindingBlack thermalBindingWhite laminated
Large format none laminated

folding

Format Available
A6 (postcard) rolled
A5 rolled
A4 loose
A3 folded rolled zfold
Large format folded rolled

borderless

Format Available
A6 (postcard) no yes
A5 no yes
A4 no yes
A3 no yes
Large format no yes

Availability also depends on the document itself: stapling needs more than one page, holds 100 sheets and only closes over 80 g/m² paper; bindings hold 400 sheets. Printing double-sided halves the sheets a document needs, so twice as many pages fit. The tables above assume a two-page document. If you ask for something a particular document cannot take, the error says why and lists what it can take.

Order status

Poll GET /orders/{orderId}. It answers the order's orderId and its status, which moves through:

Status Meaning
pending We have the order and have not started it.
processing In production.
sent Dispatched. The order's e-mail address gets the dispatch notice, with the tracking link when the carrier gives us one.
invoiced Invoiced.
paid Paid.
complete Closed.
canceled Cancelled; it will not be printed.

sent is the one worth watching if you are telling someone their plan is on the way. Polling once a minute is plenty: a status changes as the job moves through production, not by the second. The full order, with its price breakdown, is what placing it answered; a read does not repeat it, so keep that response.

Retries

Send an Idempotency-Key on every order. If your request times out and you retry with the same key, you get the order that was already created — 200 with Idempotent-Replay: true — instead of a second copy printed and posted.

Reusing a key for a genuinely different order is a 409: that is a bug on your side, and we would rather say so than quietly hand back the wrong order.

Errors

Every failure is an RFC 9457 problem document, application/problem+json. Branch on code, not on the wording of detail. Where a specific field is at fault, errors[] points at it with a JSON Pointer into the payload you sent.

{
  "type": "https://app.plotten.ch/problems/option-unavailable",
  "title": "A print option is not available for the document it was given.",
  "status": 422,
  "detail": "One print option is not available for the document it was given.",
  "instance": "/api/v1/orders",
  "code": "option_unavailable",
  "requestId": "jk6gxv3ryonzusyn",
  "errors": [
    {
      "pointer": "/items/0/finishing",
      "code": "option_unavailable",
      "detail": "Stapling needs more than one page; this document has 1.",
      "allowed": ["none", "laminated"]
    }
  ]
}

Every response carries X-Request-Id, and it appears as requestId in the body. Quote it if you contact us — it is how we find your exact request.

type identifies the code as a URI and opens as a page explaining it; code is the same thing as a word, for your switch.

code What it means
validation_error A field is missing or malformed. errors[].pointer says which.
option_unavailable A print option is not available for the document it was given. errors[].allowed lists what would have worked.
print_size_out_of_range The scaling puts the print outside what we can produce. The message names the scaling that would fit.
too_many_pages The document has more pages than the API accepts in one file.
invalid_pdf The file is not a readable PDF.
analysis_failed We could not analyse the document. Retry; if it persists, send it to us.
analysis_unavailable That document took longer to analyse than the API waits. Retry after the interval in Retry-After; a very large plan may need the order page instead.
analysis_budget_exceeded The order as a whole took longer than one request may spend analysing. Split it into smaller orders — sending the same one again will take just as long.
voucher_invalid The voucher does not exist, is spent, or has expired.
malformed_request The request could not be read: the order part is not valid JSON, or a text field carries bytes that are not UTF-8.
invalid_idempotency_key The Idempotency-Key header is longer than we store, or is not UTF-8. A uuid is plenty.
order_not_found No order with that id.
not_found No route matches this path.
method_not_allowed That HTTP method is not allowed on this path. The Allow header lists the ones that are.
idempotency_conflict That Idempotency-Key was used for a different order. Use a new one.
rate_limited Slow down; Retry-After says by how much.
payload_too_large The whole request is larger than the server accepts at all — far beyond the per-file limit, which is a validation_error. Split the order.
service_unavailable The API is temporarily closed. Retry after the interval in Retry-After.
internal_error Our fault. Retry, and send us the requestId if it persists.
request_rejected The request was rejected for a reason not covered by the codes above.

Each entry in errors carries a code of its own, for the one field it points at:

errors[].code What it means
invalid_field The field failed a plain validation rule — required, a type, a length, one of a set of values.
out_of_range A number outside the range the parameter accepts, such as perPage.
malformed_date Not an RFC 3339 date, or a day its month does not have.
unsortable_field sort names a field the list cannot be sorted by.
unknown_field fields names a path the resource does not have.
too_many_fields fields names more paths than one request may ask for.
malformed_field_path A fields path that is not dotted names — price[total] rather than price.total.
fields_not_a_string fields was sent as a list; send one comma-separated string.
malformed_request Text that is not valid UTF-8.
option_unavailable Not available for this document. allowed lists what is.
print_size_out_of_range The scaling prints outside A6 to 1500mm on both sides. detail names the scaling that fits.
too_many_pages The document has more pages than one file may.
voucher_invalid The voucher does not exist, is spent, or has expired.

Limits

Limit Value
Files per order 30
Quantity per item 1000
File size 50 MB
Pages per file 500
Smallest print 105 × 148 mm (A6)
Largest print 1500 mm — on both sides at once; one side may be longer

Rate limits

Placing orders Reading
Per caller 2/min, 5/hour, 20/day 30/min

Reads and writes are counted separately, so polling an order can never use up your ability to place one. A 429 carries Retry-After.

Delivery is within Switzerland. Postal codes are four digits and there is no country field. Prices are CHF and include 8.1% VAT.

The machine-readable description of all of this is https://app.plotten.ch/api/openapi.json (OpenAPI 3.1): import it into Postman, Insomnia, or whatever generates your client.

Questions go to alexander.loy@loy.ch.

Endpoints

Orders

POST/orders — Place an order
Upload the PDFs and the order in one multipart request. The documents are analysed, the options checked against what they turn out to be, and the order priced and placed before the response — so a rejection tells you exactly what to change.

GET/orders/{orderId} — Get an order's status
This is what you poll. The full order, with its price breakdown, is what placing it answered; a read does not repeat it. Readable by whoever holds the id. An order placed on the test server is read from the test server.

Reference

GET/options — Print options, limits and VAT
Everything a form needs to offer the right choices: currency and VAT, the delivery country, the limits, the order statuses, the delivery methods, every print option's values, and which of them each sheet size can take. Read it rather than hard-coding our vocabulary.