> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit a survey draft with Kai

> Ask Kai to edit the draft. Body `{ instruction, definition?, selectedId?, lang? }`: `definition` is the
editor's working copy (default: the stored draft), `selectedId` the step "this question" refers to, `lang`
the language the teammate is viewing. Nothing is saved: returns `{ status: 'edited', summary, definition,
changes: [{ kind, step, id, number?, type?, title, details }], warnings, languagesAdded, languagesNotInProject }`
for review, or `{ status: 'unrelated' | 'unclear' | 'no_change' | 'failed', message }`. Existing questions keep
their ids and answer keys. Uses AI credits (402 when out of AI usage); 429 when asked too often.



## OpenAPI

````yaml https://api.gleap.io/api-docs.json post /engagement/surveys/{surveyId}/kai-edit
openapi: 3.0.0
info:
  title: gleap-server
  version: 14.0.0
  contact: {}
servers:
  - url: https://api.gleap.io/v3
security: []
paths:
  /engagement/surveys/{surveyId}/kai-edit:
    post:
      tags:
        - Engagement Survey
      summary: Edit a survey draft with Kai
      description: >-
        Ask Kai to edit the draft. Body `{ instruction, definition?,
        selectedId?, lang? }`: `definition` is the

        editor's working copy (default: the stored draft), `selectedId` the step
        "this question" refers to, `lang`

        the language the teammate is viewing. Nothing is saved: returns `{
        status: 'edited', summary, definition,

        changes: [{ kind, step, id, number?, type?, title, details }], warnings,
        languagesAdded, languagesNotInProject }`

        for review, or `{ status: 'unrelated' | 'unclear' | 'no_change' |
        'failed', message }`. Existing questions keep

        their ids and answer keys. Uses AI credits (402 when out of AI usage);
        429 when asked too often.
      operationId: KaiEdit
      parameters:
        - in: path
          name: surveyId
          required: true
          schema:
            type: string
        - in: header
          name: project
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema: {}
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema: {}
      security:
        - jwt: []
components:
  securitySchemes:
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.