## TL;DR

Your import body is bigger than the server accepts. Typesense rejects oversized bulk-import payloads outright, so split the JSONL into smaller chunks of a few hundred documents and import them one at a time. Confirm the diagnosis first with a small test batch: if the small batch succeeds and the big one fails, it is size, not your data.

```text
{"message": "Request too large."}
```

## Steps

1. Confirm it is size, not content. Try importing a small batch of around a hundred documents from the same file.
   Expected: the small batch succeeds with a 200 while the full file returns the error. That proves it is the payload size.

2. Split the JSONL file into chunks. Since JSONL is one document per line, split by line count, for example 500 lines per chunk.
   Expected: N chunk files, each a fraction of the original size.

3. Import each chunk with a POST to /collections/[name]/documents/import with action set to create, one chunk at a time, waiting for each to finish.
   Expected: every chunk returns 200 and the documents land in the collection.

4. Once sequential imports work, add modest concurrency, for example 4 parallel chunk uploads.
   Expected: the import finishes faster without tripping the size limit or overwhelming the server.

5. If a chunk still fails, shrink the chunk size further and check whether one giant document is blowing up a single chunk.
   Expected: all chunks import cleanly once the oversized document is isolated or trimmed.

## Use this when

- The bulk import endpoint returns request too large.
- Small test imports succeed but the full file fails.
- You are importing a large JSONL file in one request.
- The failure started when the import file grew past some size.

## Not for this skill when

- Small batches fail too. That is malformed JSONL or a schema problem, not size.
- The error is a 401 or 404. Check your API key and collection name first.
- Individual documents fail validation inside a successful import. Those are per-document errors in the response lines, a different fix.

## Variant phrasings

- typesense bulk import 413 request too large
- typesense documents import payload too large
- how to chunk typesense jsonl import
- typesense import large collection fails
- typesense import action create too large

## Why it happens

Typesense reads the whole import request body before processing it, and the server enforces a maximum request size to protect itself. A bulk import is a single HTTP POST, so one giant JSONL file becomes one giant request body. The server rejects it with a 413 before looking at a single document. Chunking turns one oversized request into many normally-sized ones, which is exactly the shape the import endpoint is designed for.

## Edge cases

- One enormous document can blow up even a small chunk. If a chunk fails at any size, inspect the largest lines in the file.
- Parallel chunk uploads share the server's import threads. Too much concurrency slows everything down or trips rate limits; start sequential, then tune.
- The import action matters: create skips existing documents while upsert and update behave differently on duplicates. Keep the same action across chunks.
- Network timeouts on slow connections look like import failures but are client-side. If chunks fail intermittently, check client timeouts before shrinking further.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_uNI-sTg_m5LgITlL24yDZA
