---
title: "Analyze Import"
method: POST
path: "/imports/analyze"
tags: ["imports"]
---

# Analyze Import

`POST /imports/analyze`

Analyze import request to determine add/update/skip status for each document.

This endpoint receives file metadata (not file contents) from the frontend
and analyzes which documents should be added, updated, skipped, or failed
based on existing documents in the workspace.

Args:
    analysis_request: Request containing workspace_id and documents metadata
    db: Database session
    current_user: Authenticated user

Returns:
    ImportAnalysisResponse with document statuses and summary

Raises:
    HTTPException: If workspace doesn't exist or other validation errors occur

## Request body

- ImportAnalysisRequest — Request schema for import analysis.
  - `workspace_id` string, uuid, required — Target workspace ID
  - `documents` object, required — Reference key to file metadata mapping

## Response `200`

Successful Response

- ImportAnalysisResponse — Response schema for import analysis.
  - `documents` object, required — Reference key to document info mapping
  - `summary` ImportSummary, required — Summary statistics for import analysis.
    - `total_documents` integer, required — Total number of documents analyzed
    - `add_count` integer, required — Number of documents to be added
    - `update_count` integer, required — Number of documents to be updated
    - `skip_count` integer, required — Number of documents to be skipped
    - `failed_count` integer, required — Number of documents that failed analysis

## Other responses

- `400` — Bad Request
- `403` — Forbidden
- `404` — Not Found
- `409` — Conflict
- `422` — Unprocessable Content
- `500` — Internal Server Error

---

[API](https://skmtc.net/hf/apis/extralit-v1.md) · [All operations](https://skmtc.net/hf/apis/extralit-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hf/extralit-v1/revisions/e9da3a893a88/schema)
