GenerationDraft Generator
Create Draft
View DocsAPI Reference
Authorization
ApiKeyAuth access-key<token>
Your unique access-key generated from the platform UI
In: header
Request Body
application/json
template_doc_process_id*string
Document ID of the template (must match the doc_process_id used in Generate Template API)
model_data*
filled_template_variables*
Array of template fields with user values (obtained from Generate Template API response)
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.k-v.ai/api/agent/draft/create_draft" \ -H "Content-Type: application/json" \ -d '{ "template_doc_process_id": "your_doc_id", "model_data": { "model_name": "gpt-5.1", "api_key": "" }, "filled_template_variables": [ { "category": "Agreement Basic Information", "label": "Governing Law State", "type": "text", "description": "State whose laws govern the Settlement Agreement", "current_value": [ "California" ], "options": null, "page_no": null, "user_value": "New York" }, { "category": "Party Information - Plaintiff", "label": "Plaintiff Name", "type": "text", "description": "Name of the Plaintiff entity", "current_value": [ "ABC Software Corporation" ], "options": null, "page_no": null, "user_value": "XYZ Software Corporation" } ] }'{
"value": {
"data": "<!DOCTYPE html>\\n<html>\\n<head>\\n<meta charset=\\\"UTF-8\\\">\\n</head>\\n<body>\\n<div id=\\\"page-1\\\">\\n<p><b>SETTLEMENT AGREEMENT AND RELEASE</b></p>\\n<p>THIS SETTLEMENT AGREEMENT is entered into between XYZ Software Corporation (Plaintiff), and Universal Corporation (Defendant).</p>\\n<p>...governed by the laws of the State of New York...</p>\\n</body>\\n</html>",
"message": "Draft created successfully"
}
}{
"value": {
"data": {},
"message": "Invalid docs selected"
}
}{
"value": {
"data": {},
"message": "Invalid or missing access key"
}
}{
"detail": [
{
"type": "literal_error",
"loc": [
"string"
],
"msg": "string",
"input": "string",
"ctx": {
"expected": "string"
}
}
]
}{
"data": {},
"message": "litellm.AuthenticationError: AuthenticationError: OpenAIException - Incorrect API key provided: tyrdfuih**uhf7. You can find your API key at https://platform.openai.com/account/api-keys."
}