---
title: "SchemaGenerationRequest"
canonical_url: "https://www.nutrient.io/api/csharp/requests/schema-generation-request/"
md_url: "https://www.nutrient.io/api/csharp/requests/schema-generation-request.md"
last_updated: "2026-10-08T08:55:57.713Z"
description: "Describes a schema generation request for `GenerateSchema`."
---

Describes a schema generation request for `GenerateSchema`. Carries the document type the schema must represent, an optional free-form requirement, and up to five example documents that ground the schema in real layouts.

The example documents are treated as representative samples of future documents the schema has to fit — not as an exhaustive list. The shape of the generated schema (field budget, nesting, target structured-output dialect) is controlled separately via `SchemaGenerationSettings`.

```csharp

using Nutrient;

```

## Construction

```csharp

public SchemaGenerationRequest()

```

## Properties

### DocumentType

```csharp

public string DocumentType { get; set; }

```

The class of documents the schema must represent (for example, "invoice" or "lab report"). Required; grounds the schema vocabulary.

**Type:** `string`

### Requirement

```csharp

public string Requirement { get; set; }

```

Optional natural-language description of what the schema must capture: fields of interest, granularity, naming preferences, or anything else an extraction engineer would tell a colleague.

**Type:** `string`

## Methods

### AddExampleDocument

```csharp

public void AddExampleDocument(Document document)

```

Adds an example document to the request. Up to five example documents can be added; they act as grounding samples of the documents the generated schema has to represent.

**Parameters**

| Name       | Type                                | Description                                             |
| ---------- | ----------------------------------- | ------------------------------------------------------- |
| `document` | [`Document`](/api/csharp/document/) | An opened document representative of the document type. |

## Resource management

```csharp

public void Dispose()

```

`SchemaGenerationRequest` implements `IDisposable`. Call `Dispose()` or use a C# `using` declaration to release its native handle right away. If you don't, the handle is released when the object is garbage collected.

---

## Related pages

- [Requests](/api/csharp/requests.md)
- [Classification Request](/api/csharp/requests/classification-request.md)
- [Structured Extraction Request](/api/csharp/requests/structured-extraction-request.md)

