---
title: "Create an ingestion rule"
method: POST
path: "/v1/projects/{project_id}/ingestion-rules"
tags: ["Ingestion Rules"]
---

# Create an ingestion rule

`POST /v1/projects/{project_id}/ingestion-rules`

## Request

- Base URL: `https://api.naturali.ai`
- URL: `https://api.naturali.ai/v1/projects/{project_id}/ingestion-rules`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.naturali.ai/authorize`, token URL `https://api.naturali.ai/token`, scopes: `mcp:access`)

Creates a rule mapping a content_type glob to a converter. Exactly one of tool_id or agent_id must be set.

## Request body

- object
  - `content_type_glob` string, required: MIME type glob matched against a file's content_type. At most 4 wildcards and 255 characters — a MIME glob needs one on each side of the slash at most.
  - `tool_id` string: Converter tool id (mutually exclusive with agent_id)
  - `agent_id` string: Converter agent id (mutually exclusive with tool_id)
  - `action` string: Operation id, required for mcp tool converters
  - `preset_parameters` object: Merged into the tool input before invocation (tool converters only)
  - `native_extraction` 'first' | 'skip': For native types (PDF/text): `first` (default) converts only when native extraction yields no text; `skip` always converts.
  - `file_delivery` 'base64' | 'download_url': How the file reaches a tool converter (default base64)
  - `chunk_strategy` 'page' | 'whole' | 'size': Default chunk strategy, overridable per ingest request
  - `chunk_size` integer: Default window size in characters for the size strategy
  - `chunk_overlap` integer: Default overlap in characters for the size strategy
  - `metadata` MetadataBag: Caller-owned annotations on a resource, stored as the object they were written as: the types a value was written with are the types a read returns, so a filter can ask an ordering question about a number. Unlike other body fields, keys are stored and returned verbatim in the casing supplied — they are not converted between snake_case and camelCase. No key is reserved, and that is the point: every piece of state the platform owns lives in its own typed column, so nothing written here reaches platform state. The platform never reads the bag — it is not an IAM context, not a policy input and not part of a prompt — which is what separates it from a tag bag.

## Response `201`

Ingestion rule created

- IngestionRule
  - `id` string
  - `project_id` string
  - `content_type_glob` string
  - `tool_id` string, nullable
  - `agent_id` string, nullable
  - `action` string, nullable
  - `preset_parameters` object, nullable
  - `native_extraction` 'first' | 'skip'
  - `file_delivery` 'base64' | 'download_url'
  - `chunk_strategy` string, nullable
  - `chunk_size` integer, nullable
  - `chunk_overlap` integer, nullable
  - `metadata` MetadataBag: Caller-owned annotations on a resource, stored as the object they were written as: the types a value was written with are the types a read returns, so a filter can ask an ordering question about a number. Unlike other body fields, keys are stored and returned verbatim in the casing supplied — they are not converted between snake_case and camelCase. No key is reserved, and that is the point: every piece of state the platform owns lives in its own typed column, so nothing written here reaches platform state. The platform never reads the bag — it is not an IAM context, not a policy input and not part of a prompt — which is what separates it from a tag bag.
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `400`: Validation failed (e.g. tool_id and agent_id both set or both missing)
- `401`: Unauthorized
- `403`: Forbidden
- `409`: A rule for this content_type_glob already exists in the project
- `500`: Internal server error

---

[API](https://skmtc.dev/naturali/apis/naturali-ai-api.md) · [All operations](https://skmtc.dev/naturali/apis/naturali-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/naturali/apis/naturali-ai-api/revisions/e4905b78f422?raw)
