> For the complete documentation index, see [llms.txt](https://docs.1kosmos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1kosmos.com/mobile-sdk/native/ios/api-reference/classes/documentscannerviewcontroller.md).

# DocumentScannerViewController

public class DocumentScannerViewController: UIViewController

Class used to start the document scanner and give result back to the application.

### Constructor

public convenience init(docType: DocumentScannerType, dvcId: String? = nil, uid: String? = nil, delegate: DocumentScanDelegate)

| Parameter | Description                                                                                                     |
| --------- | --------------------------------------------------------------------------------------------------------------- |
| docType   | DocumentScannerType Defines the type of document which is to be scanned.                                        |
| dvcId     | String: (Optional) Document verification ID defines the configuration to be used for scanning and verification. |
| uid       | String: (Optional) UID (Unique ID by using it you can filter in AdminX→Verifications).                          |
| delegate  | DocumentScanDelegate The block to execute after the document scanning is completed.                             |

#### Initializing the Scanner View Controller and Retrieving Results in delegate

```
let documentScannerVC = DocumentScannerViewController(docType: docType, delegate: delegate)
self.navigationController?.pushViewController(document, animated: false)
```

***

#### Override the DocumentScanDelegate function in your view controller to get a callback from the scanning result.

```
public protocol DocumentScanDelegate {
  func onDocumentScanResponse(status: Bool,
                document: String?,
                sessionID: String?,
                error: ErrorResponse?)
}
```

***

#### Document Scanning result object

```
{
    "data": {
        "sessionResult": "String", // SUCCESS OR FAILED
        "sessionId": "String", // Session ID
        "document": {
           // Driver License object
           // Passport object
           // IDCard object
        },
        "liveId": {
          // LiveID Object
        },
        "token": "string" // document.proof_jwt
    }
}
```

All documents (Identity and Miscellaneous) must have the following baseline attributes.

| Parameter | Description                                                                                                                          |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| String    | id: It represents the document's ID eg: driver license number.                                                                       |
| String    | category: Currently this SDK supports two categories for documents that can be registered i.e, identity\_document or misc\_document. |
| String    | type: This represents the type of document that the user will try to register eg: dl, ppt, nationalid.                               |
| String    | proofedBy: This identifies the entity responsible for proofing the document.                                                         |

The identity documents must have the following baseline attributes.

| Parameter | Description                                          |
| --------- | ---------------------------------------------------- |
| String    | firstName: First name of document holder.            |
| String    | lastName: Last name of document holder.              |
| String    | dob: Date of birth {yyyyMMdd} of document holder.    |
| String    | doe: Date of expiry {yyyyMMdd} of document.          |
| String    | face: Base64 string of document holder's face photo. |
| String    | image: Base64 string of document image.              |


---

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.1kosmos.com/mobile-sdk/native/ios/api-reference/classes/documentscannerviewcontroller.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
