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

# Create Evaluation Set Item

> Create a new evaluation set item for a given evaluation set.

Evaluation set items are the individual files and expected outputs that are used to evaluate the performance of a given processor in Extend. This endpoint will create a new evaluation set item in Extend, which will be used during an evaluation run.

## Best Practices for Outputs in Evaluation Sets

1. **Configure First, Output Later**

* Always create and finalize your processor configuration before creating evaluation sets
* Field IDs in outputs must match those defined in your processor configuration

2. **Type Consistency**

* Ensure output types exactly match your processor configuration
* For example, if a field is configured as "currency", don't submit a simple number value

3. **Field IDs**

* Use the exact field IDs from your processor configuration
* Create your own semantic IDs instead in the configs for each field/type instead of using the generated ones

4. **Value**

* Remember that all results are inside the `value` key of a result object, except the values within nested structures.

### Body

<ParamField body="evaluationSetId" type="string" required>
  The ID of the evaluation set to add the item to.
</ParamField>

<ParamField body="fileId" type="string" required>
  The ID of the file to add to the evaluation set.
</ParamField>

<ParamField body="expectedOutput" type="object" required>
  The expected output of the processor when run against the file. This should be
  a JSON object conforming to the [output type
  schema](/api-reference/guides/output_types) of the processor.
</ParamField>

<RequestExample>
  ```bash Extract (JSON Schema) Example theme={null}
  curl --location --request POST 'https://api-prod.extend.app/evaluation_set_items' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <API_TOKEN>' \
  --data '{
    "evaluationSetId": "eval_set_123",
    "fileId": "file_456",
    "expectedOutput": {
      "value": {
        "invoice_number": "36995",
        "total_amount": 15735.1,
        "line_items": [
          {
            "description": "Premium Widget",
            "quantity": 5,
            "unit_price": {
              "amount": 200.00,
              "iso_4217_currency_code": "USD"
            },
            "total": {
              "amount": 1000.00,
              "iso_4217_currency_code": "USD"
            }
          },
          {
            "description": "Basic Widget",
            "quantity": 10,
            "unit_price": {
              "amount": 25.05,
              "iso_4217_currency_code": "USD"
            },
            "total": {
              "amount": 250.50,
              "iso_4217_currency_code": "USD"
            }
          }
        ]
      },
      "metadata": {},
    }
  }'
  ```

  ```bash Extract (Fields Array) Example theme={null}
  curl --location --request POST 'https://api-prod.extend.app/evaluation_set_items' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <API_TOKEN>' \
  --data '{
    "evaluationSetId": "eval_set_123",
    "fileId": "file_456",
    "expectedOutput": {        
      "invoice_number": {
        "id": "field_123",
        "type": "string",
        "value": "INV-2024-001"
      },
      "total_amount": {
        "id": "field_456",
        "type": "currency",
        "value": {
          "amount": 15735.1,
          "iso_4217_currency_code": "USD"
        }
      },
      "line_items": {
        "id": "field_789",
        "type": "array",
        "value": [
          {
            "description": "Premium Widget",
            "quantity": 5,
            "unit_price": {
              "amount": 200.00,
              "iso_4217_currency_code": "USD"
            },
            "total": {
              "amount": 1000.00,
              "iso_4217_currency_code": "USD"
            }
          },
          {
            "description": "Basic Widget",
            "quantity": 10,
            "unit_price": {
              "amount": 25.05,
              "iso_4217_currency_code": "USD"
            },
            "total": {
              "amount": 250.50,
              "iso_4217_currency_code": "USD"
            }
          }
        ]
      }
    }
  }'
  ```

  ```bash Classification Example theme={null}
  curl --location --request POST 'https://api-prod.extend.app/evaluation_set_items' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <API_TOKEN>' \
  --data '{
      "evaluationSetId": "eval_set_123",
      "fileId": "file_456",
      "expectedOutput": {
          "id": "classification_789",
          "type": "INVOICE"
      }
  }'
  ```

  ```bash Splitter Example theme={null}
  curl --location --request POST 'https://api-prod.extend.app/evaluation_set_items' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <API_TOKEN>' \
  --data '{
      "evaluationSetId": "eval_set_123",
      "fileId": "file_456",
      "expectedOutput": {
        "classificationId": "split_789",
        "type": "INVOICE",
        "startPage": 1,
        "endPage": 3
      }
  }'
  ```
</RequestExample>

### Response

<ResponseField name="success" type="boolean">
  A true or false value for whether the evaluation set item was created
  successfully or not.
</ResponseField>

<ResponseField name="evaluationSetItem" type="EvaluationSetItem">
  An EvaluationSetItem object representing the newly created evaluation set
  item. See the [EvaluationSetItem
  object](/api-reference/objects/evaluation_set_item) for more details.
</ResponseField>

<ResponseExample>
  ```json Example Response theme={null}
  {
    "success": true,
    "evaluationSetItem": {
      "object": "evaluation_set_item",
      "id": "eval_item_1234",
      "evaluationSetId": "eval_set_123",
      "fileId": "file_456",
      "expectedOutput": {
        // Output object - see “Processor output types” for details
      },
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  }
  ```
</ResponseExample>
