Logo
GenerationDraft Generator

Generate Template

View Docs

API Reference

POST
/api/agent/draft/generate_template

Authorization

ApiKeyAuth
access-key<token>

Your unique access-key generated from the platform UI

In: header

Request Body

application/json

doc_process_id*string

Document ID to extract template from (obtained from Upload or List Documents APIs)

model_data*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.k-v.ai/api/agent/draft/generate_template" \  -H "Content-Type: application/json" \  -d '{    "doc_process_id": "your_doc_id",    "model_data": {      "model_name": "gpt-5.1",      "api_key": ""    }  }'
{
  "value": {
    "data": {
      "form": [
        {
          "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": null
        },
        {
          "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": null
        }
      ],
      "tokens": {
        "input": 1688,
        "output": 549,
        "total": 2237
      }
    },
    "message": "Draft template generated 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."
}