{"openapi":"3.1.0","info":{"title":"Pakkeshopper API","version":"1.0.0","description":"Book shipping labels to an address, print them on the shop's print agents and look up carrier pickup points.\n\nAuthenticate with an API key from the app's Settings page: `Authorization: Bearer psk_...`. A key acts for one shop. The API is available on the Max plan and up.\n\nA success is `{ \"data\": ... }`. A failure is `{ \"error\": { \"code\", \"message\", \"fields\"? } }` under a 4xx or 5xx status: branch on the status and the code, never on the message. An unknown path is 404 `not_found`.\n\nSend a request body as JSON in UTF-8, uncompressed, with `Content-Type: application/json`. A body that is not valid JSON is 400 `invalid_request`, a body under another content type, a compressed body or another charset is 415 `invalid_request`, and a body that is too large is 413 `payload_too_large`.\n\nPercent-encode query values as UTF-8 (`N%C3%B8rregade` for `Nørregade`). A URL with a raw non-ASCII character is refused by the HTTP server with a 400 outside the envelope.\n\nLimits per key per 10 minutes: 300 requests, and 100 booking attempts. Every POST /labels is a booking attempt, whether the carrier books the parcel or not (a recipient field at fault or a carrier that is not connected counts too), except a request refused before the booking: a body that is not a JSON object, `print` or `pickup_point_id` at fault, an unknown printer, or an `Idempotency-Key` that is at fault, still in progress or replayed. A replay of a booked label is answered past both limits.\n\nA label booked here has no Shopify order: nothing is captured or fulfilled, and its tracking number is not followed."},"servers":[{"url":"https://app.pakkeshopper.dk/v1"}],"security":[{"apiKey":[]}],"paths":{"/carriers":{"get":{"summary":"Carriers the shop can book labels with","responses":{"200":{"description":"The carrier connections, the vShip-mapped methods and the carriers with a pickup-point lookup.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Carriers"}}}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pickup-points":{"get":{"summary":"Pickup points nearest to an address","parameters":[{"name":"carrier","in":"query","required":true,"schema":{"type":"string","enum":["bring","dao","gls","postnord","postnl","ups","instabox","budbee","helthjem","dhl","hermes","evri","swisspost"]},"description":"Also accepts `posti` (Bring) and `dpd` (PostNord)."},{"name":"country_code","in":"query","required":true,"schema":{"type":"string","maxLength":2,"minLength":2}},{"name":"zip","in":"query","schema":{"type":"string"},"description":"Required where the country has postal codes."},{"name":"city","in":"query","schema":{"type":"string"}},{"name":"address1","in":"query","schema":{"type":"string"},"description":"Street and number. Without it the points are placed by the zip code alone."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":30,"default":10}}],"responses":{"200":{"description":"Nearest first. An empty list means that the carrier has no point there, or that the carrier did not answer the lookup: try again later before you tell a customer that no point exists.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PickupPoint"}}}}}}},"400":{"description":"`invalid_request`, with `fields`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"`carrier_unavailable`: the lookup failed on our side, try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pickup-points/{carrier}/{id}":{"get":{"summary":"One pickup point","parameters":[{"name":"carrier","in":"path","required":true,"description":"The carrier of the point.","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"description":"The point's `id` from the list.","schema":{"type":"string"}}],"responses":{"200":{"description":"The point.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/PickupPoint"}}}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`pickup_point_not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/labels":{"post":{"summary":"Book a label","description":"Books one parcel at the carrier and stores its PDF. Send an `Idempotency-Key` header so a retry after a timeout answers the first booking instead of making a second. The answer of a request that booked is kept under the key; a refusal is not, so the same key can be sent again after the cause is fixed.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":255,"minLength":1},"description":"The answer of a booking is kept for 24 hours per API key."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabelRequest"}}}},"responses":{"201":{"description":"Booked. `print_error` (`printer_not_found` or `queue_failed`) is set when the label was booked and could not be queued.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/LabelBooking"}}}}}},"400":{"description":"`invalid_request`, with `fields` (`recipient.<field>`, `sender.<field>`, ...). Without `fields` for a body that is not a JSON object and for an `Idempotency-Key` that is empty or over 255 characters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`printer_not_found`: nothing was booked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`missing_credentials`, `unsupported_carrier`, `return_unsupported`, `missing_vship_profile`, `missing_shop_address`, `invalid_sender_address` or `request_in_progress`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`payload_too_large`: the body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"`invalid_request`: the body is not `application/json`, is compressed (`Content-Encoding`) or is not in UTF-8.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`carrier_error`: the carrier refused the booking; `message` is its own, with `carrier` and `trace_id`. Or `idempotency_key_reused`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: the key sent too many requests or too many booking attempts (see the limits above), or the address keeps sending keys that are not valid. This request booked nothing. A retry with the same `Idempotency-Key` after the Retry-After header is safe: a key whose label was booked gets its first answer even past the limits.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`booking_not_stored`: the carrier booked the parcel and the label could not be stored. Do not book it again; the error carries `carrier`, `tracking_number` and `trace_id`. A retry with the same Idempotency-Key gets this answer again. Any other 500 booked nothing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`idempotency_unavailable` or `shop_address_unavailable`: nothing was booked, try again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"List labels","description":"The shop's labels without an order, newest first: those booked here and those from the Create label page.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":25}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"One page.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Label"}},"has_more":{"type":"boolean"},"offset":{"type":"integer"},"limit":{"type":"integer"}}}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/labels/{id}":{"get":{"summary":"One label","parameters":[{"name":"id","in":"path","required":true,"description":"The label id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The label, with a fresh `pdf_url`.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Label"}}}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`label_not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/labels/{id}/pdf":{"get":{"summary":"The label PDF","parameters":[{"name":"id","in":"path","required":true,"description":"The label id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The PDF.","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`label_not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/labels/{id}/print":{"post":{"summary":"Print a stored label","description":"Queues the stored PDF on a print agent. Nothing is booked.","parameters":[{"name":"id","in":"path","required":true,"description":"The label id.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrintTarget"}}}},"responses":{"202":{"description":"Queued. Follow it with GET /print-jobs/{id}.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/PrintJobRef"}}}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`label_not_found` or `printer_not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"`payload_too_large`: the body is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"`invalid_request`: the body is not `application/json`, is compressed (`Content-Encoding`) or is not in UTF-8.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/printers":{"get":{"summary":"The shop's print agents","responses":{"200":{"description":"A printer is a computer that runs the Pakkeshopper print agent; `queues` are the printers it reported.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Printer"}}}}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/print-jobs/{id}":{"get":{"summary":"One print job","parameters":[{"name":"id","in":"path","required":true,"description":"The job id.","schema":{"type":"string"}}],"responses":{"200":{"description":"The job.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/PrintJob"}}}}}},"401":{"description":"`unauthorized`: the key is missing, wrong or revoked, or the shop has uninstalled the app.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`plan_not_available`: the shop is below the Max plan.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`print_job_not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`: see the Retry-After header. Also answered to an address that keeps sending keys that are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key from the Settings page (`psk_...`)."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"fields":{"type":"object","additionalProperties":{"type":"string"},"description":"The field at fault and why: `required`, `too_long`, `invalid` or `store_country`."}}}}},"Recipient":{"type":"object","required":["name","address1","zip","city","country_code"],"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":35},"company":{"type":"string","maxLength":35},"address1":{"type":"string","maxLength":35},"address2":{"type":"string","maxLength":35},"zip":{"type":"string","maxLength":10},"city":{"type":"string","maxLength":35},"country_code":{"type":"string","maxLength":2},"phone":{"type":"string","maxLength":20},"email":{"type":"string","maxLength":70}}},"Sender":{"type":"object","required":["name","address1","zip","city","country_code"],"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":35},"address1":{"type":"string","maxLength":35},"address2":{"type":"string","maxLength":35},"zip":{"type":"string","maxLength":10},"city":{"type":"string","maxLength":35},"country_code":{"type":"string","maxLength":2},"phone":{"type":"string","maxLength":20},"email":{"type":"string","maxLength":70}},"description":"Printed on this label only. Must be in the store's country. Without it the shop's saved sender or store address is used. Not used by vShip."},"PrintTarget":{"type":"object","required":["printer_id"],"properties":{"printer_id":{"type":"string","description":"An `id` from GET /printers."},"queue":{"type":"string","description":"One of the printer's `queues`. Without it the printer's default queue."}}},"LabelRequest":{"type":"object","required":["carrier","recipient"],"properties":{"kind":{"type":"string","enum":["outbound","return"],"default":"outbound","description":"A return label is addressed from `recipient` to the sender."},"carrier":{"type":"string","description":"A carrier from GET /carriers, or `vship` with `method_id`."},"method_id":{"type":"integer","description":"With carrier `vship`: a method from `vship_methods`."},"delivery":{"type":"string","enum":["home","pickup","business"],"description":"Required for an outbound label."},"pickup_point_id":{"type":"string","description":"Required with delivery `pickup`: an `id` from GET /pickup-points."},"recipient":{"$ref":"#/components/schemas/Recipient"},"sender":{"$ref":"#/components/schemas/Sender"},"weight_kg":{"type":"number","minimum":0.01,"maximum":50,"description":"Without it the parcel is booked at 0.5 kg."},"reference":{"type":"string","maxLength":35,"description":"Your own reference, printed where the carrier prints one."},"print":{"$ref":"#/components/schemas/PrintTarget"}}},"Label":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["outbound","return"]},"carrier":{"type":"string"},"delivery":{"type":["string","null"],"enum":["home","pickup","business"]},"tracking_number":{"type":["string","null"]},"tracking_url":{"type":["string","null"]},"reference":{"type":["string","null"]},"recipient":{"$ref":"#/components/schemas/Recipient"},"pickup_point":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"address":{"type":["string","null"]}}},"weight_kg":{"type":["number","null"]},"created_at":{"type":"string","format":"date-time"},"pdf_url":{"type":["string","null"],"description":"Opens the PDF without a key for 24 hours."}}},"PrintJobRef":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"printer_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending"]}}},"LabelBooking":{"type":"object","required":["label","print_job"],"properties":{"label":{"$ref":"#/components/schemas/Label"},"print_job":{"oneOf":[{"$ref":"#/components/schemas/PrintJobRef"},{"type":"null"}]},"print_error":{"type":"string","enum":["printer_not_found","queue_failed"]}}},"PickupPoint":{"type":"object","properties":{"id":{"type":"string"},"carrier":{"type":"string"},"name":{"type":["string","null"]},"address1":{"type":["string","null"]},"address2":{"type":["string","null"]},"zip":{"type":["string","null"]},"city":{"type":["string","null"]},"country_code":{"type":["string","null"]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"distance_km":{"type":["number","null"],"description":"Null when the address could not be placed, and on a single point."},"staffed":{"type":["boolean","null"],"description":"False for a parcel locker; null when the carrier does not say."},"opening_hours":{"type":["object","null"],"description":"By lowercase weekday: `{ \"monday\": { \"open\": \"08:00\", \"close\": \"20:00\" } }`."}}},"Carriers":{"type":"object","properties":{"carriers":{"type":"array","items":{"type":"object","properties":{"carrier":{"type":"string"},"deliveries":{"type":"array","items":{"type":"string","enum":["home","pickup","business"]}},"return_label":{"type":"boolean"}}}},"vship_methods":{"type":"array","items":{"type":"object","properties":{"method_id":{"type":"integer"},"name":{"type":"string"},"carrier":{"type":["string","null"]},"delivery":{"type":"string","enum":["home","pickup"]}}}},"pickup_point_carriers":{"type":"array","items":{"type":"string"}}}},"Printer":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"online":{"type":"boolean","description":"Seen in the last 5 minutes. A job for an offline printer waits up to 12 hours."},"last_seen_at":{"type":["string","null"],"format":"date-time"},"default_queue":{"type":["string","null"]},"queues":{"type":"array","items":{}},"is_default":{"type":"boolean"}}},"PrintJob":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","sent","printed","error","expired"]},"printer_id":{"type":"string","format":"uuid"},"queue":{"type":["string","null"]},"error":{"type":["string","null"]},"error_code":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"printed_at":{"type":["string","null"],"format":"date-time"}}}}}}