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

# Create document types

> Define extraction fields, repeatable groups, models, prompts, and document type versions.

A document type defines the structure and extraction instructions for a category of documents, such as invoices. Weles uses its schema to extract structured data and present fields for verification. Administrators create and manage document types; configure a suitable [OCR provider and model](https://docs.welesai.com/administration/llm-providers.md) first.

## Create a type

1. Open **Document Types** and select **New Document Type**.
2. Enter a recognizable **Name** and **Description**. For example, use `Invoice` for the name and describe the documents to be processed.
3. Choose an **AI Model** from the OCR provider's model list and enter a **System Prompt** explaining the extraction task and how to handle unclear or missing information. Use authorized sample documents when testing.
4. Add fields and groups as described below. Give every field and group a unique, nonempty name.
5. Select **Save Version**. Saving creates a version and activates it; it does not merely save an inactive draft.
6. Configure an **OCR / Extraction** stage to use the intended type and version, or upload by document type where appropriate. Test extraction and verification with a representative document.

Example prompt: `Extract the invoice number, issue date, total, and line items. Do not invent missing values.` Adjust instructions and data handling to your own requirements.

## Fields and groups

Use **Add Field** for an individual value. Choose the field name and one of the available types: `string`, `number`, `date`, or `boolean`. Enable the repeatable option when the field should contain a list of values, such as multiple reference numbers.

Use **Add Group** for a repeating set of related fields, such as invoice line items. Name the group and add its child columns, each with a name and type. For example:

| Item | Type | Example |
| - | - | - |
| `invoice_number` | string | Invoice identifier |
| `issue_date` | date | Date issued |
| `total` | number | Total amount |
| `items` | repeating group | One row per line item, with `description`, `quantity`, and `price` columns |

The builder produces a JSON schema: named top-level fields and groups are included in its `required` list; empty names are omitted. Repeatable fields and groups become arrays. Use unique names: duplicate names can overwrite earlier schema properties. Review results rather than assuming a required field is always successfully extracted.

## Versions and changes

The type list groups versions by name. When editing an existing type, the name is locked and the displayed settings serve as the basis for a **new version**. Selecting **Save Version** creates the next version, deactivates the previous versions of that name, and makes the new one active. Review changes carefully before saving.

A workflow can select a particular type and version; inspect the OCR stage and classification mappings when changing schemas. Earlier documents can remain associated with their original version. Test the new version and update explicit workflow selections as appropriate; do not assume every existing workflow automatically changes to it.

## Verify an example

Create a small invoice schema, save it, select it in an OCR stage, and upload a non-sensitive sample. In **Verify**, compare the extracted values and line-item rows against the original and correct mistakes before approval. Refine the prompt or schema through a new version if the results are incomplete. See [workflow stages](https://docs.welesai.com/workflows/stages.md) and [upload and verification](https://docs.welesai.com/guides/using-weles.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.