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

# Import schemas

> Import schemas from a previously exported zip file.

**Request:**
- Content-Type: `multipart/form-data`
- `file` (file, required): The exported zip file

**Response:**
- `success` (boolean): Whether the import was successful
- `importedBlueprintsCount` (number): Number of blueprints imported
- `importedSchemasCount` (number): Number of schemas imported
- `conflictBlueprintsCount` (number): Number of blueprints that had conflicts
- `conflictBlueprints` (string[]): List of conflicting blueprint class names
- `blueprintIds` (string[]): IDs of the imported blueprints
- `schemaIds` (string[]): IDs of the imported schemas

**Notes:**
- All imported blueprints and schemas will be assigned new IDs
- Metadata (organization, workspace, user) will be updated to the importing user
- If a blueprint with the same class name already exists, the import will fail

Import schemas from a previously exported zip file. This endpoint allows you to restore or transfer AI schemas between workspaces.

<Info>
  All imported blueprints and schemas will be assigned new IDs. Metadata will be
  updated to the importing user's context.
</Info>

## How It Works

<Steps>
  <Step title="1. Prepare Export File">
    Use the export endpoint to create a zip file with your schemas
  </Step>

  <Step title="2. Upload File">
    Submit the exported zip file as multipart/form-data
  </Step>

  <Step title="3. Process Import">
    System creates new schemas with updated metadata and IDs
  </Step>
</Steps>

## Request Parameters

### Request Body

The request must be sent as `multipart/form-data` with the following property:

| Property | Type | Required | Description                     |
| -------- | ---- | -------- | ------------------------------- |
| file     | file | Yes      | The exported zip file to import |

## Import Behavior

<Warning>
  If a blueprint with the same class name already exists in the target
  workspace, the import will fail.
</Warning>

### What Gets Imported

* **Blueprint configurations** - Document type classifications and extraction rules
* **Schema definitions** - Field mappings, validation rules, and data types
* **Relationships** - Links between blueprints and schemas

### What Gets Updated

* **New IDs** - All imported items receive new unique identifiers
* **Metadata** - Organization, workspace, and user information updated to current context
* **Timestamps** - Creation and modification times reset to import time

### Conflict Handling

<AccordionGroup>
  <Accordion title="Blueprint Name Conflicts" icon="triangle-exclamation">
    If a blueprint with the same class name already exists, the entire import
    fails. You must either: - Rename the existing blueprint - Rename the
    blueprint in the export file - Import to a different workspace
  </Accordion>

  <Accordion title="Schema Field Conflicts" icon="code-compare">
    Schema field conflicts are automatically resolved by creating new schema
    versions with updated field mappings.
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml post /prod/v1/files/schema/import
openapi: 3.0.0
info:
  title: Public API
  description: >-

    ### Welcome to fileAI’s Public API Documentation.

    This API allows users to check the health of the system, upload and manage
    files, and manage AI Schemas.

    Should you have any questions, please reach out to fileAI via the “Contact a
    Developer” link below.



    [Contact a Developer](mailto:support@file.ai)



    ### Prerequisites


    Before using our API, please ensure you complete the following prerequisites

    - You must have a fileAI account. Sign up or login
    [here](https://orion.file.ai/en/sign-up)

    - You must have an API Key. After creating your fileAI account, you can
    generate your API Key. Refer to the Authentication section below for more
    details.



    ### Authentication

    All API requests require an API key for authentication.

    - To obtain your API key, please log in to your fileAI account and navigate
    to Project Settings in your dashboard

    - Keep your API key secure and do not share it publicly.


    ![Authentication](https://fileai-static-assets.s3.us-west-2.amazonaws.com/public-api-service/authentication.png)


    ### How to Use Your API Key

    Once you have your API key:

    - Click the Authorize button on the top-right of this page

    - Enter your API Key under Value

    - Click Authorize to start making authenticated requests directly from the
    documentation


    ![How to Use Your API
    Key](https://fileai-static-assets.s3.us-west-2.amazonaws.com/public-api-service/how-to-use-api-keys.png)
        
  version: '1.0'
  contact: {}
servers:
  - url: https://api.orion.file.ai
security: []
tags:
  - name: Public API V1
paths:
  /prod/v1/files/schema/import:
    post:
      tags:
        - Public API V1
      summary: Import schemas
      description: >-
        Import schemas from a previously exported zip file.


        **Request:**

        - Content-Type: `multipart/form-data`

        - `file` (file, required): The exported zip file


        **Response:**

        - `success` (boolean): Whether the import was successful

        - `importedBlueprintsCount` (number): Number of blueprints imported

        - `importedSchemasCount` (number): Number of schemas imported

        - `conflictBlueprintsCount` (number): Number of blueprints that had
        conflicts

        - `conflictBlueprints` (string[]): List of conflicting blueprint class
        names

        - `blueprintIds` (string[]): IDs of the imported blueprints

        - `schemaIds` (string[]): IDs of the imported schemas


        **Notes:**

        - All imported blueprints and schemas will be assigned new IDs

        - Metadata (organization, workspace, user) will be updated to the
        importing user

        - If a blueprint with the same class name already exists, the import
        will fail
      operationId: PublicAPIController_importBlueprints
      parameters: []
      requestBody:
        required: true
        description: Exported zip file
        content:
          application/json:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: Schemas imported successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportBlueprintsForPAOutput'
        '400':
          description: Bad Request - Invalid file or conflicts detected
        '422':
          description: Unprocessable Entity - File is required
        '429':
          description: Too Many Requests
      security:
        - x-api-key: []
components:
  schemas:
    ImportBlueprintsForPAOutput:
      type: object
      properties:
        success:
          type: boolean
          description: Import success status
        importedBlueprintsCount:
          type: number
          description: Number of blueprints imported
        importedSchemasCount:
          type: number
          description: Number of schemas imported
        conflictBlueprintsCount:
          type: number
          description: Number of conflicting blueprints
        conflictBlueprints:
          description: List of conflicting blueprint class names
          type: array
          items:
            type: string
        blueprintIds:
          description: List of imported blueprint IDs
          type: array
          items:
            type: string
        schemaIds:
          description: List of imported schema IDs
          type: array
          items:
            type: string
      required:
        - success
        - importedBlueprintsCount
        - importedSchemasCount
        - conflictBlueprintsCount
        - conflictBlueprints
        - blueprintIds
        - schemaIds
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````