Get Started

# n8n Workflow: Extract

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

The goal is to:

1. Start from a completed parsing
2. Create an extract
3. Poll it until completion
4. Use the final structured result


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 extract
3. `Wait`
4. `HTTP Request` - Retrieve extract
5. `If` - Extract final?
6. Loop back to `Wait` if not final
7. `If` - Extract success?
8. Next business step


## Before you start

The recommended input for extraction in n8n is a parsing ID that is already in a final state:

* `FINISHED`
* `PARTIAL_FINISHED`


If you do not have a parsing yet, create one first with [n8n Workflow: Parsing](/tutorials/n8n/n8n-parsing).

## Create extract node

Once the parsing is ready, call the extract endpoint with the parsing ID and your schema ID.

Node type: `HTTP Request`

Recommended settings:

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


Body:


```json
{
  "parsing": "={{$json.parsing_id}}",
  "schema": "YOUR_SCHEMA_ID"
}
```

If your flow carries the schema dynamically, replace `YOUR_SCHEMA_ID` with an n8n expression.

## Retrieve extract node

After the extract is created, save the returned extract ID and poll it with:

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


Important fields:

* `status`
* `result`
* `error`


## Extract status branch

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

Suggested conditions:

* If `status` is `IN_QUEUE` or `IN_PROGRESS`: go back to `Wait`
* If `status` is `FINISHED`: continue to the next business step
* If `status` is `ERROR`: go to an error branch


When the status is `FINISHED`, the structured output is available in `result`.

## 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 extract is finished, common next actions are:

* write `result` to Google Sheets
* send `result` to Slack or email
* insert `result` into a database
* continue with another HTTP call
* archive the original input with the returned IDs


## 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`
* trying to create an extract from a parsing that is not finished yet
* using a schema ID that does not match the expected output


## When to use a simpler one-call flow

If you only want one final extract and you do not need parsing output, you can call [Create extract](/api/schema/extracts/extract_create) directly with:

* one document ID
* one public URL
* one uploaded file


That shortcut is explained in [Extract](/tutorials/extract).

## Related tutorials

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