> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Train

Train a data capture model.

## HTTP request

```http theme={null}
POST https://api-{location-id}.flexicapture.com/v2/training
```

Replace `{location-id}` with your [supported location](/flexi-capture/cloud/cloud-f-cfor-invoices-api#icaas-supported-countries).

## Request body

The request body contains data with the following structure:

```json theme={null}
{
  "task_id": "string",
  "file_id": "string",
  "fields": [
    {
      "name": "string",
      "rectangles": [
        {
          "page_id": 0,
          "x1": 0,
          "y1": 0,
          "x2": 0,
          "y2": 0
        }
      ]
    }
  ]
}
```

### Fields

| Field   | Type                                   | Description                        |
| ------- | -------------------------------------- | ---------------------------------- |
| `model` | body, object(TrainingCommandViewModel) | Required. Model used for training. |

### TrainingCommandViewModel

| Field      | Type                          | Description                           |
| ---------- | ----------------------------- | ------------------------------------- |
| `task_id`  | string                        | Required. Task ID.                    |
| `file_id`  | string                        | Required. File ID.                    |
| `fields[]` | object(FieldCommandViewModel) | Required. Set of fields for training. |

### FieldCommandViewModel

| Field          | Type                       | Description                 |
| -------------- | -------------------------- | --------------------------- |
| `name`         | string                     | Required. Field name.       |
| `rectangles[]` | object(RectangleViewModel) | Required. Field rectangles. |

### RectangleViewModel

| Field     | Type             | Description                 |
| --------- | ---------------- | --------------------------- |
| `page_id` | integer(\$int32) | Required. Internal page ID. |
| `x1`      | integer(\$int32) | Required. Coordinate of x1. |
| `y1`      | integer(\$int32) | Required. Coordinate of y1. |
| `x2`      | integer(\$int32) | Required. Coordinate of x2. |
| `y2`      | integer(\$int32) | Required. Coordinate of y2. |

## Response

If successful, the server returns a `204 No Content` HTTP status.
