> For the complete documentation index, see [llms.txt](https://docs.mindee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindee.com/v1/integration/python-sdk/global-products/python-driver-license-ocr.md). Agents can also search and read this documentation through its [MCP server](https://docs.mindee.com/~gitbook/mcp).

# Driver License

The Python SDK supports the Mindee V1 [Driver License API](https://platform.mindee.com/mindee/driver_license).

## Product Specifications

| Specification                  | Details          |
| ------------------------------ | ---------------- |
| Endpoint Name                  | `driver_license` |
| Recommended Version            | `v1.0`           |
| Supports Polling/Webhooks      | ✔️ Yes           |
| Support Synchronous HTTP Calls | ❌ No             |
| Geography                      | 🌐 Global        |

## Quick-Start

Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/v1/products/driver_license/default_sample.jpg), we are going to illustrate how to extract the data that we want using the SDK.

<figure><img src="https://github.com/mindee/client-lib-test-data/blob/main/v1/products/driver_license/default_sample.jpg?raw=true" alt="Driver License Sample" width="375"><figcaption></figcaption></figure>

### Sample Code

```py
#
# Install the Python client library by running:
# pip install mindee
#

from mindee import Client, PathInput, AsyncPredictResponse, product

# Init a new client
mindee_client = Client(api_key="my-api-key")

# Load a file from disk
input_source = PathInput("/path/to/the/file.ext")

# Load a file from disk and enqueue it.
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
    product.DriverLicenseV1,
    input_source,
)

# Print a brief summary of the parsed data
print(result.document)

```

### Sample Output (rST)

```rst
########
Document
########
:Mindee ID: fbdeae38-ada3-43ac-aa58-e01a3d47e474
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/driver_license v1.0
:Rotation applied: Yes

Prediction
==========
:Country Code: USA
:State: AZ
:ID: D12345678
:Category: D
:Last Name: Sample
:First Name: Jelani
:Date of Birth: 1957-02-01
:Place of Birth:
:Expiry Date: 2018-02-01
:Issued Date: 2013-01-10
:Issuing Authority:
:MRZ:
:DD Number: DD1234567890123456
```

## Standard Fields

These fields are generic and used in several products.

### BaseField

Each prediction object contains a set of fields that inherit from the generic `BaseField` class. A typical `BaseField` object will have the following attributes:

* **value** (`Union[float, str]`): corresponds to the field value. Can be `None` if no value was extracted.
* **confidence** (`float`): the confidence score of the field prediction.
* **bounding\_box** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
* **polygon** (`List[Point]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
* **page\_id** (`int`): the ID of the page, always `None` when at document-level.
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).

{% hint style="info" %}
A `Point` simply refers to a list of two numbers (`[float, float]`).
{% endhint %}

Aside from the previous attributes, all basic fields have access to a custom `__str__` method that can be used to print their value as a string.

### DateField

Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following:

* **date\_object** (`Date`): an accessible representation of the value as a python object. Can be `None`.

### StringField

The text field `StringField` only has one constraint: its **value** is an `Optional[str]`.

## Attributes

The following fields are extracted for Driver License V1:

### Category

**category** ([StringField](#stringfield)): The category or class of the driver license.

```py
print(result.document.inference.prediction.category.value)
```

### Country Code

**country\_code** ([StringField](#stringfield)): The alpha-3 ISO 3166 code of the country where the driver license was issued.

```py
print(result.document.inference.prediction.country_code.value)
```

### Date of Birth

**date\_of\_birth** ([DateField](#datefield)): The date of birth of the driver license holder.

```py
print(result.document.inference.prediction.date_of_birth.value)
```

### DD Number

**dd\_number** ([StringField](#stringfield)): The DD number of the driver license.

```py
print(result.document.inference.prediction.dd_number.value)
```

### Expiry Date

**expiry\_date** ([DateField](#datefield)): The expiry date of the driver license.

```py
print(result.document.inference.prediction.expiry_date.value)
```

### First Name

**first\_name** ([StringField](#stringfield)): The first name of the driver license holder.

```py
print(result.document.inference.prediction.first_name.value)
```

### ID

**id** ([StringField](#stringfield)): The unique identifier of the driver license.

```py
print(result.document.inference.prediction.id.value)
```

### Issued Date

**issued\_date** ([DateField](#datefield)): The date when the driver license was issued.

```py
print(result.document.inference.prediction.issued_date.value)
```

### Issuing Authority

**issuing\_authority** ([StringField](#stringfield)): The authority that issued the driver license.

```py
print(result.document.inference.prediction.issuing_authority.value)
```

### Last Name

**last\_name** ([StringField](#stringfield)): The last name of the driver license holder.

```py
print(result.document.inference.prediction.last_name.value)
```

### MRZ

**mrz** ([StringField](#stringfield)): The Machine Readable Zone (MRZ) of the driver license.

```py
print(result.document.inference.prediction.mrz.value)
```

### Place of Birth

**place\_of\_birth** ([StringField](#stringfield)): The place of birth of the driver license holder.

```py
print(result.document.inference.prediction.place_of_birth.value)
```

### State

**state** ([StringField](#stringfield)): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.

```py
print(result.document.inference.prediction.state.value)
```


---

# 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.mindee.com/v1/integration/python-sdk/global-products/python-driver-license-ocr.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.
