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

# Generate Analytics

> Trigger AI analysis on a form's responses. Generates a summary, insights, recommendations, and key metrics. Overwrites any previously stored analytics for this form.



## OpenAPI

````yaml openapi.json post /forms/{id}/analytics/generate
openapi: 3.1.0
info:
  title: GeniusForms API
  description: >-
    AI-powered form builder API. Create forms manually or generate them from
    natural language prompts.
  version: 1.0.0
  contact:
    name: GeniusForms Support
    email: support@geniusforms.ai
    url: https://geniusforms.ai
servers:
  - url: https://geniusforms.ai/api/v1
    description: Production
  - url: http://localhost:8000/api/v1
    description: Local Development
security:
  - ApiKeyAuth: []
paths:
  /forms/{id}/analytics/generate:
    post:
      tags:
        - Analytics
      summary: Generate Analytics
      description: >-
        Trigger AI analysis on a form's responses. Generates a summary,
        insights, recommendations, and key metrics. Overwrites any previously
        stored analytics for this form.
      operationId: generateAnalytics
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Form ID
      responses:
        '200':
          description: Analytics generated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Analytics'
        '400':
          description: Form has no responses to analyze
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Form not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: AI service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Analytics:
      type: object
      properties:
        id:
          type: integer
          example: 1
        formId:
          type: integer
          example: 208
        totalResponses:
          type: integer
          example: 42
        completionRate:
          type: integer
          example: 100
        insights:
          type: object
          properties:
            summary:
              type: string
              example: >-
                Your Customer Feedback form received 42 responses with
                predominantly positive sentiment.
            insights:
              type: array
              items:
                type: string
              example:
                - 87% of respondents rated their experience 4 or 5 stars
                - Email was the most requested follow-up method
            recommendations:
              type: array
              items:
                type: string
              example:
                - >-
                  Consider adding a free-text field to capture specific
                  improvement suggestions
                - Follow up with the 13% who gave low ratings
            keyMetrics:
              type: object
              properties:
                responseRate:
                  type: string
                  example: 87%
                topAnswer:
                  type: string
                  example: Very Satisfied
                sentiment:
                  type: string
                  example: positive
        lastAnalyzed:
          type: string
          format: date-time
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
          example: validation_error
        message:
          type: string
          example: Invalid request
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key obtained from your GeniusForms dashboard

````