Get Started

# n8n Workflow: Parsing

This tutorial shows a practical n8n workflow for asynchronous parsing with Anesya.

The goal is to:

1. Create a parsing
2. Poll it until completion
3. Use the parsing output in the next step


This pattern works well for users who do not want to write code and need a reliable visual workflow.

## Recommended workflow shape

The safest n8n flow is:

1. `Manual Trigger` or `Webhook`
2. `HTTP Request` - Create parsing
3. `Wait`
4. `HTTP Request` - Retrieve parsing
5. `If` - Parsing final?
6. Loop back to `Wait` if not final
7. `If` - Parsing success or partial success?
8. Next business step


## Option A: Start from a public URL

This is the easiest version in n8n because it uses JSON only.

### Create parsing node

Node type: `HTTP Request`

Recommended settings:

* Method: `POST`
* URL: `https://api.anesya.app/v0/parsing`
* Authentication: none
* Send headers: yes
* Header `X-API-Key`: your API key
* Send body: JSON


Body:


```json
{
  "document": "={{$json.document_url}}",
  "model": "PIGALLE",
  "picture_description_enabled": false,
  "table_verification_enabled": false,
  "metadata": {
    "source": "n8n"
  }
}
```

The previous node must provide `document_url`.

## Option B: Start from a stored document ID

If an earlier step already uploaded the file to Anesya or you already have a document ID, use this payload instead:


```json
{
  "document": "={{$json.document_id}}",
  "model": "PIGALLE"
}
```

This is usually simpler than sending the file content again.

## Option C: Start from a binary file

If n8n already has the document as binary data:

* use `POST https://api.anesya.app/v0/parsing`
* switch the request body to `multipart/form-data`
* add a form-data field named `document`
* map that field to the binary property that contains your file


Add these extra form fields if needed:

* `model`
* `picture_description_enabled`
* `table_verification_enabled`


Use this only when you really need file upload from n8n. For many workflows, using a public URL or a stored document ID is simpler.

## Retrieve parsing node

After the first request, save the returned parsing ID.

Node type: `HTTP Request`

Recommended settings:

* Method: `GET`
* URL: `=https://api.anesya.app/v0/parsing/{{$json.id}}`
* Header `X-API-Key`: your API key


This node returns the current parsing state.

Important fields:

* `status`
* `pages_success`
* `pages_failed`
* `error`


## Parsing status branch

Add an `If` node after `Retrieve parsing`.

Suggested conditions:

* If `status` is `IN_QUEUE` or `IN_PROGRESS`: go back to `Wait`
* If `status` is `FINISHED`: continue to the next step
* If `status` is `PARTIAL_FINISHED`: continue only if partial data is acceptable
* If `status` is `ERROR`: go to an error branch


This branch is important. Do not treat `PARTIAL_FINISHED` as a generic error unless your use case requires all pages.

## A good default wait time

A practical default is a `Wait` node of about 3 seconds between polling attempts.

You can increase it if your workflows are large or if you want fewer polling calls.

## Recommended downstream steps

Once the parsing is finished, common next actions are:

* create an extract
* store the parsing ID for later use
* review markdown or OCR output
* continue with another HTTP call
* branch on parsing quality before extraction


## Common n8n mistakes

These mistakes are common in visual workflows:

* expecting the first `POST` call to return the final result
* polling without a `Wait` node
* not branching on `ERROR`
* ignoring `PARTIAL_FINISHED`
* sending the wrong binary property in multipart mode


## Related tutorials

* [API quickstart](/tutorials/quickstart)
* [Parsing guide](/tutorials/parsing)
* [n8n Workflow: Extract](/tutorials/n8n/n8n-extract)
* [Parsing and extract status handling](/tutorials/quickstart)
* [AI agent integration guide](/tutorials/agent-guide)