{"swagger":"2.0","info":{"title":"AutomaDoc","description":"AutomaDoc fills Word, Excel and PowerPoint templates with your data and returns finished PDF, image or Office documents. Send the values of a template's placeholders, get the finished document back, and save it to a file library or attach it to an email.","version":"1.0.0","contact":{"name":"AutomaDoc support","url":"https://docs.automadoc.cc/en/reference/api/","email":"contact@automadoc.cc"}},"host":"api.automadoc.cc","basePath":"/","schemes":["https"],"consumes":[],"produces":[],"paths":{"/api/v1/templates":{"get":{"operationId":"ListTemplates","summary":"List templates","description":"Lists every template of the company that the company API key belongs to, ordered by name.","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"The company's templates.","schema":{"$ref":"#/definitions/TemplateList"}}},"x-ms-visibility":"advanced"}},"/api/v1/templates/{templateId}":{"get":{"operationId":"GetTemplate","summary":"Get a template","description":"Gets one template with the schema of the data it takes and an example of that data.","produces":["application/json"],"parameters":[{"name":"templateId","in":"path","required":true,"description":"The template's id.","type":"string","x-ms-summary":"Template ID","x-ms-url-encoding":"single"}],"responses":{"200":{"description":"The template.","schema":{"$ref":"#/definitions/TemplateDetail"}}},"x-ms-visibility":"internal"}},"/api/v1/templates/{templateId}/documents":{"post":{"operationId":"GenerateDocument","summary":"Generate a document","description":"Fills the template with the data you send and makes a document. The step waits until the document is ready and returns its details, or fails with the reason when the document cannot be made.","consumes":["application/json"],"produces":["application/json"],"parameters":[{"name":"templateId","in":"path","required":true,"description":"The template to fill.","type":"string","x-ms-summary":"Template","x-ms-url-encoding":"single","x-ms-dynamic-values":{"operationId":"ListTemplates","parameters":{},"value-collection":"templates","value-path":"id","value-title":"name"},"x-ms-dynamic-list":{"operationId":"ListTemplates","parameters":{},"itemsPath":"templates","itemValuePath":"id","itemTitlePath":"name"}},{"name":"wait","in":"query","required":false,"description":"Hold the response for up to this many seconds while the document is made (0 to 25).","type":"integer","minimum":0,"maximum":25,"x-ms-summary":"Wait Seconds","x-ms-visibility":"advanced"},{"name":"async","in":"query","required":true,"description":"When true and the document is not ready yet, the 202 response carries a Location header to poll and a Retry-After header. The poll answers 202 until the document is completed (200) or failed (422). A document that failed before the response is a 422 already.","type":"string","enum":["true","false"],"default":"true","x-ms-summary":"Poll For Result","x-ms-visibility":"internal"},{"name":"body","in":"body","required":true,"schema":{"$ref":"#/definitions/CreateDocumentsRequest"}}],"responses":{"200":{"description":"The document, finished within the wait. When `data` was a list for a template that makes a document per item, a list of documents.","schema":{"$ref":"#/definitions/Document"}},"202":{"description":"The document is being made. With async=true, poll the Location header.","headers":{"Location":{"description":"The status URL to poll, with async=true.","type":"string"},"Retry-After":{"description":"Seconds to wait before polling again.","type":"integer"}}}},"x-ms-visibility":"important"}},"/api/v1/documents/{generationId}":{"get":{"operationId":"GetDocumentStatus","summary":"Get document status","description":"Gets the status of a document, with a download link once it is completed. A document still being made is waited for, and a failed document makes the step fail with the reason.","produces":["application/json"],"parameters":[{"name":"generationId","in":"path","required":true,"description":"The document's id, from the Generate a document step.","type":"string","x-ms-summary":"Document ID","x-ms-url-encoding":"single"},{"name":"async","in":"query","required":true,"description":"When true, the status code follows the document: 202 with a Location header to poll while it is processing, 200 once completed, 422 once failed.","type":"string","enum":["true","false"],"default":"true","x-ms-summary":"Poll For Result","x-ms-visibility":"internal"}],"responses":{"200":{"description":"The document.","schema":{"$ref":"#/definitions/Document"}},"202":{"description":"Only with async=true: the document is still being made.","headers":{"Location":{"description":"The status URL to poll, with async=true.","type":"string"},"Retry-After":{"description":"Seconds to wait before polling again.","type":"integer"}}}},"x-ms-visibility":"advanced"}},"/api/v1/documents/{generationId}/file":{"get":{"operationId":"DownloadDocument","summary":"Download document","description":"Gets the content of a completed document, to save it to a file library or attach it to a message. A document still being made or one that failed makes the step fail.","produces":["application/octet-stream"],"parameters":[{"name":"generationId","in":"path","required":true,"description":"The document's id, from the Generate a document step.","type":"string","x-ms-summary":"Document ID","x-ms-url-encoding":"single"}],"responses":{"200":{"description":"The file. Content-Type and Content-Disposition (the file name) describe it.","schema":{"type":"string","format":"binary","x-ms-summary":"File Content","description":"The content of the document."}}},"x-ms-visibility":"important"}}},"definitions":{"CreateDocumentsRequest":{"type":"object","required":["data"],"properties":{"data":{"type":"object","description":"The values of the template's placeholders.","x-ms-summary":"Data","x-ms-dynamic-schema":{"operationId":"GetTemplate","parameters":{"templateId":{"parameter":"templateId"}},"value-path":"dataSchema"},"x-ms-dynamic-properties":{"operationId":"GetTemplate","parameters":{"templateId":{"parameterReference":"templateId"}},"itemValuePath":"dataSchema"}},"format":{"type":"string","enum":["pdf","png","native"],"description":"The file to make: pdf, png (the first page as a picture) or native (the template's own kind of file). The template's setting when left empty.","x-ms-summary":"Output Format"},"filename":{"type":"string","maxLength":200,"description":"A file name pattern for this request, with {Field} placeholders, in place of the template's.","x-ms-summary":"File Name Pattern","x-ms-visibility":"advanced"},"recordId":{"type":"string","maxLength":100,"description":"What {Record_ID} prints. The document's id when left empty.","x-ms-summary":"Record ID","x-ms-visibility":"advanced"},"mode":{"type":"string","enum":["separate","list","continuous","labels"],"description":"What the template makes, sent as a check: the request is refused (MODE_MISMATCH) when the template makes something else.","x-ms-summary":"Expected Mode","x-ms-visibility":"advanced"}}},"Document":{"type":"object","required":["generationId","templateId","status","statusUrl","createdAt"],"properties":{"generationId":{"type":"string","description":"The document's id.","x-ms-summary":"Document ID"},"templateId":{"type":"string","description":"The template it was made from.","x-ms-summary":"Template ID"},"status":{"type":"string","enum":["processing","completed","failed"],"description":"processing, completed or failed.","x-ms-summary":"Status"},"statusUrl":{"type":"string","description":"Where to read the status again, with the same key.","x-ms-summary":"Status URL"},"createdAt":{"type":"integer","format":"int64","description":"When the request was made, in milliseconds since 1970.","x-ms-summary":"Created At"},"filename":{"type":"string","description":"The file name, once completed.","x-ms-summary":"File Name"},"downloadUrl":{"type":"string","description":"A signed link to the file that needs no key, once completed.","x-ms-summary":"Download URL"},"downloadUrlExpiresAt":{"type":"integer","format":"int64","description":"When the download link stops working, in milliseconds since 1970.","x-ms-summary":"Download URL Expires At"},"error":{"type":"string","description":"Why the document failed.","x-ms-summary":"Error"},"code":{"type":"string","description":"DOCUMENT_FAILED on the 422 that async=true answers for a failed document.","x-ms-summary":"Error Code"},"warnings":{"type":"array","items":{"type":"string"},"description":"What was left out of the document, such as a picture that could not be fetched.","x-ms-summary":"Warnings"},"recordCount":{"type":"integer","description":"For one document made from many records: how many.","x-ms-summary":"Record Count"},"signing":{"$ref":"#/definitions/Signing"}}},"Signing":{"type":"object","description":"When a signature was asked for: what became of the request.","x-ms-summary":"Signing","required":["status"],"properties":{"status":{"type":"string","enum":["queued","starting","started","failed"],"description":"queued, starting, started or failed.","x-ms-summary":"Signing Status"},"requestId":{"type":"string","description":"The signature request's id.","x-ms-summary":"Signature Request ID"},"error":{"type":"string","description":"Why the request could not start.","x-ms-summary":"Signing Error"},"warnings":{"type":"array","items":{"type":"string"},"description":"What did not stop the request.","x-ms-summary":"Signing Warnings"},"links":{"type":"array","description":"Outside signers' links and passwords, given once.","x-ms-summary":"Signing Links","items":{"type":"object","required":["role","displayName","url","password"],"properties":{"role":{"type":"string","description":"The signature role.","x-ms-summary":"Role"},"displayName":{"type":"string","description":"The signer's name.","x-ms-summary":"Signer Name"},"url":{"type":"string","description":"The signing link, or null once given.","x-ms-summary":"Signing URL","x-nullable":true},"password":{"type":"string","description":"The signer's password, or null once given.","x-ms-summary":"Signing Password","x-nullable":true}}}},"linksRedacted":{"type":"boolean","description":"True once the links have been given.","x-ms-summary":"Links Redacted"}}},"TemplateDetail":{"type":"object","required":["id","name","source","templateFormat","mode","outputFormat","ready","dataSchema","sampleData","documentsUrl"],"properties":{"id":{"type":"string","description":"The template's id.","x-ms-summary":"Template ID"},"name":{"type":"string","description":"The template's name.","x-ms-summary":"Template Name"},"source":{"type":"string","enum":["base","approval","excel","sharepoint_list","dataverse","google_sheet","api"],"description":"Where the template's own records come from: an Excel table, a SharePoint list, a Dataverse table, a Google sheet, a Base table or an approval form, or nowhere (api: only this API fills it).","x-ms-summary":"Source"},"templateFormat":{"type":"string","enum":["docx","xlsx","pptx"],"description":"The template file's kind.","x-ms-summary":"Template Format"},"mode":{"type":"string","enum":["separate","list","continuous","labels"],"description":"What a request makes: separate is one document per item, the others one document from all items.","x-ms-summary":"Mode"},"outputFormat":{"type":"string","enum":["pdf","png","docx","xlsx","pptx"],"description":"The file a request makes when it does not ask for a format.","x-ms-summary":"Output Format"},"ready":{"type":"boolean","description":"False while the template has no file, or errors in it stop documents being made.","x-ms-summary":"Ready"},"dataSchema":{"type":"object","additionalProperties":true,"description":"A JSON schema of the data the template takes: one property per placeholder.","x-ms-summary":"Data Schema"},"sampleData":{"type":"object","description":"An example of the data.","x-ms-summary":"Sample Data"},"documentsUrl":{"type":"string","description":"Where to send a request for this template.","x-ms-summary":"Documents URL"}}},"TemplateList":{"type":"object","required":["templates"],"properties":{"templates":{"type":"array","items":{"$ref":"#/definitions/TemplateSummary"},"description":"The company's templates.","x-ms-summary":"Templates"}}},"TemplateSummary":{"type":"object","required":["id","name","source","templateFormat","mode","outputFormat","ready"],"properties":{"id":{"type":"string","description":"The template's id.","x-ms-summary":"Template ID"},"name":{"type":"string","description":"The template's name.","x-ms-summary":"Template Name"},"source":{"type":"string","enum":["base","approval","excel","sharepoint_list","dataverse","google_sheet","api"],"description":"Where the template's own records come from: an Excel table, a SharePoint list, a Dataverse table, a Google sheet, a Base table or an approval form, or nowhere (api: only this API fills it).","x-ms-summary":"Source"},"templateFormat":{"type":"string","enum":["docx","xlsx","pptx"],"description":"The template file's kind.","x-ms-summary":"Template Format"},"mode":{"type":"string","enum":["separate","list","continuous","labels"],"description":"What a request makes: separate is one document per item, the others one document from all items.","x-ms-summary":"Mode"},"outputFormat":{"type":"string","enum":["pdf","png","docx","xlsx","pptx"],"description":"The file a request makes when it does not ask for a format.","x-ms-summary":"Output Format"},"ready":{"type":"boolean","description":"False while the template has no file, or errors in it stop documents being made.","x-ms-summary":"Ready"}}}},"parameters":{},"responses":{},"securityDefinitions":{"api_key":{"type":"apiKey","in":"header","name":"X-Webhook-API-Key"}},"security":[{"api_key":[]}],"tags":[],"x-ms-connector-metadata":[{"propertyName":"Website","propertyValue":"https://www.automadoc.cc"},{"propertyName":"Privacy policy","propertyValue":"https://www.automadoc.cc/en/privacy"},{"propertyName":"Categories","propertyValue":"Productivity;Content and Files"}]}