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

# Supported JSON Schema Features

> Quick reference for supported, unsupported, and partially supported JSON Schema keywords.

You can use [JSON Schema](https://json-schema.org/) to define the structure of JSON objects returned by the model. We support most features from the JSON Schema [2020-12 specification](https://json-schema.org/draft/2020-12) across all of our products. We follow the specification unless otherwise noted.

<Note>
  The request will fail if you pass a JSON Schema that contains keywords or combinations of keywords that are not supported. The error message will specify the unsupported construct. Don't hesitate to [reach out to us](mailto:contact@dottxt.ai) to request support.
</Note>

## Quick reference

| Keyword                                      | Status | Notes                                                                                                                                                |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`                                       | ✓      | `string`, `number`, `integer`, `boolean`, `null`, `array`, `object`                                                                                  |
| `minLength` / `maxLength`                    | ✓      | Strings; counts characters                                                                                                                           |
| `pattern`                                    | ✓      | Most regex features; see [unsupported patterns](#unsupported-regular-expressions) below                                                              |
| `format`                                     | ✓      | Strictly enforced at generation time. Supports: `email`, `hostname`, `ipv4`, `uri`, `uri-reference`, `uuid`, `date`, `time`, `date-time`, `duration` |
| `enum`                                       | ✓      | Works for any type                                                                                                                                   |
| `const`                                      | ✓      | Works for any type                                                                                                                                   |
| `minimum` / `maximum`                        | ✓      | Numbers and integers                                                                                                                                 |
| `exclusiveMinimum` / `exclusiveMaximum`      | ✓      | Numbers and integers                                                                                                                                 |
| `multipleOf`                                 | ✓      | On integers                                                                                                                                          |
| `items`                                      | ✓      | Homogeneous arrays (see note below)                                                                                                                  |
| `prefixItems`                                | ✓      | Tuple validation (heterogeneous arrays)                                                                                                              |
| `minItems` / `maxItems`                      | ✓      | Array length                                                                                                                                         |
| `required`                                   | ✓      | For object properties                                                                                                                                |
| Optional fields                              | ✓      |                                                                                                                                                      |
| `$defs` + `$ref`                             | ✓      | Internal refs only (no external refs)                                                                                                                |
| Recursive schemas                            | ✓      | Unlimited depth                                                                                                                                      |
| `anyOf`                                      | ✓      | Including at the root                                                                                                                                |
| `allOf`                                      | ✓      |                                                                                                                                                      |
| `oneOf`                                      | ✓      | Treated as `anyOf`                                                                                                                                   |
| `additionalProperties`                       | ✓      | Defaults to `false`                                                                                                                                  |
| `{}`                                         | ✓      | Arbitrary JSON                                                                                                                                       |
| `{"type": "object"}`                         | ✓      | Arbitrary object fields                                                                                                                              |
| `propertyNames`                              | ✓      |                                                                                                                                                      |
| `not`                                        | ✓      |                                                                                                                                                      |
| `if` / `then` / `else`                       | ✓      |                                                                                                                                                      |
| `dependentRequired`                          | ✓      |                                                                                                                                                      |
| `patternProperties`                          | ✓      |                                                                                                                                                      |
| `minProperties` / `maxProperties`            | ✓      |                                                                                                                                                      |
| `contains`                                   | ✓      |                                                                                                                                                      |
| `mincontains` / `maxcontains`                | -      | [Request support](mailto:contact@dottxt.ai)                                                                                                          |
| `uniqueItems`                                | -      | [Request support](mailto:contact@dottxt.ai)                                                                                                          |
| `dependentSchemas`                           | -      | [Request support](mailto:contact@dottxt.ai)                                                                                                          |
| `unevaluatedProperties` / `unevaluatedItems` | -      | [Request support](mailto:contact@dottxt.ai)                                                                                                          |
| `$dynamicRef`                                | -      | [Request support](mailto:contact@dottxt.ai)                                                                                                          |
| `$dynamicAnchor`                             | -      | [Request support](mailto:contact@dottxt.ai)                                                                                                          |

<Note>
  `items` can also be used for tuple validation along with `additionalItems` per the draft 2019-09 specification. We recommend using `prefixItems` for tuple validation and `items` for homogeneous arrays or extra items beyond the `prefixItems` tuple.
</Note>

## Unsupported regular expressions

The `pattern` keyword supports most common regex features. The following are not supported:

* Word boundaries (`\b`)
* Backreferences (`\1`, `(?P=open)`)
* Conditional matches (`(?(1)a|b)`)
* Lookaheads (`foo(?=bar)`)
* Lookbehinds (`(?<=foo)bar`)
* Atomic groups (`(?>pattern)`)
* Recursion (`(?R)`, `(?1)`)
* Named captures (`(?P<name>pattern)`)
* Inline modifiers (`(?i)case-insensitive`)
* Subroutines (`\g<1>`)
* Branch resets (`(?|pattern1|pattern2)`)
* Inline comments (`(?#comment)`)
* Code callouts (`(*MARK:name)`)
* Version checks (`(*VERSION)`)
* Whitespace-insensitive patterns (`(?x)pattern # comment`)

## Next steps

* [Compare provider support](/providers-comparison)
* [Explore JSON Schema patterns](/json-schema/overview)
* [Build a structured-output request](/api/chat-completions)
* [Migrate from other providers](/migrate-from-other-providers)
