Every yes:id SDK module needs a valid session before it can run. Complete the Sessions Guide first — it takes 5 minutes and is required before the code below will work.
Installing the Document Capture SDK
@yesid/document-scanner is the browser SDK for guided ID capture and OCR. It ships as a web component (<yesid-document-capture>) and a React wrapper (DocumentCapture).
Current version in the yes:id web demo: 1.6.1.
1. Configure the yes:id npm registry
The @yesid packages are published to a private registry. Add this to your project .npmrc before installing:
registry=https://registry.npmjs.org/
@yesid:registry=https://npm.yesid.tech/
@identityd:registry=https://npm.yesid.tech/
//npm.yesid.tech/:_authToken=${NPM_TOKEN}
Set NPM_TOKEN in your environment. Do not commit a real token.
2. Install the package
npm install @yesid/document-scanner
Peer dependencies (react / react-dom) are optional. Install them only if you use the React wrapper.
3. Import the SDK
Web component
import { defineYesIdDocumentCapture } from '@yesid/document-scanner';
defineYesIdDocumentCapture();
React
import { DocumentCapture } from '@yesid/document-scanner/react';
Only these entry points are supported: @yesid/document-scanner and @yesid/document-scanner/react. Do not import from dist/*.
4. CDN (no bundler)
If you are not using npm, load the component from the yes:id CDN:
<script type="module">
import { defineYesIdDocumentCapture } from 'https://js.yesid.tech/document-capture/1.6.1/component.js';
defineYesIdDocumentCapture();
</script>
5. Requirements
| Requirement | Value |
|---|---|
| Node.js (npm installs) | 16+ |
| Secure context | HTTPS (or localhost) — required for camera access |
| Browsers | Chrome, Safari, Firefox, Opera |
| Camera | 5 MP or higher recommended for OCR |
Pass only the publishable key (pk_…) and a backend-created session ID to the browser. Never ship YESID_API_KEY / sk_… in frontend code or HTML.
The package is installed. Next: Usage →