API section
Document scanners
WIA and TWAIN document scanners: scan to PDF or a JPEG per page, result files and their deletion. Needs the Document scanner module in the key (except the emulator).
| POST | /api/v1/document-scanners/scan | Scan |
| GET | /api/v1/scans/{id}/{file} | Scan result file |
| GET | /api/v1/document-scanners | Document scanners |
| DELETE | /api/v1/scans/{id} | Delete the scan result |
Operation document-scan; result — id and file links (one PDF or a JPEG per page), download — GET /api/v1/scans/{id}/{file}. Without the module key — 402 LICENSE_REQUIRED (except device: emulator). Handy with Prefer: wait=120 — the response comes when the scanner is done
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Keyrequired | header | string | |
Prefer | header | string |
Request body application/json
Fields · ScanSettings
devicestringsourcestringdpiinteger int32from 50to 1200colorstringformatstringpageSizestringwidthMmnumber doublefrom 10to 1000heightMmnumber doublefrom 10to 1000brightnessinteger int32from -1000to 1000contrastinteger int32from -1000to 1000qualityinteger int32from 10to 100maxPagesinteger int32from 1to 500
{
"device": "string",
"source": "string",
"dpi": 50,
"color": "string",
"format": "string",
"pageSize": "string",
"widthMm": 10,
"heightMm": 10,
"brightness": -1000,
"contrast": -1000,
"quality": 10,
"maxPages": 1
}Response 200 application/json
Fields · Operation
idstring uuidtypestringidempotencyKeystringresourcesarray of stringstatusstringvalues:QUEUEDRUNNINGSUCCEEDEDFAILEDUNKNOWNstagestringcreatedAtstring date-timestartedAtstring date-timefinishedAtstring date-timeresultany valueerrorOperationError3 fields · OperationError
codestringmessagestringdetailsany value
warningsarray of string
Errors — problem+json with a code field, see error codes.
Request example
curl -X POST 'http://localhost:7790/api/v1/document-scanners/scan' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30' \
-H 'Content-Type: application/json' \
--data '{"device":"string","source":"string","dpi":50,"color":"string","format":"string","pageSize":"string","widthMm":10,"heightMm":10,"brightness":-1000,"contrast":-1000,"quality":10,"maxPages":1}'curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/document-scanners/scan' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30' \
-H 'Content-Type: application/json' \
--data '{"device":"string","source":"string","dpi":50,"color":"string","format":"string","pageSize":"string","widthMm":10,"heightMm":10,"brightness":-1000,"contrast":-1000,"quality":10,"maxPages":1}'Scan result file#
/api/v1/scans/{id}/{file}File name — from the operation's result.files: scan.pdf, page-1.jpg…
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string uuid | |
filerequired | path | string |
Response 200
File.
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/scans/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/scan.pdf'curl 'https://cloud.hw-connector.ru/agent/api/v1/scans/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11/scan.pdf' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Document scanners#
/api/v1/document-scannersWIA — all scanners and MFPs with a Windows driver, TWAIN — if NAPS2 is installed, and the emulator. The agent connects to each scanner, the response may take a few seconds
Response 200 application/json
Fields · ScannerList
licensedbooleanscannersarray of ScannerInfo5 fields · ScannerInfo
idstringdriverstringnamestringmanufacturerstringsourcesarray of string
Errors — problem+json with a code field, see error codes.
Request example
curl 'http://localhost:7790/api/v1/document-scanners'curl 'https://cloud.hw-connector.ru/agent/api/v1/document-scanners' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Delete the scan result#
/api/v1/scans/{id}Right away, without waiting for the retention period (hw.document-scanner.keep-hours)
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string uuid |
Response 200
No body.
Errors — problem+json with a code field, see error codes.
Request example
curl -X DELETE 'http://localhost:7790/api/v1/scans/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11'curl -X DELETE 'https://cloud.hw-connector.ru/agent/api/v1/scans/3f6c1d9e-1b2a-4c55-9e0d-6a1f0c2b7d11' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'