Driving License Text and PDF AI Agent / LLM
GeneralEverything an AI coding assistant needs to write a working Driving License Text and PDF integration without opening another page: endpoint, authentication, parameters, a real request, both response shapes and the platform rules it cannot infer from a single example. Copy the brief below and paste it into Claude, Cursor, GitHub Copilot, ChatGPT or any other agent.
Machine-readable spec — Markdown
# Driving License Text and PDF API — Way2API®
- **Endpoint:** `POST https://app.way2api.com/api/v1/driving-license/text-pdf`
- **Auth:** `Authorization: Bearer YOUR_API_KEY` (or `X-API-Key: YOUR_API_KEY`)
- **Content-Type:** `application/json`
- **Category:** General
- **Availability:** Available in India
- **Docs:** https://app.way2api.com/documentation/driving-license-text-pdf
## What it does
Driving License Text and PDF API — An Indian driving licence returned both ways in a single call: the full licence record as JSON, and a pdf_url pointing at a ready-to-print government smart-card / A4 PDF of the same licence. Send the licence number and date of birth and receive the holder name, parent or spouse name, date of birth, sex, blood group, permanent and temporary addresses with PIN codes, issuing authority and its RTO code, state, issue and expiry dates for both non-transport and transport classes, the vehicle classes the licence authorises, and the holder photograph as base64 — plus the document link. Dates come back as ISO YYYY-MM-DD, and gender and vehicle_classes are published from stable value sets, so both the shape and the values of this response are guaranteed not to move. pdf_url is an empty string in the rare case where a document could not be produced; the record itself is unaffected, so check it before following the link. Generated documents stay downloadable for a limited time — fetch and store the file promptly rather than holding the link. Use this endpoint when you need to both read the licence data and hand someone a printable card; the Driving License Verification and Driving License PDF endpoints sell those halves separately.
## Request body (application/json)
| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `dl_number` | string | yes | Driving license number (10-20 characters, e.g. MH0320140001234). Case-insensitive, no spaces or hyphens. |
| `dob` | string | yes | Date of birth of the license holder in dd/mm/yyyy format. |
## Example request
```bash
curl -X POST https://app.way2api.com/api/v1/driving-license/text-pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"dl_number":"MH0320140001234","dob":"15/06/1992"}'
```
## Success response — 200
```json
{
"status": "SUCCESS",
"status_code": 200,
"charged": true,
"success": true,
"message": "",
"message_code": "OK",
"order_id": "W2A1739512345abcdef01",
"data": {
"order_id": "W2A1739512345abcdef01",
"result": {
"license_number": "MH0320140001234",
"state": "Maharashtra",
"name": "PRIYA PATEL",
"father_or_husband_name": "MAHESH PATEL",
"dob": "1992-06-15",
"gender": "F",
"blood_group": "B+",
"citizenship": "",
"permanent_address": "42 MG ROAD, PUNE, MAHARASHTRA",
"permanent_zip": "411001",
"temporary_address": "42 MG ROAD, PUNE, MAHARASHTRA",
"temporary_zip": "411001",
"city_name": "PUNE",
"ola_name": "RTO PUNE",
"ola_code": "MH032",
"doi": "2014-08-11",
"doe": "2034-08-10",
"initial_doi": "2014-08-11",
"transport_doi": "1800-01-01",
"transport_doe": "1800-01-01",
"vehicle_classes": [
"MCWG",
"LMV-NT"
],
"has_image": true,
"profile_image": "/9j/4AAQSkZJRgABAQAAAQABAAD__gATQ3JlYXRlZCB3aXRoIEdJTVA...",
"less_info": false,
"pdf_url": "https://docs.example-renderer.com/upload/dl2_1786426531_70e7ff519ee00a12.pdf"
}
}
}
```
## Error response — 422
```json
{
"status": "SUCCESS",
"status_code": 422,
"charged": true,
"success": false,
"message": "Verification Failed.",
"message_code": "VERIFICATION_FAILED",
"order_id": "W2A1739512345abcdef01",
"data": {
"order_id": "W2A1739512345abcdef01",
"error_code": "no_record",
"result": {
"license_number": "MH0320140001234",
"state": "",
"name": "",
"father_or_husband_name": "",
"dob": "1992-06-15",
"gender": "",
"blood_group": "",
"citizenship": "",
"permanent_address": "",
"permanent_zip": "",
"temporary_address": "",
"temporary_zip": "",
"city_name": null,
"ola_name": "",
"ola_code": "",
"doi": "",
"doe": "",
"initial_doi": "",
"transport_doi": "",
"transport_doe": "",
"vehicle_classes": [],
"has_image": false,
"profile_image": "",
"less_info": false,
"pdf_url": ""
}
}
}
```
## Integration rules
- Every response is JSON carrying `status`, `status_code`, `charged`, `success`, `message`, `message_code` and (once a call reaches the provider) `order_id`. The verification payload is under `data.result`.
- `charged` (boolean) is the authority on billing. Do NOT infer it from the HTTP status: `422` is returned both for input we rejected (not charged) and for a lookup the provider ran and billed us for that returned a negative result (charged).
- `message_code` is a fixed vocabulary — branch on it instead of parsing `message`. Values: `OK`, `ACCEPTED`, `PROVIDER_NO_RESPONSE`, `VERIFICATION_FAILED`, `NO_RECORD_FOUND`, `INVALID_INPUT`, `REQUEST_FAILED`, `MISSING_API_KEY`, `INVALID_API_KEY`, `INSUFFICIENT_BALANCE`, `NO_API_ACCESS`, `NOT_FOUND`, `RATE_LIMITED`, `INTERNAL_ERROR`, `PROVIDER_UNAVAILABLE`.
- `success` reports the verification outcome; `status` reports the ORDER lifecycle (`SUCCESS`/`PENDING`/`FAILED`). They differ on a charged negative result: the order completed and was billed while the verification did not pass.
- A failed verification is still a successful HTTP call — the outcome lives in the response body, so do not treat `200` as "verified".
- Status codes: `200` result returned, `202` pending or provider did not respond (both charged — quote the `order_id`), `401` missing/invalid key, `402` insufficient balance, `403` no access to this service, `422` see `charged`, `429` rate limited (honour the `Retry-After` header), `503` temporarily unavailable.
- Rate limits are per API key, per service, on a 1-minute sliding window.
- Load the API key from an environment variable or secret store. Never hard-code it, never commit it, and never ship it in client-side code — calls must be made from your backend.
Prompts to pair it with
- Write a production-ready Driving License Text and PDF integration in PHP using this spec, with error handling and retries.
- Given this spec, generate typed request/response models and a client class.
- Review my existing Driving License Text and PDF integration against this spec and list what I handle incorrectly.
⚠ Before you paste generated code
Never let an assistant hard-code your API key — load it from an environment variable or a
secret store, and call this endpoint from your backend only. A failed verification is still a
successful HTTP call, so check the success field in the body
rather than treating 200 as verified.