{"openapi":"3.1.0","info":{"title":"PDFGen API","version":"1.0.0","description":"Render any public URL to PDF. Without `callback_url` the PDF is returned in the response body. With `callback_url` the request returns 202 and the PDF is POSTed to your URL when ready."},"servers":[{"url":"https://pdfgen.arsi.in"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Project API key (pk_live_...)"}},"schemas":{"PdfRequest":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"url":{"type":"string","maxLength":4096,"format":"uri"},"pdf":{"default":{"format":"a4","landscape":false,"print_background":true,"prefer_css_page_size":false,"single_page":false,"scale":1,"display_header_footer":false,"outline":false},"type":"object","properties":{"format":{"default":"a4","description":"Paper size. `auto` uses the page's CSS `@page` size when it declares one, otherwise A4.","type":"string","enum":["auto","letter","legal","tabloid","ledger","a0","a1","a2","a3","a4","a5","a6"]},"width":{"anyOf":[{"type":"number","minimum":0,"maximum":10000},{"type":"string","pattern":"^\\d+(\\.\\d+)?(px|in|cm|mm)$"}]},"height":{"anyOf":[{"type":"number","minimum":0,"maximum":10000},{"type":"string","pattern":"^\\d+(\\.\\d+)?(px|in|cm|mm)$"}]},"landscape":{"default":false,"type":"boolean"},"print_background":{"default":true,"type":"boolean"},"prefer_css_page_size":{"default":false,"type":"boolean"},"single_page":{"default":false,"description":"Render the whole page as one continuous page sized to its content, with no page breaks. Overrides format, width, height, landscape and margin.","type":"boolean"},"scale":{"default":1,"type":"number","minimum":0.1,"maximum":2},"page_ranges":{"type":"string","pattern":"^\\s*\\d+(\\s*-\\s*\\d+)?(\\s*,\\s*\\d+(\\s*-\\s*\\d+)?)*\\s*$"},"margin":{"type":"object","properties":{"top":{"anyOf":[{"type":"number","minimum":0,"maximum":10000},{"type":"string","pattern":"^\\d+(\\.\\d+)?(px|in|cm|mm)$"}]},"right":{"anyOf":[{"type":"number","minimum":0,"maximum":10000},{"type":"string","pattern":"^\\d+(\\.\\d+)?(px|in|cm|mm)$"}]},"bottom":{"anyOf":[{"type":"number","minimum":0,"maximum":10000},{"type":"string","pattern":"^\\d+(\\.\\d+)?(px|in|cm|mm)$"}]},"left":{"anyOf":[{"type":"number","minimum":0,"maximum":10000},{"type":"string","pattern":"^\\d+(\\.\\d+)?(px|in|cm|mm)$"}]}},"additionalProperties":false},"display_header_footer":{"default":false,"type":"boolean"},"header_template":{"type":"string","maxLength":20000},"footer_template":{"type":"string","maxLength":20000},"outline":{"default":false,"type":"boolean"}},"additionalProperties":false},"wait":{"default":{"until":"load","ready_signal":false,"delay_ms":0},"type":"object","properties":{"until":{"default":"load","type":"string","enum":["load","domcontentloaded","networkidle0","networkidle2"]},"selector":{"type":"string","minLength":1,"maxLength":500},"ready_signal":{"default":false,"type":"boolean"},"delay_ms":{"default":0,"type":"integer","minimum":0,"maximum":10000}},"additionalProperties":false},"timeout_ms":{"default":30000,"type":"integer","minimum":1000,"maximum":60000},"viewport":{"type":"object","properties":{"width":{"type":"integer","minimum":320,"maximum":3840},"height":{"type":"integer","minimum":240,"maximum":2160},"device_scale_factor":{"type":"number","minimum":1,"maximum":3}},"required":["width","height"],"additionalProperties":false},"emulate_media":{"default":"print","type":"string","enum":["screen","print"]},"headers":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":256},"additionalProperties":{"type":"string","maxLength":4096}},"cookies":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":256},"value":{"type":"string","maxLength":4096},"domain":{"type":"string","maxLength":256},"path":{"type":"string","maxLength":1024},"secure":{"type":"boolean"},"http_only":{"type":"boolean"},"same_site":{"type":"string","enum":["Strict","Lax","None"]}},"required":["name","value"],"additionalProperties":false}},"basic_auth":{"type":"object","properties":{"username":{"type":"string","maxLength":256},"password":{"type":"string","maxLength":256}},"required":["username","password"],"additionalProperties":false},"css":{"type":"string","maxLength":100000},"hide_selectors":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":500}},"auto_scroll":{"default":false,"type":"boolean"},"disable_animations":{"default":true,"type":"boolean"},"block_resources":{"maxItems":8,"type":"array","items":{"type":"string","enum":["image","media","font","stylesheet","script","xhr","fetch","websocket"]}},"user_agent":{"type":"string","maxLength":512},"javascript":{"default":true,"type":"boolean"},"filename":{"type":"string","maxLength":200,"pattern":"^[\\w\\-. ]+$"},"callback_url":{"type":"string","maxLength":4096,"format":"uri"},"metadata":{"type":"object","propertyNames":{"type":"string","maxLength":64},"additionalProperties":{"type":"string","maxLength":512}}},"required":["url"],"additionalProperties":false},"Job":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued","rendering","succeeded","failed"]},"mode":{"type":"string","enum":["sync","async"]},"url":{"type":"string"},"engine":{"type":["string","null"]},"bytes":{"type":["integer","null"]},"duration_ms":{"type":["integer","null"]},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}},"delivery":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["pending","delivered","failed"]},"attempts":{"type":"integer"},"error":{"type":["string","null"]}}},"metadata":{"type":["object","null"],"additionalProperties":{"type":"string"}},"download_url":{"type":["string","null"],"description":"Signed link, valid for up to 1 hour"},"created_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}},"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"code":{"type":"string","description":"Stable machine-readable error code"},"detail":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}},"request_id":{"type":"string"}},"required":["type","title","status","code"]}}},"paths":{"/v1/pdf":{"post":{"operationId":"createPdf","summary":"Render a URL to PDF","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":255},"description":"Safely retry a request without rendering or charging twice."},{"name":"Prefer","in":"header","schema":{"type":"string","enum":["respond-async"]},"description":"On temporary overload, return 202 with a job instead of 503."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfRequest"}}}},"responses":{"200":{"description":"The PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Accepted; delivered to callback_url when ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"Invalid request","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Missing or invalid API key","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"Quota exhausted and no credits","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"409":{"description":"Idempotency conflict","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"The page could not be rendered (unreachable, timed out, blocked)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Rate or concurrency limit","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Rendering temporarily unavailable; retry after Retry-After seconds","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/jobs/{id}":{"get":{"operationId":"getJob","summary":"Get a job's status and download link","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"404":{"description":"Not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}}}}