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

# Generate Configuration Spreadsheet

> Creates a new Google Spreadsheet with the FMV1 configuration template structure.
The spreadsheet contains all the required sheets, headers, and formatting but no
data — it is a blank template ready to be filled in.

The spreadsheet is created in the caller's Google Drive.

**Required permission:** `company.configuration:export`

<Note>
This endpoint requires an API key created with the **FMV1_CONFIGURATION_MANAGER** role.
See [Authentication](/api-reference/authentication) for how to create API keys with specific roles.
</Note>




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/v1/external/companies/{companyId}/configuration/generate
openapi: 3.0.3
info:
  title: AI Insurance External API
  description: External API for AI Insurance platform
  version: 1.0.0
  contact:
    email: support@aiinsurance.io
servers:
  - url: https://app.aiinsurance.io
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/external/companies/{companyId}/configuration/generate:
    post:
      tags:
        - FMV1 Configuration
      summary: Generate Configuration Spreadsheet
      description: >
        Creates a new Google Spreadsheet with the FMV1 configuration template
        structure.

        The spreadsheet contains all the required sheets, headers, and
        formatting but no

        data — it is a blank template ready to be filled in.


        The spreadsheet is created in the caller's Google Drive.


        **Required permission:** `company.configuration:export`


        <Note>

        This endpoint requires an API key created with the
        **FMV1_CONFIGURATION_MANAGER** role.

        See [Authentication](/api-reference/authentication) for how to create
        API keys with specific roles.

        </Note>
      operationId: generateFmv1ConfigurationSpreadsheet
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfigurationGenerateRequest'
            examples:
              minimal:
                summary: Generate with default title
                value:
                  googleOAuthToken: ya29.a0AfH6SM...
              withTitle:
                summary: Generate with custom title
                value:
                  googleOAuthToken: ya29.a0AfH6SM...
                  title: Allied Professionals Configuration
      responses:
        '200':
          description: Spreadsheet generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConfigurationExportResponse'
              examples:
                success:
                  summary: Spreadsheet generated
                  value:
                    spreadsheetId: 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms
                    spreadsheetUrl: >-
                      https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
  schemas:
    ConfigurationGenerateRequest:
      type: object
      description: Request to generate a new FMV1 configuration template spreadsheet
      required:
        - googleOAuthToken
      properties:
        googleOAuthToken:
          type: string
          description: >-
            A valid Google OAuth2 access token with Google Sheets create
            permission
        title:
          type: string
          description: >-
            Title for the new spreadsheet. If omitted, defaults to
            "Configuration - {ISO timestamp}".
    ConfigurationExportResponse:
      type: object
      description: Result of exporting FMV1 configuration to a Google Spreadsheet
      required:
        - spreadsheetId
        - spreadsheetUrl
      properties:
        spreadsheetId:
          type: string
          description: The ID of the spreadsheet that was written to
        spreadsheetUrl:
          type: string
          description: Direct URL to the spreadsheet
    ErrorResponse:
      type: object
      description: Standard error response for all external API endpoints
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human-readable error message
              example: 'submissionId: Required field is missing'
            details:
              type: array
              description: Additional details for validation errors (field-level errors)
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The field that caused the error
                    example: submissionId
                  message:
                    type: string
                    description: Description of the field error
                    example: Required field is missing
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingApiKey:
              summary: Missing API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: Authorization header is required
            bearerTokenNotAllowed:
              summary: Bearer token used instead of API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: External API endpoints require API key authentication
    Forbidden:
      description: Forbidden - Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientPermissions:
              summary: Insufficient permissions
              value:
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
    InternalServerError:
      description: Internal Server Error - Unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internalError:
              summary: Unexpected server error
              value:
                error:
                  code: INTERNAL_ERROR
                  message: An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Include your API key in the Authorization
        header.

````