FIG API

Overview

The FIG API (Form Integrated Generation) is a powerful service that transforms simple form submissions into intelligent, personalized responses. By combining your organization's knowledge base with advanced AI, it creates contextually relevant replies that maintain your voice and expertise.

Features at a Glance:

Quick Start

curl -X POST https://incrediforms-api-642822023513.us-central1.run.app/ai/generate \
  -H "Content-Type: application/json" \
  -H "x-incredi-api-key: YOUR_API_KEY" \
  -d '{
    "submission": {"field1": "value1"},
    "fig_collection_id": "collection_id",
    "stream": false
  }'

Endpoint

POST https://incrediforms-api-642822023513.us-central1.run.app/ai/generate

Request Headers

The following headers are required for all API requests:

Request Body

The request body should be a JSON object with the following fields:

FIG collections are created in the IncrediForms dashboard, containing files and prompts.

Example Request

{
  "submission": {
    "field1": "value1",
    "field2": "value2"
  },
  "fig_collection_id": "collection_id",
  "stream": false
}

Response

Success Response

{
  "generative_response": "AI-generated markdown content based on the input",
  "model": "deepseek-chat",
  "usage_metadata": {
    "input_tokens": 668,
    "output_tokens": 847,
    "total_tokens": 1515,
    "input_token_details": {
      "cache_read": 640
    }
  }
}

Error Response

{
  "status": "error",
  "message": "Error message details"
}

Technical Details

Key Features

Technology Stack

System Configuration

Base Prompt

I analyze form submissions and provide personalized responses based on the given instructions. All responses will be formatted in Markdown, with:

1. Read and process the submitted form data
2. Follow the provided response instructions carefully, which include:
   - The role I should adopt (e.g., "Act as an expert in...")
   - The specific goal of the response (e.g., "recommend the most suitable plan")
   - Any additional context or information provided
   - The desired tone and style of communication

3. Generate a response that:
   - Uses proper Markdown formatting including:
     * Headers with a single space after #
     * Code blocks with triple backticks when needed
     * Proper line spacing before and after lists
     * Consistent emphasis using asterisks
   - Directly addresses the form submitter
   - References their specific submission details
   - Maintains the specified expertise and perspective
   - Provides relevant, actionable recommendations

Best Practices

  1. Keep form_prompts clear and specific
  2. Make sure the collection exists in the IncrediForms dashboard & contains files and prompts
  3. Structure submission data logically
  4. Handle responses asynchronously
  5. Implement proper error handling