> ## 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>

<Note>
  This endpoint accepts an optional `Idempotency-Key` request header so a retry
  cannot apply the change twice. See
  [Idempotent requests](/docs-api/api-idempotency).
</Note>


## 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://static.orion.file.ai/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://static.orion.file.ai/how-to-use-api-keys.png)
        
  version: '1.0'
  contact: {}
servers:
  - url: https://api.orion.file.ai
    description: Default. Use this unless your workspace is on an instance.
  - url: https://api.orion.{instance}.file.ai
    description: Instance-specific host.
    variables:
      instance:
        default: au
        enum:
          - au
          - sg
          - jp
        description: >-
          Instance hosting your workspace: au (Australia), sg (Singapore), jp
          (Japan).
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:
        - name: Idempotency-Key
          in: header
          description: >-
            Optional opaque key (max 255 chars, UUIDv4 recommended) making this
            request idempotent for 24h: a retry with the same key and body
            replays the original response with Idempotent-Replayed: true.
          required: false
          schema:
            type: string
      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
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '401':
          description: Missing or invalid API key.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '403':
          description: Read-only or inactive API key.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '404':
          description: Resource not found.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '422':
          description: Unprocessable Entity - File is required
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '429':
          description: Rate limit exceeded.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
        '500':
          description: Unexpected internal error.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetailsDto'
      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
    ProblemDetailsDto:
      type: object
      properties:
        type:
          type: string
          description: A URI identifying the problem type.
          example: https://errors.file.ai/validation-failed
        title:
          type: string
          description: Stable, human-readable summary of the problem type.
          example: Validation failed
        status:
          type: number
          description: HTTP status code.
          example: 422
        detail:
          type: string
          description: Human-readable explanation specific to this occurrence.
          example: One or more fields are invalid.
        instance:
          type: string
          description: URI reference for this occurrence (the request path).
          example: /v1/files/upload
        code:
          type: string
          description: Stable machine-readable error code.
          example: VALIDATION_FAILED
        requestId:
          type: string
          description: Correlation id for this request.
          example: 0f1c8e03-978e-40d5-bc93-6894a57f9324
        errors:
          description: Field-level violations (validation only).
          type: array
          items:
            $ref: '#/components/schemas/ProblemErrorItemDto'
        retryAfter:
          type: number
          description: Seconds until the client may retry (present on 429 only).
          example: 42
        message:
          type: string
          description: Legacy key (deprecated — use `detail`/`title`).
          example: Validation failed
        error:
          type: string
          description: Legacy key (deprecated — use `title`).
          example: Unprocessable Entity
        statusCode:
          type: number
          description: Legacy key (deprecated — use `status`).
          example: 422
      required:
        - type
        - title
        - status
        - detail
        - instance
        - code
        - requestId
        - errors
        - message
        - error
        - statusCode
    ProblemErrorItemDto:
      type: object
      properties:
        code:
          type: string
          example: REQUIRED
        detail:
          type: string
          example: must not be empty
        pointer:
          type: string
          description: JSON Pointer to the offending body field.
          example: '#/fileName'
        parameter:
          type: string
          description: Name of the offending query/header parameter.
          example: limit
      required:
        - code
        - detail
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````