---
title: "Define a form using AI assistance"
method: POST
path: "/api/agents/forms/define"
tags: ["Agents"]
---

# Define a form using AI assistance

`POST /api/agents/forms/define`

Uses AI to generate or refine a form definition based on the provided prompt.

## Request body

- DefineFormRequest — Request model for defining a form using AI assistance.
  - `prompt` string, required — The prompt to guide the AI in form definition.
  - `definition` string, nullable — Optional existing form definition to refine or modify.
  - `agentName` string — Optional assistant ID for continuing a conversation.
  - `threadId` integer, nullable — Optional thread ID for continuing a conversation.
  - `formId` integer, nullable — Optional form ID to associate the conversation with a specific form.

## Response `200`

Form definition generated successfully.

- DefineFormResponse — Response model for the AI-assisted form definition.
  - `userPrompt` DefineFormResponseUserMessage
    - `id` integer
    - `content` string
  - `agentResponse` DefineFormResponseAgentMessage — The response from the AI agent.
    - `id` integer
    - `content` string
    - `definition` string, nullable — The AI-generated or refined form definition.
  - `agentId` string — The agent ID for continuing the conversation.
  - `threadId` string — The thread ID for continuing the conversation.

## Other responses

- `400` — Invalid input data.
- `401` — Unauthorized
- `403` — Forbidden

## Changes

- **2026-02-06** `a99906323223` — 2 breaking, 1 warning, 1 info
  - added `#/components/schemas/DefineFormResponse_AgentMessage` to the `agentResponse` response property `oneOf` list for the response status `200`
  - the `agentResponse` response's property type/format changed from `string`/`` to ``/`` for status `200`
  - removed the optional property `definition` from the response with the `200` status
  - added the optional property `userPrompt` to the response with the `200` status
- **2025-11-21** `50eff5014b78` — 1 info
  - endpoint added
- **2025-03-24** `fbc3fe6ecbf1` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/endatix/apis/endatix-platform-rest-api/changes/api/agents/forms/define/post.md)

---

[API](https://skmtc.dev/endatix/apis/endatix-platform-rest-api.md) · [All operations](https://skmtc.dev/endatix/apis/endatix-platform-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/endatix/endatix-platform-rest-api/revisions/01bd299fd100/schema)
