{"openapi":"3.1.0","info":{"title":"rustedf.cloud API","description":"Generate PDFs from HTML templates. Authenticate with `Authorization: Bearer <api key>`. One PDF costs one credit; validation is free.","license":{"name":""},"version":"0.1.0"},"paths":{"/v1/assets":{"get":{"tags":["v1"],"summary":"Lists the account's uploaded images.","operationId":"list_assets","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AssetView"}}}}}},"security":[{"bearer":[]}]},"post":{"tags":["v1"],"summary":"Uploads a PNG or JPEG image for use in templates as `asset:<id>`. The raw\nimage is the request body.","operationId":"upload_asset","parameters":[{"name":"name","in":"query","description":"A name for the image","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/octet-stream":{"schema":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetView"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}},"/v1/assets/{id}":{"delete":{"tags":["v1"],"summary":"Deletes an uploaded image.","operationId":"delete_asset","parameters":[{"name":"id","in":"path","description":"Asset id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":""},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}},"/v1/me":{"get":{"tags":["v1"],"summary":"The account behind the API key: plan and remaining credits.","operationId":"me","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}},"/v1/render":{"post":{"tags":["v1"],"summary":"Renders a document and returns a PDF, or a JSON link when `output` is `url`.","operationId":"render","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderRequest"}}},"required":true},"responses":{"200":{"description":"The PDF (`application/pdf`), or a JSON link when output is url","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenderLink"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"402":{"description":"No credits left","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"422":{"description":"The template or document is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Rate limited; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"503":{"description":"Service busy; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}},"/v1/templates":{"get":{"tags":["v1"],"summary":"Lists the account's templates.","operationId":"list_templates","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateSummary"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]},"post":{"tags":["v1"],"summary":"Saves a template. The source must compile.","operationId":"create_template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateInput"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateView"}}}},"422":{"description":"The template does not compile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}},"/v1/templates/{id}":{"get":{"tags":["v1"],"summary":"Returns one template.","operationId":"get_template","parameters":[{"name":"id","in":"path","description":"Template id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateView"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]},"delete":{"tags":["v1"],"summary":"Deletes a template.","operationId":"delete_template","parameters":[{"name":"id","in":"path","description":"Template id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":""},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]},"patch":{"tags":["v1"],"summary":"Changes a template. Only the fields sent are changed.","operationId":"update_template","parameters":[{"name":"id","in":"path","description":"Template id","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatePatch"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateView"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}},"/v1/validate":{"post":{"tags":["v1"],"summary":"Checks a document without producing a PDF or using credits. Returns what\nthe service does not support and any layout that overflows the page.","operationId":"validate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentInput"}}},"required":true},"responses":{"200":{"description":"Diagnostics for the document","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateResponse"}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"422":{"description":"The template or document is invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"429":{"description":"Rate limited; see Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}},"security":[{"bearer":[]}]}}},"components":{"schemas":{"AssetView":{"type":"object","required":["id","name","content_type","size","reference","created_at"],"properties":{"content_type":{"type":"string"},"created_at":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"reference":{"type":"string","description":"Use this as an image `src` in a template: `<img src=\"asset:...\">`."},"size":{"type":"integer","format":"int64"}}},"DiagnosticView":{"type":"object","description":"A feature of the document that the service did not fully handle.","required":["kind","text","context","count"],"properties":{"context":{"type":"string","description":"Where it was found, as a description of the element or stylesheet."},"count":{"type":"integer","description":"How many identical occurrences this entry stands for.","minimum":0},"kind":{"type":"string","description":"For example `UnsupportedProperty`, `UnsupportedSelector`, `LayoutOverflow`."},"text":{"type":"string","description":"The offending tag, property, selector or declaration."}}},"DocumentInput":{"type":"object","description":"What to render: a stored template or inline HTML, both expanded with\n`data` before layout.","properties":{"data":{"type":"object","description":"Values for the template, a JSON object."},"html":{"type":["string","null"],"description":"Inline HTML, treated as a template. Send this or `template_id`."},"locale":{"type":["string","null"],"description":"BCP 47 locale for number, currency and date formatting, e.g. `pt-BR`.\nDefaults to the template's locale, then the account's."},"strict":{"type":"boolean","description":"Reject the document when it uses anything the service does not\nfully support, instead of rendering with warnings."},"template_id":{"type":["string","null"],"format":"uuid","description":"A template saved in the account. Send this or `html`."},"title":{"type":["string","null"],"description":"Document title stored in the PDF metadata."}}},"ErrorBody":{"type":"object","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail"}}},"ErrorDetail":{"type":"object","required":["code","message"],"properties":{"balance":{"type":["integer","null"],"format":"int64"},"code":{"type":"string","description":"Stable machine readable code."},"diagnostics":{"type":["array","null"],"items":{"$ref":"#/components/schemas/DiagnosticView"}},"message":{"type":"string"}}},"Me":{"type":"object","required":["email","plan","credits","period_end","locale"],"properties":{"credits":{"type":"integer","format":"int64"},"email":{"type":"string"},"locale":{"type":"string"},"period_end":{"type":"integer","format":"int64"},"plan":{"type":"string"}}},"Output":{"type":"string","enum":["pdf","url"]},"RenderLink":{"type":"object","required":["id","url","expires_at","pages","bytes","credits_remaining","diagnostics"],"properties":{"bytes":{"type":"integer","minimum":0},"credits_remaining":{"type":"integer","format":"int64"},"diagnostics":{"type":"array","items":{"$ref":"#/components/schemas/DiagnosticView"}},"expires_at":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"pages":{"type":"integer","minimum":0},"url":{"type":"string","description":"Signed link to the PDF; no API key is needed to open it."}}},"RenderRequest":{"allOf":[{"$ref":"#/components/schemas/DocumentInput"},{"type":"object","properties":{"output":{"$ref":"#/components/schemas/Output"}}}]},"TemplateInput":{"type":"object","required":["name","source"],"properties":{"locale":{"type":["string","null"]},"name":{"type":"string"},"sample_data":{"type":["object","null"]},"source":{"type":"string"}}},"TemplatePatch":{"type":"object","properties":{"locale":{"type":["string","null"]},"name":{"type":["string","null"]},"sample_data":{"type":["object","null"]},"source":{"type":["string","null"]}}},"TemplateSummary":{"type":"object","description":"What a list of templates shows. The source and sample data come with the\ntemplate itself.","required":["id","name","locale","version","created_at","updated_at"],"properties":{"created_at":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"locale":{"type":"string"},"name":{"type":"string"},"updated_at":{"type":"integer","format":"int64"},"version":{"type":"integer","format":"int64","description":"Increases on every change."}}},"TemplateView":{"type":"object","required":["id","name","source","locale","sample_data","version","created_at","updated_at"],"properties":{"created_at":{"type":"integer","format":"int64"},"id":{"type":"string","format":"uuid"},"locale":{"type":"string"},"name":{"type":"string"},"sample_data":{"type":"object","description":"Example values used by the portal's preview."},"source":{"type":"string","description":"HTML and CSS with template syntax."},"updated_at":{"type":"integer","format":"int64"},"version":{"type":"integer","format":"int64","description":"Increases on every change."}}},"ValidateResponse":{"type":"object","required":["ok","pages","diagnostics"],"properties":{"diagnostics":{"type":"array","items":{"$ref":"#/components/schemas/DiagnosticView"}},"ok":{"type":"boolean","description":"True when nothing was reported."},"pages":{"type":"integer","minimum":0}}}},"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}}}