{"componentChunkName":"component---src-templates-simple-markdown-js","path":"/docs/ai/document-ai/extraction-schemas/","matchPath":"","result":{"data":{"markdownRemark":{"html":"<h1 style=\"position:relative;\"><a href=\"#extraction-schemas\" aria-label=\"extraction schemas permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"extraction-schemas\"></div>Extraction Schemas</h1>\n<p>An extraction schema defines one structured value that Document AI should find and return.</p>\n<p>Use schemas when an integration needs predictable JSON rather than only extracted text or a generated description.</p>\n<h2 style=\"position:relative;\"><a href=\"#anatomy-of-a-schema\" aria-label=\"anatomy of a schema permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"anatomy-of-a-schema\"></div>Anatomy of a schema</h2>\n<div class=\"code-wrapper\">\n        <div class=\"gatsby-code-button-container\"\n             data-toaster-id=\"76285287697525300000\"\n             data-toaster-duration=\"1500\"\n             onClick=\"copyCodeToClipboard(`{\n  &quot;name&quot;: &quot;purchase_order_number&quot;,\n  &quot;prompt&quot;: &quot;Extract the purchase order number. Return null when absent.&quot;,\n  &quot;json_schema&quot;: {\n    &quot;type&quot;: [&quot;string&quot;, &quot;null&quot;]\n  },\n  &quot;scope&quot;: &quot;document&quot;,\n  &quot;result_cardinality&quot;: &quot;single&quot;,\n  &quot;include_source_regions&quot;: true\n}`, `76285287697525300000`)\"\n        >\n          <div class=\"gatsby-code-button\" title=\"Copy the code snippet\">Copy</div>\n          <div class=\"done-indicator done-indicator-76285287697525300000\">Copied</div>\n        </div>\n        <div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"name\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"purchase_order_number\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"prompt\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Extract the purchase order number. Return null when absent.\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"json_schema\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"string\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"null\"</span><span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"scope\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"document\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"result_cardinality\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"single\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"include_source_regions\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n      </div>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Purpose</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code class=\"language-text\">name</code></td>\n<td>Stable key used to identify the result.</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">prompt</code></td>\n<td>Focused instructions describing what to extract.</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">json_schema</code></td>\n<td>JSON Schema defining the expected value.</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">scope</code></td>\n<td>Extract once per <code class=\"language-text\">document</code> or independently per <code class=\"language-text\">segment</code>.</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">result_cardinality</code></td>\n<td>Return a <code class=\"language-text\">single</code> result or <code class=\"language-text\">multiple</code> independent matches.</td>\n</tr>\n<tr>\n<td><code class=\"language-text\">include_source_regions</code></td>\n<td>Include normalized source locations when available.</td>\n</tr>\n</tbody>\n</table>\n<p>See <a href=\"/docs/ai/document-ai/configuration-reference/\">Configuration Reference</a> for defaults and complete field definitions.</p>\n<h2 style=\"position:relative;\"><a href=\"#design-a-stable-result\" aria-label=\"design a stable result permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"design-a-stable-result\"></div>Design a stable result</h2>\n<h3 style=\"position:relative;\"><a href=\"#choose-a-name\" aria-label=\"choose a name permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"choose-a-name\"></div>Choose a name</h3>\n<p>Use stable <code class=\"language-text\">snake_case</code> names such as:</p>\n<ul>\n<li>\n<code class=\"language-text\">purchase_order_number</code>\n</li>\n<li>\n<code class=\"language-text\">invoice_total</code>\n</li>\n<li>\n<code class=\"language-text\">line_items</code>\n</li>\n<li>\n<code class=\"language-text\">delivery_date</code>\n</li>\n</ul>\n<p>Treat the name as part of your integration contract. Renaming a schema changes how consumers locate its result.</p>\n<h3 style=\"position:relative;\"><a href=\"#write-a-focused-prompt\" aria-label=\"write a focused prompt permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"write-a-focused-prompt\"></div>Write a focused prompt</h3>\n<p>A good prompt:</p>\n<ul>\n<li>\nIdentifies exactly one business concept\n</li>\n<li>\nExplains how to distinguish similar values\n</li>\n<li>\nDefines behavior when the value is absent\n</li>\n<li>\nRequests the same shape defined by \n<code class=\"language-text\">json_schema</code>\n</li>\n</ul>\n<div class=\"code-wrapper\">\n        <div class=\"gatsby-code-button-container\"\n             data-toaster-id=\"47679463830443080000\"\n             data-toaster-duration=\"1500\"\n             onClick=\"copyCodeToClipboard(`Extract the bill of lading number from the document header.\nReturn null when no bill of lading number is present.\nDo not return shipment, invoice, or purchase order numbers.`, `47679463830443080000`)\"\n        >\n          <div class=\"gatsby-code-button\" title=\"Copy the code snippet\">Copy</div>\n          <div class=\"done-indicator done-indicator-47679463830443080000\">Copied</div>\n        </div>\n        <div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Extract the bill of lading number from the document header.\nReturn null when no bill of lading number is present.\nDo not return shipment, invoice, or purchase order numbers.</code></pre></div>\n      </div>\n<h3 style=\"position:relative;\"><a href=\"#define-the-json-shape\" aria-label=\"define the json shape permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"define-the-json-shape\"></div>Define the JSON shape</h3>\n<p>Use the narrowest shape that supports your workflow.</p>\n<p>Simple value:</p>\n<div class=\"code-wrapper\">\n        <div class=\"gatsby-code-button-container\"\n             data-toaster-id=\"62761582151568480000\"\n             data-toaster-duration=\"1500\"\n             onClick=\"copyCodeToClipboard(`{\n  &quot;type&quot;: [&quot;string&quot;, &quot;null&quot;]\n}`, `62761582151568480000`)\"\n        >\n          <div class=\"gatsby-code-button\" title=\"Copy the code snippet\">Copy</div>\n          <div class=\"done-indicator done-indicator-62761582151568480000\">Copied</div>\n        </div>\n        <div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"string\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"null\"</span><span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n      </div>\n<p>Object:</p>\n<div class=\"code-wrapper\">\n        <div class=\"gatsby-code-button-container\"\n             data-toaster-id=\"25756509383061287000\"\n             data-toaster-duration=\"1500\"\n             onClick=\"copyCodeToClipboard(`{\n  &quot;type&quot;: [&quot;object&quot;, &quot;null&quot;],\n  &quot;properties&quot;: {\n    &quot;amount&quot;: {&quot;type&quot;: &quot;number&quot;},\n    &quot;currency&quot;: {&quot;type&quot;: &quot;string&quot;}\n  },\n  &quot;required&quot;: [&quot;amount&quot;, &quot;currency&quot;],\n  &quot;additionalProperties&quot;: false\n}`, `25756509383061287000`)\"\n        >\n          <div class=\"gatsby-code-button\" title=\"Copy the code snippet\">Copy</div>\n          <div class=\"done-indicator done-indicator-25756509383061287000\">Copied</div>\n        </div>\n        <div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"object\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"null\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"properties\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"amount\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"number\"</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"currency\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"string\"</span><span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"required\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"amount\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"currency\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"additionalProperties\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n      </div>\n<p>Array:</p>\n<div class=\"code-wrapper\">\n        <div class=\"gatsby-code-button-container\"\n             data-toaster-id=\"52175764964567480000\"\n             data-toaster-duration=\"1500\"\n             onClick=\"copyCodeToClipboard(`{\n  &quot;type&quot;: &quot;array&quot;,\n  &quot;items&quot;: {\n    &quot;type&quot;: &quot;object&quot;,\n    &quot;properties&quot;: {\n      &quot;description&quot;: {&quot;type&quot;: &quot;string&quot;},\n      &quot;quantity&quot;: {&quot;type&quot;: [&quot;number&quot;, &quot;null&quot;]},\n      &quot;unit_price&quot;: {&quot;type&quot;: [&quot;number&quot;, &quot;null&quot;]}\n    },\n    &quot;required&quot;: [&quot;description&quot;],\n    &quot;additionalProperties&quot;: false\n  }\n}`, `52175764964567480000`)\"\n        >\n          <div class=\"gatsby-code-button\" title=\"Copy the code snippet\">Copy</div>\n          <div class=\"done-indicator done-indicator-52175764964567480000\">Copied</div>\n        </div>\n        <div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"array\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"items\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"object\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"properties\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"description\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"string\"</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"quantity\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"number\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"null\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"unit_price\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span><span class=\"token property\">\"type\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"number\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"null\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">}</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"required\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span><span class=\"token string\">\"description\"</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"additionalProperties\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">false</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n      </div>\n<h2 style=\"position:relative;\"><a href=\"#scope-and-cardinality\" aria-label=\"scope and cardinality permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"scope-and-cardinality\"></div>Scope and cardinality</h2>\n<p>Use <code class=\"language-text\">scope: \"document\"</code> for a value resolved once from the entire logical document, such as a document number, total, or primary party.</p>\n<p>Use <code class=\"language-text\">scope: \"segment\"</code> when each independently processed segment can produce its own result.</p>\n<p>Use <code class=\"language-text\">result_cardinality: \"single\"</code> when one answer is expected for the selected scope.</p>\n<p>Use <code class=\"language-text\">result_cardinality: \"multiple\"</code> when several independent matches are expected. This differs from an array-valued schema: a single <code class=\"language-text\">line_items</code> result can contain an array while its result cardinality remains <code class=\"language-text\">single</code>.</p>\n<h2 style=\"position:relative;\"><a href=\"#source-regions\" aria-label=\"source regions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"source-regions\"></div>Source regions</h2>\n<p>Enable <code class=\"language-text\">include_source_regions</code> when reviewers should trace a value to a PDF or image.</p>\n<div class=\"code-wrapper\">\n        <div class=\"gatsby-code-button-container\"\n             data-toaster-id=\"27603179348130080000\"\n             data-toaster-duration=\"1500\"\n             onClick=\"copyCodeToClipboard(`{\n  &quot;left&quot;: 0.12,\n  &quot;top&quot;: 0.41,\n  &quot;width&quot;: 0.28,\n  &quot;height&quot;: 0.04\n}`, `27603179348130080000`)\"\n        >\n          <div class=\"gatsby-code-button\" title=\"Copy the code snippet\">Copy</div>\n          <div class=\"done-indicator done-indicator-27603179348130080000\">Copied</div>\n        </div>\n        <div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"left\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.12</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"top\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.41</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"width\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.28</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"height\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.04</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n      </div>\n<p>Coordinates are normalized from <code class=\"language-text\">0</code> to <code class=\"language-text\">1</code>, with the origin at the top-left. Text and spreadsheet formats can return <code class=\"language-text\">source_regions: null</code>.</p>\n<h2 style=\"position:relative;\"><a href=\"#generate-a-schema-starting-point\" aria-label=\"generate a schema starting point permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"generate-a-schema-starting-point\"></div>Generate a schema starting point</h2>\n<p>Use the schema helper to create a draft JSON Schema from a natural-language request:</p>\n<p>Send a <code class=\"language-text\">name</code> and <code class=\"language-text\">prompt</code> to <code class=\"language-text\">POST /document-store/pipeline/schemas/generate</code>.</p>\n<p>The response contains <code class=\"language-text\">json_schema</code> and an explanatory <code class=\"language-text\">rationale</code>. Review and refine the generated schema before saving it.</p>\n<h2 style=\"position:relative;\"><a href=\"#test-before-production\" aria-label=\"test before production permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><div class=\"hidden-anchor\" id=\"test-before-production\"></div>Test before production</h2>\n<ol>\n<li>\nTest representative layouts from every expected source.\n</li>\n<li>\nTest absent, malformed, ambiguous, and repeated values.\n</li>\n<li>\nValidate each returned \n<code class=\"language-text\">value</code>\n against your expected JSON Schema.\n</li>\n<li>\nReview source regions when enabled.\n</li>\n<li>\nTest the configuration against documents it should reject or leave empty.\n</li>\n<li>\nVersion consuming integrations before renaming or reshaping schemas.\n</li>\n</ol>\n<p>Use <a href=\"/docs/ai/document-ai/custom-configurations/\">Custom Configurations</a> to save reusable schemas or include them in a one-time <code class=\"language-text\">pipeline_config</code>.</p>","headings":[{"value":"Extraction Schemas","depth":1},{"value":"Anatomy of a schema","depth":2},{"value":"Design a stable result","depth":2},{"value":"Choose a name","depth":3},{"value":"Write a focused prompt","depth":3},{"value":"Define the JSON shape","depth":3},{"value":"Scope and cardinality","depth":2},{"value":"Source regions","depth":2},{"value":"Generate a schema starting point","depth":2},{"value":"Test before production","depth":2}]},"contentItem":{"data":{"lastModified":"2026-07-17T16:00:10.000Z","enableToc":null,"disableLastModified":null,"tocMaxDepth":null,"requestLogin":false}},"siteConfig":{"enableToc":true,"disableLastModified":false,"tocMaxDepth":4}},"pageContext":{"matchPath":"","id":"b0821da9-88f9-589b-8993-8e058df46700__redocly content/docs/ai/document-ai/extraction-schemas/","seo":{"title":"Extraction Schemas","description":null,"image":"","keywords":null,"jsonLd":null,"lang":null,"siteUrl":null},"pageId":"docs/ai/document-ai/extraction-schemas.md","pageBaseUrl":"/docs/ai/document-ai/extraction-schemas","type":"markdown","toc":{"enable":true,"maxDepth":4,"headings":[{"depth":1,"value":"Extraction Schemas","id":"extraction-schemas"},{"depth":2,"value":"Anatomy of a schema","id":"anatomy-of-a-schema"},{"depth":2,"value":"Design a stable result","id":"design-a-stable-result"},{"depth":3,"value":"Choose a name","id":"choose-a-name"},{"depth":3,"value":"Write a focused prompt","id":"write-a-focused-prompt"},{"depth":3,"value":"Define the JSON shape","id":"define-the-json-shape"},{"depth":2,"value":"Scope and cardinality","id":"scope-and-cardinality"},{"depth":2,"value":"Source regions","id":"source-regions"},{"depth":2,"value":"Generate a schema starting point","id":"generate-a-schema-starting-point"},{"depth":2,"value":"Test before production","id":"test-before-production"}]},"data":{"title":"Extraction Schemas"},"catalogInfo":null,"link":"/docs/ai/document-ai/extraction-schemas/","sidebarName":"developerPortal","isLanding":false,"showPrevButton":null,"showNextButton":null,"apiVersions":null,"apiVersionId":null,"isDefaultApiVersion":null}},"staticQueryHashes":["1123603147","1302185487","1344209882","1398840060","1520077861","1975142765","2667623876","2950305614","3240152602","3743992808","561138138"]}