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

# Bulk Import FAQs

> Bulk-import FAQ entries into an agent from a JSON payload

## Overview

Import multiple FAQ entries into an agent in a single request. A successful import automatically sets `faqEnabled = true` on the agent. Entries exceeding the 100-FAQ limit are automatically trimmed — check the `trimmed` field in the response.

## Required Permission

`agents`

## Path Parameters

| Name    | Type   | Required | Description              |
| ------- | ------ | -------- | ------------------------ |
| `botId` | string | Yes      | Unique agent identifier. |

## Request Body

| Field         | Type   | Required | Description                                                    |
| ------------- | ------ | -------- | -------------------------------------------------------------- |
| `botId`       | string | Yes      | Must match the `botId` path parameter.                         |
| `environment` | string | Yes      | Target environment: `development`, `staging`, or `production`. |
| `faq`         | array  | Yes      | Array of FAQ entry objects to import.                          |

### FAQ Entry Object

| Field       | Type      | Required | Description                                                             |
| ----------- | --------- | -------- | ----------------------------------------------------------------------- |
| `questions` | string\[] | Yes      | Question phrasings. Maximum 10 per entry (extras are silently trimmed). |
| `answer`    | string    | Yes      | The spoken answer when a match is detected.                             |
| `language`  | string    | Yes      | BCP-47 language code (e.g. `en-IN`).                                    |
| `signal`    | string    | No       | Optional analytics label.                                               |

## Import Limits

| Limit                                  | Behaviour                                                                                 |
| -------------------------------------- | ----------------------------------------------------------------------------------------- |
| Max 100 FAQs per agent per environment | Entries beyond 100 are auto-trimmed. Response includes `trimmed: true` and `trimWarning`. |
| Max 10 question phrasings per entry    | Entries with more than 10 questions are silently trimmed to 10.                           |

## Example cURL

```bash theme={null}
curl -X POST "https://api.inya.ai/platform/v1/agents/fb79920229d144608ebf665a10e50275/faqs/import" \
  -H "x-api-key: <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "botId": "fb79920229d144608ebf665a10e50275",
    "environment": "development",
    "faq": [
      {
        "questions": ["What are your business hours?", "When are you open?"],
        "answer": "We are open Monday to Friday, 9am to 6pm IST.",
        "language": "en-IN"
      },
      {
        "questions": ["How do I cancel my subscription?"],
        "answer": "To cancel, visit our website or contact billing@example.com.",
        "language": "en-IN",
        "signal": "CANCELLATION_INTENT"
      }
    ]
  }'
```

## Response

### Success (200)

```json theme={null}
{
  "status": "success",
  "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "message": "FAQs imported successfully",
  "response": {
    "importedCount": 2,
    "totalFaqs": 2,
    "trimmed": false,
    "trimWarning": null,
    "faqIds": ["faq_xyz001", "faq_xyz002"]
  }
}
```

## Response Fields

| Field           | Type      | Description                                                                  |
| --------------- | --------- | ---------------------------------------------------------------------------- |
| `importedCount` | integer   | Number of FAQ entries successfully imported.                                 |
| `totalFaqs`     | integer   | Total FAQs now stored for this agent in the specified environment.           |
| `trimmed`       | boolean   | `true` if some entries were removed because the 100-entry limit was reached. |
| `trimWarning`   | string    | Description of the trim applied. `null` when no trimming occurred.           |
| `faqIds`        | string\[] | Identifiers for all imported FAQ entries.                                    |

### Error Responses

**400 Bad Request**

```json theme={null}
{
  "status": "failure",
  "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "message": "FAQ import failed. Invalid data format."
}
```

**404 Not Found** - Agent does not exist

```json theme={null}
{
  "status": "failure",
  "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "message": "Agent not found"
}
```

## Use Cases

* Loading a large FAQ dataset into an agent at once
* Migrating FAQ content from another system or CMS
* Replacing an entire FAQ knowledge base after a content review

<Warning>
  Always check the `trimmed` and `importedCount` fields in the response. Entries beyond the 100-FAQ limit are silently removed — you will not receive an error, only the warning in the response body.
</Warning>

<Note>
  Get a sample payload using the **GET FAQ Sample** endpoint to ensure your JSON is correctly structured before a large import.
</Note>

<Note>
  Save the `requestId` from every response. You will need it if you contact Inya support to trace a specific request.
</Note>


## OpenAPI

````yaml POST /v1/agents/{botId}/faqs/import
openapi: 3.0.3
info:
  title: Platform Agents API
  description: API endpoints for creating, managing, and interacting with voice agents
  version: 2.1.0
servers:
  - url: https://api.inya.ai/platform
    description: Production server
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
    description: Agent management operations
  - name: AgentFAQ
    description: Agent FAQ management
  - name: AgentCallTriggers
    description: Outbound call triggers
  - name: ChatSDK
    description: Chat Widget configuration
  - name: Conversations
    description: Conversation logs, statistics, and audio
paths:
  /v1/agents/{botId}/faqs/import:
    post:
      tags:
        - AgentFAQ
      summary: Bulk import FAQ entries
      description: >-
        Bulk-import FAQ entries. An agent can hold a maximum of 100 FAQs.
        Imports exceeding this limit are automatically trimmed. Each entry may
        contain at most 10 questions.
      operationId: importFaqs
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddFaqRequest'
      responses:
        '200':
          description: FAQs imported successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardResponse'
              examples:
                success:
                  value:
                    status: success
                    requestId: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    message: FAQs imported successfully
                    response:
                      importedCount: 1
                      totalFaqs: 1
                      trimmed: false
                      trimWarning: null
                      faqIds:
                        - faq_xyz001
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    AgentId:
      name: botId
      in: path
      required: true
      description: Unique identifier of the agent
      schema:
        type: string
  schemas:
    AddFaqRequest:
      type: object
      required:
        - botId
        - environment
        - faq
      properties:
        botId:
          type: string
          example: fb79920229d144608ebf665a10e50275
        environment:
          type: string
          enum:
            - development
            - staging
            - production
        faq:
          type: array
          items:
            type: object
            required:
              - questions
              - answer
              - language
            properties:
              questions:
                type: array
                items:
                  type: string
                maxItems: 10
              answer:
                type: string
              language:
                type: string
                example: en-IN
              signal:
                type: string
    StandardResponse:
      type: object
      properties:
        status:
          type: string
          example: success
        requestId:
          type: string
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        message:
          type: string
        response:
          type: object
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          example: error
        requestId:
          type: string
          example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        message:
          type: string
  responses:
    BadRequest:
      description: Validation error or malformed request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key with 'agents' permission

````