> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/document-ai/cookbooks/discovering-document-types.md).

# Discovering document types

**Goal.** Fetch the list of document types and accepted file formats programmatically, so your integration does not carry a hardcoded copy that silently goes stale.

New document types are added as configuration rather than as a release. A list you hardcode today will be incomplete at some point, and you will not get an error when it happens — you will get a rejected or badly-routed document.

### Before you start

Nothing. The main endpoint here is the one operation on the API that needs no key.

### Step 1 — List the document types

Use [List supported documents](/document-ai/developer-documentation/utility-1/list-all-supported-document-types-from-yaml-configs.md) for the complete response schema.

```bash
curl -s "https://api-docai-uat.uptiq.ai/listSupportedDocuments"
```

```json
{
  "status": "success",
  "documents": [
    {
      "type": "BalanceSheet",
      "name": "Balance Sheet",
      "category": "Financial Report",
      "description": "Statement of assets, liabilities and equity at a point in time"
    }
  ],
  "taxForms": {
    "Business": [ ],
    "BusinessTaxForms": [ ],
    "IndividualTaxForms": [ ]
  }
}
```

| Field         | Use                                                                    |
| ------------- | ---------------------------------------------------------------------- |
| `type`        | The value you send as `documentType`. **This is the one that matters** |
| `name`        | Human-readable label, for your own UI                                  |
| `category`    | Grouping — useful for building a picker or routing by family           |
| `description` | What the type covers, for disambiguation                               |

{% hint style="warning" %}
`taxForms` is a **separate object**, not part of `documents`, and it is keyed by group (`Business`, `BusinessTaxForms`, `IndividualTaxForms`) rather than being a flat list. Code that reads only `documents` will miss every tax form. Handle both.
{% endhint %}

### Step 2 — Build a lookup

```bash
curl -s "https://api-docai-uat.uptiq.ai/listSupportedDocuments" \
  | jq -r '.documents[] | "\(.category)\t\(.type)\t\(.name)"' \
  | sort > document-types.tsv
```

Or as a validation set:

```python
import json, urllib.request

with urllib.request.urlopen("https://api-docai-uat.uptiq.ai/listSupportedDocuments") as r:
    registry = json.load(r)

valid = {d["type"] for d in registry["documents"]}
for group in registry.get("taxForms", {}).values():
    valid.update(group if isinstance(group, list) else group.keys())

def check(document_type):
    if document_type not in valid:
        raise ValueError(f"{document_type!r} is not a supported document type")
```

Refresh it as part of your build, and fail the build when a type you depend on disappears. That turns a silent runtime misroute into a visible build failure.

### Step 3 — Check accepted file formats

Formats vary **by document type** — a bank statement accepts spreadsheets, an ID document does not. This endpoint **does** require a key, despite sitting in the same group as the public one.

Use [Get supported file types](/document-ai/developer-documentation/utility-1/get-supported-file-types-for-all-document-types.md) for the complete response schema.

```bash
curl -s "https://api-docai-uat.uptiq.ai/document/supported-file-types" \
  -H "X-Api-Key: $DOCAI_API_KEY"
```

```json
{
  "count": 115,
  "data": {
    "BalanceSheet":   ["pdf", "xlsx", "xls", "docx"],
    "BankStatements": ["pdf", "xlsx", "xls", "docx"],
    "AadhaarCard":    ["pdf", "jpg", "jpeg", "png"],
    "ArticlesOfIncorporation": ["pdf", "jpg", "jpeg", "png", "docx"]
  }
}
```

Validate before you spend a call — and before you spend the credit:

```python
formats = supported["data"].get(document_type, [])
if extension.lower().lstrip(".") not in formats:
    raise ValueError(f"{document_type} does not accept .{extension}")
```

### A caveat on counts

{% hint style="warning" %}
Do not hardcode the **number** of document types, and be careful about quoting one. This endpoint reports its own count, and the [Document Types](/document-ai/guides-1/document-types.md) page maintains a categorised list — the two do not currently agree, and they may be counting different things or reflecting different environments.

Read the registry for the set of valid `type` values, which is what your code actually needs. Treat any total as informational.
{% endhint %}

### Why bother

| Hardcoding                               | Reading the registry    |
| ---------------------------------------- | ----------------------- |
| Goes stale silently when types are added | Always current          |
| A typo becomes a runtime misroute        | Caught at build time    |
| Format rules duplicated in your code     | Authoritative, per type |
| New capability needs a code change       | Picked up automatically |

### Related pages

* [Utility API](/document-ai/developer-documentation/integration-guides/utility.md) — both endpoints in full.
* [Document Types](/document-ai/guides-1/document-types.md) — the same registry as a categorised, annotated reference.
* [Classify, then extract](/document-ai/cookbooks/classify-then-extract.md) — for when you cannot determine the type yourself.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/document-ai/cookbooks/discovering-document-types.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
