{"id":"9f592174-69e0-4ee3-b11d-9a082576a15b","shortId":"89vAQC","kind":"skill","title":"azure-ai-document-intelligence-ts","tagline":"Extract text, tables, and structured data from documents using prebuilt and custom models.","description":"# Azure Document Intelligence REST SDK for TypeScript\n\nExtract text, tables, and structured data from documents using prebuilt and custom models.\n\n## Installation\n\n```bash\nnpm install @azure-rest/ai-document-intelligence @azure/identity\n```\n\n## Environment Variables\n\n```bash\nDOCUMENT_INTELLIGENCE_ENDPOINT=https://<resource>.cognitiveservices.azure.com\nDOCUMENT_INTELLIGENCE_API_KEY=<api-key>\n```\n\n## Authentication\n\n**Important**: This is a REST client. `DocumentIntelligence` is a **function**, not a class.\n\n### DefaultAzureCredential\n\n```typescript\nimport DocumentIntelligence from \"@azure-rest/ai-document-intelligence\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\n\nconst client = DocumentIntelligence(\n  process.env.DOCUMENT_INTELLIGENCE_ENDPOINT!,\n  new DefaultAzureCredential()\n);\n```\n\n### API Key\n\n```typescript\nimport DocumentIntelligence from \"@azure-rest/ai-document-intelligence\";\n\nconst client = DocumentIntelligence(\n  process.env.DOCUMENT_INTELLIGENCE_ENDPOINT!,\n  { key: process.env.DOCUMENT_INTELLIGENCE_API_KEY! }\n);\n```\n\n## Analyze Document (URL)\n\n```typescript\nimport DocumentIntelligence, {\n  isUnexpected,\n  getLongRunningPoller,\n  AnalyzeOperationOutput\n} from \"@azure-rest/ai-document-intelligence\";\n\nconst initialResponse = await client\n  .path(\"/documentModels/{modelId}:analyze\", \"prebuilt-layout\")\n  .post({\n    contentType: \"application/json\",\n    body: {\n      urlSource: \"https://example.com/document.pdf\"\n    },\n    queryParameters: { locale: \"en-US\" }\n  });\n\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = (await poller.pollUntilDone()).body as AnalyzeOperationOutput;\n\nconsole.log(\"Pages:\", result.analyzeResult?.pages?.length);\nconsole.log(\"Tables:\", result.analyzeResult?.tables?.length);\n```\n\n## Analyze Document (Local File)\n\n```typescript\nimport { readFile } from \"node:fs/promises\";\n\nconst fileBuffer = await readFile(\"./document.pdf\");\nconst base64Source = fileBuffer.toString(\"base64\");\n\nconst initialResponse = await client\n  .path(\"/documentModels/{modelId}:analyze\", \"prebuilt-invoice\")\n  .post({\n    contentType: \"application/json\",\n    body: { base64Source }\n  });\n\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = (await poller.pollUntilDone()).body as AnalyzeOperationOutput;\n```\n\n## Prebuilt Models\n\n| Model ID | Description |\n|----------|-------------|\n| `prebuilt-read` | OCR - text and language extraction |\n| `prebuilt-layout` | Text, tables, selection marks, structure |\n| `prebuilt-invoice` | Invoice fields |\n| `prebuilt-receipt` | Receipt fields |\n| `prebuilt-idDocument` | ID document fields |\n| `prebuilt-tax.us.w2` | W-2 tax form fields |\n| `prebuilt-healthInsuranceCard.us` | Health insurance card fields |\n| `prebuilt-contract` | Contract fields |\n| `prebuilt-bankStatement.us` | Bank statement fields |\n\n## Extract Invoice Fields\n\n```typescript\nconst initialResponse = await client\n  .path(\"/documentModels/{modelId}:analyze\", \"prebuilt-invoice\")\n  .post({\n    contentType: \"application/json\",\n    body: { urlSource: invoiceUrl }\n  });\n\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = (await poller.pollUntilDone()).body as AnalyzeOperationOutput;\n\nconst invoice = result.analyzeResult?.documents?.[0];\nif (invoice) {\n  console.log(\"Vendor:\", invoice.fields?.VendorName?.content);\n  console.log(\"Total:\", invoice.fields?.InvoiceTotal?.content);\n  console.log(\"Due Date:\", invoice.fields?.DueDate?.content);\n}\n```\n\n## Extract Receipt Fields\n\n```typescript\nconst initialResponse = await client\n  .path(\"/documentModels/{modelId}:analyze\", \"prebuilt-receipt\")\n  .post({\n    contentType: \"application/json\",\n    body: { urlSource: receiptUrl }\n  });\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = (await poller.pollUntilDone()).body as AnalyzeOperationOutput;\n\nconst receipt = result.analyzeResult?.documents?.[0];\nif (receipt) {\n  console.log(\"Merchant:\", receipt.fields?.MerchantName?.content);\n  console.log(\"Total:\", receipt.fields?.Total?.content);\n  \n  for (const item of receipt.fields?.Items?.values || []) {\n    console.log(\"Item:\", item.properties?.Description?.content);\n    console.log(\"Price:\", item.properties?.TotalPrice?.content);\n  }\n}\n```\n\n## List Document Models\n\n```typescript\nimport DocumentIntelligence, { isUnexpected, paginate } from \"@azure-rest/ai-document-intelligence\";\n\nconst response = await client.path(\"/documentModels\").get();\n\nif (isUnexpected(response)) {\n  throw response.body.error;\n}\n\nfor await (const model of paginate(client, response)) {\n  console.log(model.modelId);\n}\n```\n\n## Build Custom Model\n\n```typescript\nconst initialResponse = await client.path(\"/documentModels:build\").post({\n  body: {\n    modelId: \"my-custom-model\",\n    description: \"Custom model for purchase orders\",\n    buildMode: \"template\",  // or \"neural\"\n    azureBlobSource: {\n      containerUrl: process.env.TRAINING_CONTAINER_SAS_URL!,\n      prefix: \"training-data/\"\n    }\n  }\n});\n\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = await poller.pollUntilDone();\nconsole.log(\"Model built:\", result.body);\n```\n\n## Build Document Classifier\n\n```typescript\nimport { DocumentClassifierBuildOperationDetailsOutput } from \"@azure-rest/ai-document-intelligence\";\n\nconst containerSasUrl = process.env.TRAINING_CONTAINER_SAS_URL!;\n\nconst initialResponse = await client.path(\"/documentClassifiers:build\").post({\n  body: {\n    classifierId: \"my-classifier\",\n    description: \"Invoice vs Receipt classifier\",\n    docTypes: {\n      invoices: {\n        azureBlobSource: { containerUrl: containerSasUrl, prefix: \"invoices/\" }\n      },\n      receipts: {\n        azureBlobSource: { containerUrl: containerSasUrl, prefix: \"receipts/\" }\n      }\n    }\n  }\n});\n\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = (await poller.pollUntilDone()).body as DocumentClassifierBuildOperationDetailsOutput;\nconsole.log(\"Classifier:\", result.result?.classifierId);\n```\n\n## Classify Document\n\n```typescript\nconst initialResponse = await client\n  .path(\"/documentClassifiers/{classifierId}:analyze\", \"my-classifier\")\n  .post({\n    contentType: \"application/json\",\n    body: { urlSource: documentUrl },\n    queryParameters: { split: \"auto\" }\n  });\n\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\nconst poller = getLongRunningPoller(client, initialResponse);\nconst result = await poller.pollUntilDone();\nconsole.log(\"Classification:\", result.body.analyzeResult?.documents);\n```\n\n## Get Service Info\n\n```typescript\nconst response = await client.path(\"/info\").get();\n\nif (isUnexpected(response)) {\n  throw response.body.error;\n}\n\nconsole.log(\"Custom model limit:\", response.body.customDocumentModels.limit);\nconsole.log(\"Custom model count:\", response.body.customDocumentModels.count);\n```\n\n## Polling Pattern\n\n```typescript\nimport DocumentIntelligence, {\n  isUnexpected,\n  getLongRunningPoller,\n  AnalyzeOperationOutput\n} from \"@azure-rest/ai-document-intelligence\";\n\n// 1. Start operation\nconst initialResponse = await client\n  .path(\"/documentModels/{modelId}:analyze\", \"prebuilt-layout\")\n  .post({ contentType: \"application/json\", body: { urlSource } });\n\n// 2. Check for errors\nif (isUnexpected(initialResponse)) {\n  throw initialResponse.body.error;\n}\n\n// 3. Create poller\nconst poller = getLongRunningPoller(client, initialResponse);\n\n// 4. Optional: Monitor progress\npoller.onProgress((state) => {\n  console.log(\"Status:\", state.status);\n});\n\n// 5. Wait for completion\nconst result = (await poller.pollUntilDone()).body as AnalyzeOperationOutput;\n```\n\n## Key Types\n\n```typescript\nimport DocumentIntelligence, {\n  isUnexpected,\n  getLongRunningPoller,\n  paginate,\n  parseResultIdFromResponse,\n  AnalyzeOperationOutput,\n  DocumentClassifierBuildOperationDetailsOutput\n} from \"@azure-rest/ai-document-intelligence\";\n```\n\n## Best Practices\n\n1. **Use getLongRunningPoller()** - Document analysis is async, always poll for results\n2. **Check isUnexpected()** - Type guard for proper error handling\n3. **Choose the right model** - Use prebuilt models when possible, custom for specialized docs\n4. **Handle confidence scores** - Fields have confidence values, set thresholds for your use case\n5. **Use pagination** - Use `paginate()` helper for listing models\n6. **Prefer neural mode** - For custom models, neural handles more variation than template\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["azure","document","intelligence","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding"],"capabilities":["skill","source-sickn33","skill-azure-ai-document-intelligence-ts","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-ai-document-intelligence-ts","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34964 github stars · SKILL.md body (9,204 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-25T00:50:30.978Z","embedding":null,"createdAt":"2026-04-18T21:31:54.816Z","updatedAt":"2026-04-25T00:50:30.978Z","lastSeenAt":"2026-04-25T00:50:30.978Z","tsv":"'-2':273 '/ai-document-intelligence':47,82,104,129,431,518,654,726 '/document.pdf':148,195 '/documentclassifiers':529,584 '/documentmodels':135,205,300,361,436,461,663 '/info':625 '0':333,389 '1':655,729 '2':674,740 '3':683,749 '4':691,763 '5':700,777 '6':786 'action':811 'ai':3 'alway':736 'analysi':733 'analyz':116,137,181,207,302,363,586,665 'analyzeoperationoutput':124,170,232,328,384,649,710,720 'api':58,95,114 'applic':805 'application/json':143,213,308,369,592,671 'ask':849 'async':735 'authent':60 'auto':598 'await':132,166,193,202,228,297,324,358,380,434,444,459,502,527,567,581,611,623,660,706 'azur':2,20,45,80,102,127,429,516,652,724 'azure-ai-document-intelligence-t':1 'azure-rest':44,79,101,126,428,515,651,723 'azure/identity':48,86 'azureblobsourc':480,544,550 'bank':288 'base64':199 'base64source':197,215 'bash':41,51 'best':727 'bodi':144,168,214,230,309,326,370,382,464,532,569,593,672,708 'boundari':857 'build':453,462,508,530 'buildmod':476 'built':506 'card':280 'case':776 'check':675,741 'choos':750 'clarif':851 'class':73 'classif':614 'classifi':510,536,541,573,576,589 'classifierid':533,575,585 'clear':824 'client':66,88,106,133,162,203,224,298,320,359,376,449,498,563,582,607,661,689 'client.path':435,460,528,624 'cognitiveservices.azure.com':55 'complet':703 'confid':765,769 'console.log':171,176,336,341,346,392,397,409,414,451,504,572,613,632,637,697 'const':87,105,130,159,164,191,196,200,221,226,295,317,322,329,356,373,378,385,403,432,445,457,495,500,519,525,560,565,579,604,609,621,658,686,704 'contain':483,522 'containersasurl':520,546,552 'containerurl':481,545,551 'content':340,345,351,396,401,413,418 'contenttyp':142,212,307,368,591,670 'contract':284,285 'count':640 'creat':684 'criteria':860 'custom':18,38,454,468,471,633,638,759,791 'data':12,32,489 'date':348 'defaultazurecredenti':74,84,94 'describ':812,828 'descript':237,412,470,537 'doc':762 'doctyp':542 'document':4,14,21,34,52,56,117,182,268,332,388,420,509,577,616,732 'documentclassifierbuildoperationdetailsoutput':513,571,721 'documentintellig':67,77,89,99,107,121,424,646,715 'documenturl':595 'due':347 'duedat':350 'en':152 'en-us':151 'endpoint':54,92,110 'environ':49,840 'environment-specif':839 'error':677,747 'example.com':147 'example.com/document.pdf':146 'execut':807 'expert':845 'extract':7,27,245,291,352 'field':258,263,269,276,281,286,290,293,354,767 'file':184 'filebuff':192 'filebuffer.tostring':198 'form':275 'fs/promises':190 'function':70 'get':437,617,626 'getlongrunningpol':123,161,223,319,375,497,562,606,648,688,717,731 'guard':744 'handl':748,764,794 'health':278 'helper':782 'id':236,267 'iddocu':266 'import':61,76,83,98,120,186,423,512,645,714 'info':619 'initialrespons':131,156,163,201,218,225,296,314,321,357,377,458,492,499,526,557,564,580,601,608,659,680,690 'initialresponse.body.error':158,220,316,494,559,603,682 'input':854 'instal':40,43 'insur':279 'intellig':5,22,53,57,91,109,113 'invoic':210,256,257,292,305,330,335,538,543,548 'invoice.fields':338,343,349 'invoicetot':344 'invoiceurl':311 'isunexpect':122,155,217,313,425,439,491,556,600,628,647,679,716,742 'item':404,407,410 'item.properties':411,416 'key':59,96,111,115,711 'languag':244 'layout':140,248,668 'length':175,180 'limit':635,816 'list':419,784 'local':150,183 'mark':252 'match':825 'merchant':393 'merchantnam':395 'miss':862 'mode':789 'model':19,39,234,235,421,446,455,469,472,505,634,639,753,756,785,792 'model.modelid':452 'modelid':136,206,301,362,465,664 'monitor':693 'my-classifi':534,587 'my-custom-model':466 'neural':479,788,793 'new':93 'node':189 'npm':42 'ocr':241 'oper':657 'option':692 'order':475 'output':834 'overview':815 'page':172,174 'pagin':426,448,718,779,781 'parseresultidfromrespons':719 'path':134,204,299,360,583,662 'pattern':643 'permiss':855 'poll':642,737 'poller':160,222,318,374,496,561,605,685,687 'poller.onprogress':695 'poller.polluntildone':167,229,325,381,503,568,612,707 'possibl':758 'post':141,211,306,367,463,531,590,669 'practic':728 'prebuilt':16,36,139,209,233,239,247,255,260,265,283,304,365,667,755 'prebuilt-bankstatement.us':287 'prebuilt-contract':282 'prebuilt-healthinsurancecard.us':277 'prebuilt-iddocu':264 'prebuilt-invoic':208,254,303 'prebuilt-layout':138,246,666 'prebuilt-read':238 'prebuilt-receipt':259,364 'prebuilt-tax.us':270 'prefer':787 'prefix':486,547,553 'price':415 'process.env.document':90,108,112 'process.env.training':482,521 'progress':694 'proper':746 'purchas':474 'queryparamet':149,596 'read':240 'readfil':187,194 'receipt':261,262,353,366,386,391,540,549,554 'receipt.fields':394,399,406 'receipturl':372 'requir':853 'respons':433,440,450,622,629 'response.body.customdocumentmodels.count':641 'response.body.customdocumentmodels.limit':636 'response.body.error':442,631 'rest':23,46,65,81,103,128,430,517,653,725 'result':165,227,323,379,501,566,610,705,739 'result.analyzeresult':173,178,331,387 'result.body':507 'result.body.analyzeresult':615 'result.result':574 'review':846 'right':752 'safeti':856 'sas':484,523 'scope':827 'score':766 'sdk':24 'select':251 'servic':618 'set':771 'skill':803,819 'skill-azure-ai-document-intelligence-ts' 'source-sickn33' 'special':761 'specif':841 'split':597 'start':656 'state':696 'state.status':699 'statement':289 'status':698 'stop':847 'structur':11,31,253 'substitut':837 'success':859 'tabl':9,29,177,179,250 'task':823 'tax':274 'templat':477,798 'test':843 'text':8,28,242,249 'threshold':772 'throw':157,219,315,441,493,558,602,630,681 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'total':342,398,400 'totalpric':417 'train':488 'training-data':487 'treat':832 'ts':6 'type':712,743 'typescript':26,75,97,119,185,294,355,422,456,511,578,620,644,713 'url':118,485,524 'urlsourc':145,310,371,594,673 'us':153 'use':15,35,730,754,775,778,780,801,817 'valid':842 'valu':408,770 'variabl':50 'variat':796 'vendor':337 'vendornam':339 'vs':539 'w':272 'w2':271 'wait':701 'workflow':809","prices":[{"id":"6fbf75e2-e22f-4bda-836b-a6fbd935d1e7","listingId":"9f592174-69e0-4ee3-b11d-9a082576a15b","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:31:54.816Z"}],"sources":[{"listingId":"9f592174-69e0-4ee3-b11d-9a082576a15b","source":"github","sourceId":"sickn33/antigravity-awesome-skills/azure-ai-document-intelligence-ts","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-ai-document-intelligence-ts","isPrimary":false,"firstSeenAt":"2026-04-18T21:31:54.816Z","lastSeenAt":"2026-04-25T00:50:30.978Z"}],"details":{"listingId":"9f592174-69e0-4ee3-b11d-9a082576a15b","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"azure-ai-document-intelligence-ts","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34964,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-24T06:41:17Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"71d632dde21a4c4b4fca4d10e280659f32dad889","skill_md_path":"skills/azure-ai-document-intelligence-ts/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/azure-ai-document-intelligence-ts"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"azure-ai-document-intelligence-ts","description":"Extract text, tables, and structured data from documents using prebuilt and custom models."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/azure-ai-document-intelligence-ts"},"updatedAt":"2026-04-25T00:50:30.978Z"}}