{"openapi":"3.1.0","info":{"title":"Printer Gateway API","version":"1.0.0","description":"Print PDFs to printers on your network from anywhere. Jobs are queued, handed to an online gateway that has the printer installed, and tracked until the spooler reports them done.\n\n## Authentication\n\nEvery request goes to `https://printergw.com/api/v1` and carries an API key as a bearer token:\n\n```http\nAuthorization: Bearer pgw_live_xxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n```\n\nKeys are created on the [API keys page](/dashboard/api-keys) of the Printer Gateway dashboard and shown once. Each key has scopes and a per-minute rate limit (see Rate limits below). The scopes:\n\n- `printers:read`: List printers and see where they are installed.\n- `jobs:write`: Submit PDFs to print and cancel jobs.\n- `jobs:read`: Check job status and history.\n- `gateways:read`: List enrolled gateways and whether they are online.\n- `webhooks:read`: List webhooks and their deliveries.\n- `webhooks:write`: Create, change, test and delete webhooks, and rotate their secrets.\n\n## Rate limits\n\nRequests are counted in a sliding one-minute window, against two limits at once:\n\n- **Per key:** each API key has its own limit, chosen when the key is created (120 requests a minute unless you set another).\n- **Per organization:** all of your organization's keys together share your plan's limit, shown on the API keys page. More keys do not mean more requests.\n- **Per address, for failed authentication:** after 30 requests in a minute with a missing or invalid key, every request from that IP address gets a `429` until the minute is up, except with a key that worked recently.\n\nEvery authenticated response says where you stand, for whichever of your key's and your organization's limits is closer to running out:\n\n```http\nRateLimit-Limit: 120\nRateLimit-Remaining: 87\nRateLimit-Reset: 42\n```\n\n`RateLimit-Remaining` is how many requests are left in the current window and `RateLimit-Reset` is the number of seconds until the window is clear again. Over a limit, the answer is `429` with a `Retry-After` header and the limit that was reached (`key`, `organization` or `address`):\n\n```json\n{\n  \"error\": {\n    \"code\": \"rate_limited\",\n    \"message\": \"This key's limit of 120 requests per minute was reached.\",\n    \"details\": {\n      \"retryAfterSec\": 12,\n      \"appliesTo\": \"key\",\n      \"limit\": 120\n    }\n  }\n}\n```\n\nWait `Retry-After` seconds before trying again, and slow down when `RateLimit-Remaining` gets low. Separately, your plan caps API print jobs per calendar month; past it, creating a job answers `429` with the code `limit_reached` until the next month.\n\n## Errors\n\nEvery error has the same shape: a machine-readable `code`, a message for people, and sometimes `details`.\n\n```json\n{ \"error\": { \"code\": \"validation_error\", \"message\": \"printerId is required.\", \"details\": { \"field\": \"printerId\" } } }\n```\n\n## Printing a PDF in two calls\n\n```bash\n# 1. Find the printer\ncurl \"https://printergw.com/api/v1/printers\" -H \"Authorization: Bearer pgw_live_...\"\n\n# 2. Print (multipart upload) and keep the job id from the response\ncurl -X POST \"https://printergw.com/api/v1/print-jobs\" \\\n  -H \"Authorization: Bearer pgw_live_...\" \\\n  -H \"Idempotency-Key: order-10042\" \\\n  -F \"printerId=<printerId>\" \\\n  -F \"file=@packing-slip.pdf;type=application/pdf\" \\\n  -F \"copies=2\" -F \"duplex=TwoSidedLongEdge\"\n\n# Or point us at the file\ncurl -X POST \"https://printergw.com/api/v1/print-jobs\" \\\n  -H \"Authorization: Bearer pgw_live_...\" -H \"Content-Type: application/json\" \\\n  -d '{\"printerId\":\"<printerId>\",\"url\":\"https://files.example.com/packing-slip.pdf\",\"options\":{\"copies\":2}}'\n\n# Then poll (or use a webhook)\ncurl \"https://printergw.com/api/v1/print-jobs/<jobId>\" -H \"Authorization: Bearer pgw_live_...\"\n```\n\nA job is `queued` until a gateway that has the printer is online, `dispatched` once handed over, `printing` while the gateway works, then `completed` or `failed` (with an error). A failure on one gateway is retried on another up to three times.\n\n## Webhooks\n\nInstead of polling, have events sent to you. Create a webhook in the dashboard (Webhooks) or with `POST /webhooks`, choose its events, and keep the signing secret from the response. Each event is a JSON `POST` to your https URL; answer `2xx` within 10 seconds. Anything else is retried after 1, 5 and 30 minutes, then 2, 6, 12 and 24 hours. After 50 failures in a row the webhook is turned off. Events can arrive more than once and out of order: deduplicate on `id`.\n\n```http\nPOST /your/endpoint\nContent-Type: application/json\nX-PrinterGateway-Event: print_job.completed\nX-PrinterGateway-Delivery: <delivery id>\nX-PrinterGateway-Signature: t=1761811200,v1=5d41402abc4b2a76b9719d911017c592...\n\n{\"id\":\"evt_...\",\"type\":\"print_job.completed\",\"createdAt\":\"2026-10-30T08:00:00.000Z\",\"organizationId\":\"...\",\n \"data\":{\"job\":{\"id\":\"...\",\"status\":\"completed\",\"printerName\":\"Front desk\",\"pagesPrinted\":2,...},\"message\":\"Printed 2 pages.\"}}\n```\n\n### Verifying signatures\n\nVerify every request: HMAC-SHA256 of `<t>.<raw body>` with your secret must equal `v1`, and `t` should be within 5 minutes. In Node:\n\n```js\nimport crypto from \"node:crypto\";\n\nfunction verify(rawBody, header, secret) {\n  const parts = Object.fromEntries(header.split(\",\").map((p) => p.split(\"=\")));\n  if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;\n  const expected = crypto.createHmac(\"sha256\", secret).update(`${parts.t}.${rawBody}`).digest(\"hex\");\n  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? \"\"));\n}\n```\n\n### Events\n\nEach event is also listed under Webhooks below, with its headers and body. `webhook.test` is sent only by the test endpoint.\n\n- `print_job.created`: A print job was created (API, portal, assistant, or a computer's relay queue).\n- `print_job.dispatched`: A job was sent to a gateway to print.\n- `print_job.completed`: A job printed.\n- `print_job.failed`: A job failed for good (after its retries, or no gateway in time).\n- `print_job.cancelled`: A job was cancelled.\n- `print_job.requeued`: A job went back to the queue to try another gateway, or was retried.\n- `print_job.waiting`: A job has been queued for 30 minutes because no gateway could take it.\n- `gateway.offline`: A gateway's agent has not reported for 15 minutes.\n- `gateway.online`: A gateway reported offline is connected again.\n- `gateway.enrolled`: A computer or server was enrolled as a gateway.\n- `gateway.update_required`: A gateway runs an agent older than the minimum supported version.\n- `gateway.update_failed`: A gateway could not install a new agent version.\n- `printer.error`: A printer reports an error: paper jam, out of paper or toner, a door open, a full waste container.\n- `printer.supplies_low`: A printer reports toner or ink low, paper low, or a waste container nearly full.\n- `printer.unreachable`: A Cloud Gateway can no longer read a printer's status.\n- `printer.install_failed`: A gateway could not install a printer it should have.\n- `directory.sync_failed`: A directory sync (Microsoft Entra or Active Directory) is failing.\n- `directory.sync_recovered`: A failing directory sync works again.\n- `member.joined`: Someone became a member of the organization.\n- `usage.api_quota`: API print jobs this month reached 80% or all of the monthly limit.\n- `usage.plan_limit`: The organization used 90% or all of its gateways or printers.","contact":{"name":"360 Networks","email":"support@360networks.com"}},"servers":[{"url":"https://printergw.com/api/v1"}],"security":[{"apiKey":[]}],"tags":[{"name":"Printers","description":"Printers defined in your organization."},{"name":"Print jobs","description":"Submit PDFs and follow them to the printer."},{"name":"Gateways","description":"The computers running the Printer Gateway agent."},{"name":"Webhooks","x-displayName":"Webhook endpoints","description":"Create and manage the endpoints that receive signed events (print jobs, gateways, printers, the directory, usage) as they happen."}],"paths":{"/printers":{"get":{"tags":["Printers"],"summary":"List printers","operationId":"listPrinters","description":"Requires the `printers:read` scope.","responses":{"200":{"description":"Printers, sorted by name.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Printer"}}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key lacks the scope or the API is disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/printers/{id}":{"get":{"tags":["Printers"],"summary":"Get a printer","operationId":"getPrinter","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The printer and the gateways that have it.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/Printer"},{"type":"object","properties":{"installedOn":{"type":"array","items":{"type":"object","properties":{"gatewayId":{"type":"string"},"gatewayName":{"type":"string"},"online":{"type":"boolean"},"status":{"type":"string","enum":["pending","installing","installed","failed","removing","removed","skipped"]}}}}}}]}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No printer with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/print-jobs":{"get":{"tags":["Print jobs"],"summary":"List print jobs","operationId":"listPrintJobs","description":"Newest first. Requires `jobs:read`.","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["receiving","queued","dispatched","printing","completed","failed","cancelled"]}},{"name":"printerId","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"before","in":"query","description":"A job id; returns jobs created before it (cursor paging).","schema":{"type":"string"}}],"responses":{"200":{"description":"Jobs.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PrintJob"}},"nextBefore":{"type":["string","null"],"description":"Pass as `before` to fetch the next page, or null at the end."}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}},"post":{"tags":["Print jobs"],"summary":"Create a print job","operationId":"createPrintJob","description":"Send JSON with an https `url` the server fetches, or upload the PDF as multipart/form-data (field `file`, plus the option fields). PDFs up to 25 MB; encrypted PDFs are refused. Requires `jobs:write`. An optional `Idempotency-Key` header makes retries safe: the same key with the same request returns the first job (201 the first time, 200 after), a different request with a used key is a 409.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":200}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["printerId","url"],"properties":{"printerId":{"type":"string"},"url":{"type":"string","format":"uri","description":"An https URL returning the PDF (a public host name; IP address literals are refused)."},"documentName":{"type":"string","maxLength":200},"options":{"type":"object","additionalProperties":false,"properties":{"copies":{"type":"integer","minimum":1,"maximum":999,"default":1},"duplex":{"type":"string","enum":["OneSided","TwoSidedLongEdge","TwoSidedShortEdge"]},"color":{"type":"boolean","description":"True for color, false for black and white; omit for the printer's default."},"paperSize":{"type":"string","maxLength":64,"examples":["Letter","A4"]},"landscape":{"type":"boolean"},"pageRanges":{"type":"string","maxLength":200,"description":"Pages to print, e.g. \"1-3,5\".","examples":["1-3,5"]},"tray":{"type":"string","maxLength":64,"description":"Input tray name (driver dependent)."},"fitToPage":{"type":"boolean"}}}}},"example":{"printerId":"prn_123","url":"https://files.example.com/invoice-42.pdf","documentName":"Invoice 42","options":{"copies":2,"duplex":"TwoSidedLongEdge"}}},"multipart/form-data":{"schema":{"type":"object","required":["printerId","file"],"properties":{"printerId":{"type":"string"},"file":{"type":"string","format":"binary","description":"The PDF."},"documentName":{"type":"string","maxLength":200},"copies":{"type":"integer"},"duplex":{"type":"string","enum":["OneSided","TwoSidedLongEdge","TwoSidedShortEdge"]},"color":{"type":"string","enum":["color","mono"]},"paperSize":{"type":"string"},"landscape":{"type":"boolean"},"pageRanges":{"type":"string"},"tray":{"type":"string"},"fitToPage":{"type":"boolean"}}}}}},"responses":{"200":{"description":"An earlier job with the same Idempotency-Key.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PrintJob"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"201":{"description":"The job was created.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PrintJob"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"400":{"description":"Bad request (missing printer, bad options, non-https URL).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No printer with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"409":{"description":"Idempotency-Key reused with a different request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"413":{"description":"The PDF is too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"415":{"description":"Unsupported content type.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"422":{"description":"The file is not a readable, unencrypted PDF, or the URL could not be fetched.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit (`rate_limited`) or the monthly API job limit (`limit_reached`) was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/print-jobs/{id}":{"get":{"tags":["Print jobs"],"summary":"Get a print job","operationId":"getPrintJob","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The job and its timeline.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/PrintJob"},{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":["string","null"]},"gatewayName":{"type":["string","null"]},"at":{"type":"string","format":"date-time"}}}}}}]}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No job with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/print-jobs/{id}/cancel":{"post":{"tags":["Print jobs"],"summary":"Cancel a print job","operationId":"cancelPrintJob","description":"A queued job is dropped; a dispatched one is cancelled on the gateway when possible. Finished jobs cannot be cancelled. Requires `jobs:write`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The job, now cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PrintJob"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No job with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"409":{"description":"The job already finished.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/gateways":{"get":{"tags":["Gateways"],"summary":"List gateways","operationId":"listGateways","description":"Requires `gateways:read`.","responses":{"200":{"description":"Gateways, sorted by name.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Gateway"}}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/webhooks":{"get":{"tags":["Webhooks"],"summary":"List webhooks","operationId":"listWebhooks","description":"Requires `webhooks:read`.","responses":{"200":{"description":"The organization's webhooks, oldest first.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}},"post":{"tags":["Webhooks"],"summary":"Create a webhook","operationId":"createWebhook","description":"Events are POSTed to the URL as they happen. The response is the only time the signing secret is returned. At most 20 webhooks per organization. Requires `webhooks:write`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"},"example":{"url":"https://hooks.example.com/printergw","events":["print_job.completed","print_job.failed"],"description":"Order system"}}}},"responses":{"201":{"description":"The webhook, with its secret.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","description":"The signing secret (whsec_...). Store it now: it is not shown again."}}}]}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"400":{"description":"The URL or events are not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"409":{"description":"The organization already has the most webhooks it can.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/webhooks/{id}":{"get":{"tags":["Webhooks"],"summary":"Get a webhook","operationId":"getWebhook","description":"Requires `webhooks:read`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The webhook.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No webhook with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}},"patch":{"tags":["Webhooks"],"summary":"Update a webhook","operationId":"updateWebhook","description":"Send only the fields to change. Setting enabled to true also clears a disabledReason. Requires `webhooks:write`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"url":{"type":"string","format":"uri","maxLength":2000},"events":{"type":"array","minItems":1,"items":{"type":"string","enum":["*","print_job.created","print_job.dispatched","print_job.completed","print_job.failed","print_job.cancelled","print_job.requeued","print_job.waiting","gateway.offline","gateway.online","gateway.enrolled","gateway.update_required","gateway.update_failed","printer.error","printer.supplies_low","printer.unreachable","printer.install_failed","directory.sync_failed","directory.sync_recovered","member.joined","usage.api_quota","usage.plan_limit"],"description":"An event type, or \"*\" for every event (including ones added later). print_job.created: A print job was created (API, portal, assistant, or a computer's relay queue). print_job.dispatched: A job was sent to a gateway to print. print_job.completed: A job printed. print_job.failed: A job failed for good (after its retries, or no gateway in time). print_job.cancelled: A job was cancelled. print_job.requeued: A job went back to the queue to try another gateway, or was retried. print_job.waiting: A job has been queued for 30 minutes because no gateway could take it. gateway.offline: A gateway's agent has not reported for 15 minutes. gateway.online: A gateway reported offline is connected again. gateway.enrolled: A computer or server was enrolled as a gateway. gateway.update_required: A gateway runs an agent older than the minimum supported version. gateway.update_failed: A gateway could not install a new agent version. printer.error: A printer reports an error: paper jam, out of paper or toner, a door open, a full waste container. printer.supplies_low: A printer reports toner or ink low, paper low, or a waste container nearly full. printer.unreachable: A Cloud Gateway can no longer read a printer's status. printer.install_failed: A gateway could not install a printer it should have. directory.sync_failed: A directory sync (Microsoft Entra or Active Directory) is failing. directory.sync_recovered: A failing directory sync works again. member.joined: Someone became a member of the organization. usage.api_quota: API print jobs this month reached 80% or all of the monthly limit. usage.plan_limit: The organization used 90% or all of its gateways or printers."}},"description":{"type":["string","null"],"maxLength":200},"enabled":{"type":"boolean","default":true}}},"example":{"events":["*"],"enabled":true}}}},"responses":{"200":{"description":"The webhook, changed.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Webhook"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"400":{"description":"A field is not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No webhook with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}},"delete":{"tags":["Webhooks"],"summary":"Delete a webhook","operationId":"deleteWebhook","description":"Pending deliveries are dropped with it. Requires `webhooks:write`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Deleted.","headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No webhook with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/webhooks/{id}/rotate-secret":{"post":{"tags":["Webhooks"],"summary":"Rotate a webhook's secret","operationId":"rotateWebhookSecret","description":"A new signing secret, returned this once; the old one stops working at once. Requires `webhooks:write`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The webhook, with its new secret.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","description":"The signing secret (whsec_...). Store it now: it is not shown again."}}}]}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No webhook with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/webhooks/{id}/test":{"post":{"tags":["Webhooks"],"summary":"Send a test event","operationId":"testWebhook","description":"Sends a \"webhook.test\" event now (enabled or not) and answers with the delivery: how the endpoint replied. Requires `webhooks:write`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The delivery.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDelivery"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No webhook with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"summary":"List a webhook's deliveries","operationId":"listWebhookDeliveries","description":"Newest first; kept for 30 days. Requires `webhooks:read`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["pending","succeeded","failed"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}}],"responses":{"200":{"description":"Deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No webhook with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}},"/webhooks/deliveries/{deliveryId}/redeliver":{"post":{"tags":["Webhooks"],"summary":"Redeliver an event","operationId":"redeliverWebhook","description":"Sends the delivery again now; its retries start over. Requires `webhooks:write`.","parameters":[{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The delivery, after this attempt.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/WebhookDelivery"}}}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"404":{"description":"No delivery with that id.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"}}},"429":{"description":"A rate limit was reached; wait Retry-After seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"RateLimit-Limit":{"$ref":"#/components/headers/RateLimit-Limit"},"RateLimit-Remaining":{"$ref":"#/components/headers/RateLimit-Remaining"},"RateLimit-Reset":{"$ref":"#/components/headers/RateLimit-Reset"},"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}}}}},"webhooks":{"print_job.created":{"post":{"summary":"print_job.created","description":"A print job was created (API, portal, assistant, or a computer's relay queue).","operationId":"webhook_print_job_created","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.created"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"print_job.dispatched":{"post":{"summary":"print_job.dispatched","description":"A job was sent to a gateway to print.","operationId":"webhook_print_job_dispatched","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.dispatched"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"print_job.completed":{"post":{"summary":"print_job.completed","description":"A job printed.","operationId":"webhook_print_job_completed","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.completed"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"print_job.failed":{"post":{"summary":"print_job.failed","description":"A job failed for good (after its retries, or no gateway in time).","operationId":"webhook_print_job_failed","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.failed"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"print_job.cancelled":{"post":{"summary":"print_job.cancelled","description":"A job was cancelled.","operationId":"webhook_print_job_cancelled","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.cancelled"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"print_job.requeued":{"post":{"summary":"print_job.requeued","description":"A job went back to the queue to try another gateway, or was retried.","operationId":"webhook_print_job_requeued","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.requeued"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"print_job.waiting":{"post":{"summary":"print_job.waiting","description":"A job has been queued for 30 minutes because no gateway could take it.","operationId":"webhook_print_job_waiting","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"print_job.waiting"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"gateway.offline":{"post":{"summary":"gateway.offline","description":"A gateway's agent has not reported for 15 minutes.","operationId":"webhook_gateway_offline","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"gateway.offline"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"gateway.online":{"post":{"summary":"gateway.online","description":"A gateway reported offline is connected again.","operationId":"webhook_gateway_online","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"gateway.online"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"gateway.enrolled":{"post":{"summary":"gateway.enrolled","description":"A computer or server was enrolled as a gateway.","operationId":"webhook_gateway_enrolled","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"gateway.enrolled"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"gateway.update_required":{"post":{"summary":"gateway.update_required","description":"A gateway runs an agent older than the minimum supported version.","operationId":"webhook_gateway_update_required","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"gateway.update_required"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"gateway.update_failed":{"post":{"summary":"gateway.update_failed","description":"A gateway could not install a new agent version.","operationId":"webhook_gateway_update_failed","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"gateway.update_failed"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"printer.error":{"post":{"summary":"printer.error","description":"A printer reports an error: paper jam, out of paper or toner, a door open, a full waste container.","operationId":"webhook_printer_error","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"printer.error"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"printer.supplies_low":{"post":{"summary":"printer.supplies_low","description":"A printer reports toner or ink low, paper low, or a waste container nearly full.","operationId":"webhook_printer_supplies_low","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"printer.supplies_low"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"printer.unreachable":{"post":{"summary":"printer.unreachable","description":"A Cloud Gateway can no longer read a printer's status.","operationId":"webhook_printer_unreachable","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"printer.unreachable"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"printer.install_failed":{"post":{"summary":"printer.install_failed","description":"A gateway could not install a printer it should have.","operationId":"webhook_printer_install_failed","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"printer.install_failed"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"directory.sync_failed":{"post":{"summary":"directory.sync_failed","description":"A directory sync (Microsoft Entra or Active Directory) is failing.","operationId":"webhook_directory_sync_failed","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"directory.sync_failed"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"directory.sync_recovered":{"post":{"summary":"directory.sync_recovered","description":"A failing directory sync works again.","operationId":"webhook_directory_sync_recovered","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"directory.sync_recovered"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"member.joined":{"post":{"summary":"member.joined","description":"Someone became a member of the organization.","operationId":"webhook_member_joined","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"member.joined"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"usage.api_quota":{"post":{"summary":"usage.api_quota","description":"API print jobs this month reached 80% or all of the monthly limit.","operationId":"webhook_usage_api_quota","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"usage.api_quota"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}},"usage.plan_limit":{"post":{"summary":"usage.plan_limit","description":"The organization used 90% or all of its gateways or printers.","operationId":"webhook_usage_plan_limit","parameters":[{"name":"X-PrinterGateway-Event","in":"header","required":true,"schema":{"type":"string","const":"usage.plan_limit"}},{"name":"X-PrinterGateway-Delivery","in":"header","required":true,"schema":{"type":"string"},"description":"The delivery id; the same for every retry of this delivery."},{"name":"X-PrinterGateway-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"2XX":{"description":"Received. Answer within 10 seconds; anything else is retried."}}}}},"components":{"headers":{"RateLimit-Limit":{"description":"Requests allowed per minute: the key's limit or the organization's, whichever is closer to running out.","schema":{"type":"integer"}},"RateLimit-Remaining":{"description":"Requests left in the current one-minute window.","schema":{"type":"integer"}},"RateLimit-Reset":{"description":"Seconds until the window is clear again.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before trying again.","schema":{"type":"integer"}}},"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key (pgw_live_...) from the API keys page of the dashboard. Its scopes decide what it may do: printers:read, jobs:write, jobs:read, gateways:read, webhooks:read, webhooks:write."}},"schemas":{"Printer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"location":{"type":["string","null"]},"kind":{"type":"string","enum":["tcp","ipp"]},"protocol":{"type":"string","enum":["raw","lpr","ipp","ipps"]},"host":{"type":"string"},"port":{"type":"integer"},"driver":{"type":["string","null"],"description":"The driver package name, or null for the Microsoft IPP Class Driver."},"gateways":{"type":"object","description":"How many gateways should have the printer and how many report it installed.","properties":{"desired":{"type":"integer"},"installed":{"type":"integer"}}},"createdAt":{"type":"string","format":"date-time"}}},"PrintJob":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["receiving","queued","dispatched","printing","completed","failed","cancelled"]},"printerId":{"type":"string"},"printerName":{"type":"string"},"gatewayId":{"type":["string","null"],"description":"The gateway that printed (or is printing) the job."},"gatewayName":{"type":["string","null"]},"documentName":{"type":"string"},"sizeBytes":{"type":"integer"},"pageCount":{"type":["integer","null"]},"pagesPrinted":{"type":["integer","null"]},"options":{"type":"object","additionalProperties":false,"properties":{"copies":{"type":"integer","minimum":1,"maximum":999,"default":1},"duplex":{"type":"string","enum":["OneSided","TwoSidedLongEdge","TwoSidedShortEdge"]},"color":{"type":"boolean","description":"True for color, false for black and white; omit for the printer's default."},"paperSize":{"type":"string","maxLength":64,"examples":["Letter","A4"]},"landscape":{"type":"boolean"},"pageRanges":{"type":"string","maxLength":200,"description":"Pages to print, e.g. \"1-3,5\".","examples":["1-3,5"]},"tray":{"type":"string","maxLength":64,"description":"Input tray name (driver dependent)."},"fitToPage":{"type":"boolean"}}},"attempts":{"type":"integer"},"error":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"dispatchedAt":{"type":["string","null"],"format":"date-time"},"startedAt":{"type":["string","null"],"format":"date-time"},"completedAt":{"type":["string","null"],"format":"date-time"},"expiresAt":{"type":"string","format":"date-time","description":"A queued job with no gateway to print it fails at this time."}}},"PrintJobOptions":{"type":"object","additionalProperties":false,"properties":{"copies":{"type":"integer","minimum":1,"maximum":999,"default":1},"duplex":{"type":"string","enum":["OneSided","TwoSidedLongEdge","TwoSidedShortEdge"]},"color":{"type":"boolean","description":"True for color, false for black and white; omit for the printer's default."},"paperSize":{"type":"string","maxLength":64,"examples":["Letter","A4"]},"landscape":{"type":"boolean"},"pageRanges":{"type":"string","maxLength":200,"description":"Pages to print, e.g. \"1-3,5\".","examples":["1-3,5"]},"tray":{"type":"string","maxLength":64,"description":"Input tray name (driver dependent)."},"fitToPage":{"type":"boolean"}}},"Gateway":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"hostname":{"type":"string"},"status":{"type":"string","enum":["online","offline","disabled","pending_removal"]},"online":{"type":"boolean"},"canPrint":{"type":"boolean","description":"The agent on this gateway can run print jobs."},"osName":{"type":["string","null"]},"agentVersion":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"lastSeenAt":{"type":["string","null"],"format":"date-time"}}},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri","description":"Where events are POSTed (https, a public host name)."},"description":{"type":["string","null"]},"events":{"type":"array","items":{"type":"string","enum":["*","print_job.created","print_job.dispatched","print_job.completed","print_job.failed","print_job.cancelled","print_job.requeued","print_job.waiting","gateway.offline","gateway.online","gateway.enrolled","gateway.update_required","gateway.update_failed","printer.error","printer.supplies_low","printer.unreachable","printer.install_failed","directory.sync_failed","directory.sync_recovered","member.joined","usage.api_quota","usage.plan_limit"],"description":"An event type, or \"*\" for every event (including ones added later). print_job.created: A print job was created (API, portal, assistant, or a computer's relay queue). print_job.dispatched: A job was sent to a gateway to print. print_job.completed: A job printed. print_job.failed: A job failed for good (after its retries, or no gateway in time). print_job.cancelled: A job was cancelled. print_job.requeued: A job went back to the queue to try another gateway, or was retried. print_job.waiting: A job has been queued for 30 minutes because no gateway could take it. gateway.offline: A gateway's agent has not reported for 15 minutes. gateway.online: A gateway reported offline is connected again. gateway.enrolled: A computer or server was enrolled as a gateway. gateway.update_required: A gateway runs an agent older than the minimum supported version. gateway.update_failed: A gateway could not install a new agent version. printer.error: A printer reports an error: paper jam, out of paper or toner, a door open, a full waste container. printer.supplies_low: A printer reports toner or ink low, paper low, or a waste container nearly full. printer.unreachable: A Cloud Gateway can no longer read a printer's status. printer.install_failed: A gateway could not install a printer it should have. directory.sync_failed: A directory sync (Microsoft Entra or Active Directory) is failing. directory.sync_recovered: A failing directory sync works again. member.joined: Someone became a member of the organization. usage.api_quota: API print jobs this month reached 80% or all of the monthly limit. usage.plan_limit: The organization used 90% or all of its gateways or printers."}},"enabled":{"type":"boolean"},"secretPrefix":{"type":"string","description":"The signing secret's first characters, to tell secrets apart. The secret itself is only returned when created or rotated."},"disabledReason":{"type":["string","null"],"description":"Set when Printer Gateway turned the webhook off (50 failed deliveries in a row)."},"consecutiveFailures":{"type":"integer"},"lastDeliveryAt":{"type":["string","null"],"format":"date-time"},"lastSuccessAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"WebhookInput":{"type":"object","additionalProperties":false,"required":["url","events"],"properties":{"url":{"type":"string","format":"uri","maxLength":2000},"events":{"type":"array","minItems":1,"items":{"type":"string","enum":["*","print_job.created","print_job.dispatched","print_job.completed","print_job.failed","print_job.cancelled","print_job.requeued","print_job.waiting","gateway.offline","gateway.online","gateway.enrolled","gateway.update_required","gateway.update_failed","printer.error","printer.supplies_low","printer.unreachable","printer.install_failed","directory.sync_failed","directory.sync_recovered","member.joined","usage.api_quota","usage.plan_limit"],"description":"An event type, or \"*\" for every event (including ones added later). print_job.created: A print job was created (API, portal, assistant, or a computer's relay queue). print_job.dispatched: A job was sent to a gateway to print. print_job.completed: A job printed. print_job.failed: A job failed for good (after its retries, or no gateway in time). print_job.cancelled: A job was cancelled. print_job.requeued: A job went back to the queue to try another gateway, or was retried. print_job.waiting: A job has been queued for 30 minutes because no gateway could take it. gateway.offline: A gateway's agent has not reported for 15 minutes. gateway.online: A gateway reported offline is connected again. gateway.enrolled: A computer or server was enrolled as a gateway. gateway.update_required: A gateway runs an agent older than the minimum supported version. gateway.update_failed: A gateway could not install a new agent version. printer.error: A printer reports an error: paper jam, out of paper or toner, a door open, a full waste container. printer.supplies_low: A printer reports toner or ink low, paper low, or a waste container nearly full. printer.unreachable: A Cloud Gateway can no longer read a printer's status. printer.install_failed: A gateway could not install a printer it should have. directory.sync_failed: A directory sync (Microsoft Entra or Active Directory) is failing. directory.sync_recovered: A failing directory sync works again. member.joined: Someone became a member of the organization. usage.api_quota: API print jobs this month reached 80% or all of the monthly limit. usage.plan_limit: The organization used 90% or all of its gateways or printers."}},"description":{"type":["string","null"],"maxLength":200},"enabled":{"type":"boolean","default":true}}},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","description":"Also sent as the X-PrinterGateway-Delivery header."},"eventId":{"type":"string"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","succeeded","failed"]},"attempts":{"type":"integer","description":"Up to 8: at once, then after 1 and 5 minutes, 30 minutes, 2, 6, 12 and 24 hours."},"nextAttemptAt":{"type":["string","null"],"format":"date-time"},"lastStatusCode":{"type":["integer","null"]},"lastError":{"type":["string","null"]},"lastResponse":{"type":["string","null"],"description":"The start of the endpoint's last answer."},"durationMs":{"type":["integer","null"]},"deliveredAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"payload":{"$ref":"#/components/schemas/WebhookEvent"}}},"WebhookEvent":{"type":"object","description":"The JSON body of every webhook request. Verify the X-PrinterGateway-Signature header (t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<raw body>\" with the webhook's secret>) and refuse timestamps older than 5 minutes. Answer 2xx within 10 seconds; anything else is retried. \"webhook.test\" is sent by the test endpoint.","properties":{"id":{"type":"string","description":"The event id (evt_...); the same event can arrive more than once, so deduplicate on it."},"type":{"type":"string","examples":["print_job.completed"]},"createdAt":{"type":"string","format":"date-time"},"organizationId":{"type":"string"},"data":{"type":"object","description":"print_job.* events carry { job, message }; others describe the gateway, printer, directory or usage involved."}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["unauthorized","forbidden","not_found","validation_error","unsupported_media_type","payload_too_large","rate_limited","limit_reached","feature_disabled","conflict","printer_unavailable","fetch_failed","server_error"]},"message":{"type":"string"},"details":{}},"required":["code","message"]}},"required":["error"]}}}}