> For the complete documentation index, see [llms.txt](https://docs.mindee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindee.com/v1/integration/dotnet-ocr-sdk/dotnet-generated-ocr.md).

# Generated API

## Generated OCR API

The .NET OCR SDK supports generated APIs.\
Generated APIs can theoretically support all APIs in a catch-all generic format.

## Quick-Start

```csharp
using Mindee;
using Mindee.Input;
using Mindee.Http;
using Mindee.Product.Generated;

string apiKey = "my-api-key";
string filePath = "/path/to/the/file.ext";

// Construct a new client
MindeeClient mindeeClient = new MindeeClient(apiKey);

// Load an input source as a path string
// Other input types can be used, as mentioned in the docs
var inputSource = new LocalInputSource(filePath);

// Set the endpoint configuration
CustomEndpoint endpoint = new CustomEndpoint(
    endpointName: "my-endpoint",
    accountName: "my-account",
    version: "my-version"
);

// Call the product asynchronously with auto-polling
var response = await mindeeClient
    .EnqueueAndParseAsync<GeneratedV1>(inputSource, endpoint);

// Print a summary of all the predictions
System.Console.WriteLine(response.Document.ToString());

// Print only the document-level predictions
// System.Console.WriteLine(response.Document.Inference.Prediction.ToString());
```

## Generated Endpoints

As shown above, you will need to provide an account and an endpoint name at the very least.

Although it is optional, the version number should match the latest version of your build in most use-cases.\
If it is not set, it will default to "1".

## Field Types

### Generated Fields

By default, GeneratedV1 implements only one attribute:

* **Fields** (`Dictionary<string,` [GeneratedFeature](#generated-feature)`>`): Contains a dictionary of all features contained in a prediction.

#### Generated Feature

A `GeneratedFeature` is a special type of custom list that extends `ArrayList<`[GeneratedObject](#generated-object-field)`>` and implements the following:

* **AsStringField()** (`StringField`): the value of the field as a `StringField`.
* **AsAmountField()** (`AmountField`): the value of the field as an `AmountField`.
* **AsDecimalField()** (`AmountField`): the value of the field as a `DecimalField`.
* **AsDateField()** (`DateField`): the value of the field as a `DateField`.
* **AsClassificationField()** (`ClassificationField`): the value of the field as a `ClassificationField`.

#### Generated Object Field

By default, non-list objects will be stored in a `GeneratedObject` structure, which are an extension of simple hashmaps. These fields have access to the following:

* **IsList** (`bool`): Whether the field is a list-like object or not.
* **AsStringField()** (`StringField`): the value of the field as a `StringField`.
* **AsAmountField()** (`AmountField`): the value of the field as an `AmountField`.
* **AsDecimalField()** (`AmountField`): the value of the field as a `DecimalField`.
* **AsDateField()** (`DateField`): the value of the field as a `DateField`.
* **AsClassificationField()** (`ClassificationField`): the value of the field as a `ClassificationField`.
* **Polygon()** (`Polygon`): representation of the field as a `Polygon`.
* **PageId()** (`integer`): retrieves the ID of the page the field was found on. Note: this isn't supported on some APIs.
* **Confidence()** (`float`): retrieves the confidence score for a field, if it exists.

> Note: the `AsXXXXField()` methods mentioned above will return `null` if a value isn't found.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mindee.com/v1/integration/dotnet-ocr-sdk/dotnet-generated-ocr.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
