---
title: "Infer import schema"
method: POST
path: "/v1/collections/import/infer"
tags: ["Collections"]
---

# Infer import schema

`POST /v1/collections/import/infer`

Infer source fields + types from a sample of an external export and return a suggested source->target mapping for the collection-import wizard. Runs on the sample alone; no data is written.

## Request body

- SchemaInferenceRequest — Request body for POST /v1/collections/import/infer.
  - `sample_rows` object[] — A sample of export rows to infer from.
  - `source_schema` object, nullable — Optional declared source schema (advisory).
  - `sample_size` integer — Max rows to consider from sample_rows.
  - `known_index_dims` object, nullable — Known target vector index dims, used to recognise base64 vectors.

## Response `200`

Successful Response

- SchemaInferenceResult
  - `fields` InferredField[]
    - `path` string, required
    - `type` 'string' | 'integer' | 'float' | 'boolean' | 'datetime' | 'vector' | 'object' | 'null', required
    - `cardinality` 'low' | 'high', nullable
    - `sample` unknown
    - `dim` integer, nullable
    - `dtype` string, nullable
    - `suggested_target` MappingTarget, required — Where a source field lands in the Mixpeek document.
      - `kind` 'metadata' | 'vector' | 'identity' | 'parent' | 'ignore', required — metadata | vector | identity | parent | ignore
      - `path` string, nullable — Target path for kind=metadata (e.g. 'metadata.brand').
      - `index` string, nullable — Vector index name for kind=vector.
      - `dim` integer, nullable — Vector dimension for kind=vector.
      - `dtype` string, nullable — Source vector dtype for kind=vector (e.g. 'float16-base64').
      - `role` 'root_object_id' | 'root_bucket_id' | 'source_object_id' | 'source_document_id' | 'source_collection_id' | 'document_id' | 'content_hash', nullable — Lineage role for kind=identity.
      - `chain_position` integer, nullable — Position in chain[] for kind=parent.
      - `expected_type` 'string' | 'integer' | 'float' | 'boolean' | 'datetime' | 'vector' | 'object' | 'null', nullable — The source type this target requires. When set and the inferred source type differs, validate_mapping flags it (unhappy case f).
  - `warnings` string[]

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Validation Error
- `500` — Internal Server Error

---

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