> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/document-ai/developer-documentation/generation-1/generate-document-async.md).

# Generate document (Async)

```json
{"openapi":"3.1.0","info":{"title":"Document AI API","version":"1.0.0"},"tags":[{"name":"Generation"}],"servers":[{"description":"UAT","url":"https://api-docai-uat.uptiq.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"in":"header","name":"X-Api-Key","type":"apiKey"}},"schemas":{"GenerateRequest.c36812a":{"properties":{"data":{"description":"Array of sections (minimum 1 required)","items":{"$ref":"#/components/schemas/GenerateRequest.c36812a.SectionItem"},"minItems":1,"title":"Data","type":"array"},"format":{"default":"docx","description":"Output format (currently only 'docx' supported)","title":"Format","type":"string"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Business context metadata","title":"Metadata"},"style":{"anyOf":[{"$ref":"#/components/schemas/GenerateRequest.c36812a.StyleConfig"},{"type":"null"}],"default":null,"description":"Styling configuration"},"webhookUrl":{"anyOf":[{"format":"uri","maxLength":2083,"minLength":1,"type":"string"},{"type":"null"}],"default":null,"description":"Completion webhook URL (must be HTTPS)","title":"Webhookurl"}},"required":["data"],"title":"GenerateRequest","type":"object"},"GenerateRequest.c36812a.SectionItem":{"description":"Individual section in the data array","properties":{"sectionData":{"additionalProperties":true,"description":"Section-specific data","title":"Sectiondata","type":"object"},"sectionKey":{"description":"Section identifier (must be unique within the data array)","minLength":1,"title":"Sectionkey","type":"string"}},"required":["sectionKey","sectionData"],"title":"SectionItem","type":"object"},"GenerateRequest.c36812a.StyleConfig":{"description":"Document styling configuration","properties":{"fontFamily":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"Calibri","description":"Font family","title":"Fontfamily"},"fontSize":{"anyOf":[{"maximum":72,"minimum":8,"type":"integer"},{"type":"null"}],"default":11,"description":"Font size (8-72)","title":"Fontsize"},"headerFooter":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":true,"description":"Include header and footer","title":"Headerfooter"},"lenderName":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Lender/company name","title":"Lendername"},"pageNumbers":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":true,"description":"Include page numbers","title":"Pagenumbers"},"primaryColor":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"1F4E79","description":"Primary color (hex with or without #)","title":"Primarycolor"},"secondaryColor":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Secondary color (hex with or without #)","title":"Secondarycolor"},"tableOfContents":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":false,"description":"Include table of contents","title":"Tableofcontents"}},"title":"StyleConfig","type":"object"},"GenerateResponse.c36812a":{"properties":{"generationId":{"description":"Generation ID","title":"Generationid","type":"string"},"message":{"description":"Status message","title":"Message","type":"string"},"requestId":{"description":"Request ID","title":"Requestid","type":"string"},"status":{"description":"Status","title":"Status","type":"string"},"success":{"description":"Success flag","title":"Success","type":"boolean"}},"required":["success","generationId","requestId","status","message"],"title":"GenerateResponse","type":"object"},"ValidationError.6a07bef":{"description":"Model of a validation error response.","items":{"$ref":"#/components/schemas/ValidationError.6a07bef.ValidationErrorElement"},"title":"ValidationError","type":"array"},"ValidationError.6a07bef.ValidationErrorElement":{"description":"Model of a validation error response element.","properties":{"ctx":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"title":"Error context"},"loc":{"items":{"type":"string"},"title":"Missing field name","type":"array"},"msg":{"title":"Error message","type":"string"},"type":{"title":"Error type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationErrorElement","type":"object"}}},"paths":{"/generate":{"post":{"description":"","operationId":"post__generate","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest.c36812a"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateResponse.c36812a"}}},"description":"Created"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError.6a07bef"}}},"description":"Bad Request"},"401":{"description":"Authentication required — the `X-Api-Key` header is missing or invalid."}},"summary":"Generate document (Async)","tags":["Generation"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/document-ai/developer-documentation/generation-1/generate-document-async.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
