Results and evidence#
After the last step, Rokh makes a report. The report has the decision, the score and the result of each check. Rokh also keeps the recordings and the photos of each step.
Read the report#
curl https://rokh.id/api/vendor/requests/{id}/report.json -H "Authorization: Bearer $ROKH_API_KEY"
The response has the status 404 until the report is ready. The report is ready when the request has the status submitted.
The report field of the request record (GET /api/vendor/requests/{id}) has the same report.
The decision and the score#
| Field | Contents |
|---|---|
decision |
pass or no_pass |
decision_reasons |
The steps that did not pass, for example ["document_inconclusive"]. An empty list when decision is pass. |
score |
0 to 100. See The score. |
score_deductions |
The findings that took points from the score |
completion_score |
The percentage of the required steps that passed |
score_definition |
A short description of the score |
required_stages |
The steps of this request: document, face and, if you sent sentences, declaration |
vendor_input_check |
Values that you sent and that the customer possibly typed incorrectly on your site. See Incorrect values from your site. |
decision_basis |
Only when Rokh passed a request on its score because the face match to the document photo was uncertain. See The decision. |
decided_by |
manual when a person passed the request. The field is not there for an automatic decision. See Pass a request manually. |
automatic_result |
The automatic decision, score and reasons, when a person passed the request |
manual_decision |
The manual pass that is in force: who, when and why |
manual_decisions |
Each manual pass and each withdrawal of the request, oldest first |
The decision#
The decision is pass only when each required check of each required step passed. A check that failed or that is inconclusive gives no_pass. Rokh does not ask a person before the decision.
There is one exception. Many document photos show the customer with a headscarf. Thus the match between the live face and the document photo can be uncertain. The pass line of the face match does not change. When the match is uncertain, Rokh passes the request if these conditions are true:
- The score is 70 or more.
- No required check failed.
- Each required step has a result, and no step failed.
- The customer did not use all tries of a step.
Other inconclusive checks can stay inconclusive. Their points are in the score. Then decision_reasons is empty and decision_basis has these fields:
| Field | Contents |
|---|---|
rule |
uncertain_document_face_match_with_score |
minimum_score |
70 |
score |
The score of the request |
uncertain_face_match |
The face match checks with an uncertain result, and their similarity |
other_open_checks |
The other required checks that did not pass, for example document__document_name |
open_reasons |
The reasons that the decision would have without this rule |
The checks keep their status. The coverage field identity_checks_complete is false. Examine the evidence when your rules tell you to do so.
After the automatic decision, a person can pass a no_pass request. Then decision is pass and decided_by is manual. The checks and the score do not change.
The decision does not use the score. A request can have pass and a score less than 100. Examples are a foreign IP address or a fraud flag. These findings take points, but they do not fail a step.
The score#
The score starts at 100. Each finding takes the points that you set in flow_policy.scoring and flow_policy.network. The score is never less than 0. Read Score settings.
Each item of score_deductions has these fields:
| Field | Contents |
|---|---|
kind |
failed_check, inconclusive_check, missing_step, network or fraud_flag |
points |
The points that the finding took |
stage |
The step of the finding |
check |
failed_check and inconclusive_check: the name of the check, for example document__document_name |
status |
inconclusive_check: the status of the check |
code |
network: the observation, for example foreign_allocation. fraud_flag: the flag. |
family |
fraud_flag: the group of the flag |
group, detail |
network: the group of the observation and a short description |
Example: the customer passed all steps from a non-Iranian IP address.
{"decision": "pass", "score": 90, "completion_score": 100.0,
"score_deductions": [{"kind": "network", "code": "foreign_allocation", "stage": "document", "points": 10,
"group": "network", "detail": "IP allocated outside Iran (DE): …"}]}
Note: The score is not a probability that an identity is genuine. Use the decision to accept a customer. Use the score to compare customers and to find requests that you want to examine.
Incorrect values from your site#
Some values that you send can be different from the document because the customer typed them incorrectly on your site. For these values, vendor_input_check has status review and one item in fields for each value. When there is no such value, status is none and fields is empty.
kind |
Meaning |
|---|---|
name_words_missing |
The name that you sent lacks part of the name on the document. Each word that you sent is on the document, in the same sequence. The document has more words. For example, the document shows a surname with two words and you sent one word. Or, a word that you sent is only the first part of one printed word. Then the item also has pattern joined_name_shortened. For example, you sent «محمد» and the document shows «محمدرضا». |
name_differs |
The name that you sent is not the name on the document. The national code on the document is the same as the code that you sent. If you sent a birth date, the birth date on the document is also the same. |
birthday_disagrees |
Rokh read the birth date on the document. It is not the same as the birth date that you sent. |
birthday_out_of_range |
The birth date that you sent gives an age of less than 10 years or more than 100 years, or a date in the future. |
Each item has the fields kind, field (full_name, given_names or birthday) and check (the name of the check in checks). Some items also have pattern.
The checks fail as before, and the decision does not change. Rokh does not show this information to the customer. You can ask the customer to examine the values on your site, correct them and try again. Show the customer only the values that they gave you, not the values on the document.
{"decision": "no_pass",
"vendor_input_check": {"status": "review", "fields": [{"check": "document__document_name", "field": "full_name", "kind": "name_words_missing"}]}}
The flag for incorrect values#
Each request has one flag, vendor_input. The flag shows that the name or the birth date that you sent is incorrect. The request list, the record of a request and each webhook message have the flag. Your panel and the Rokh panel show the same flag on the row of the request.
- Rokh sets the flag when
vendor_input_checkhas the statusreview. - A person can set or remove the flag: you (in your panel or with your API key) or the Rokh operations team.
- The last choice of a person is the value of the flag. This is also true when the choice is different from the result of Rokh.
| Field | Contents |
|---|---|
flagged |
true when the values that you sent are incorrect |
set_by |
automatic (Rokh), vendor (you), rokh (the Rokh operations team), or null when there is no flag |
automatic |
The kind values that Rokh found in vendor_input_check. The list is empty when Rokh found none. It is null before the report. |
person |
The last choice of a person: flagged, initiated_by, by, at and note. It is null when no person made a choice. The request list does not have this field. |
history |
Each choice of a person, oldest first. Only the record of a request and GET /api/vendor/requests/{id}/vendor-input have this field. |
To set or remove the flag, send flagged:
PUT /api/vendor/requests/{id}/vendor-input
Authorization: Bearer rk_live_…
Content-Type: application/json
{"flagged": true, "note": "The customer typed the surname as one word."}
note is optional. It has at most 500 characters. The response has vendor_input and changed. changed is false when the flag already had this value. The access log of the request records each change. Your webhook gets the event request.vendor_input_changed. The flag does not change a check, the decision or the score.
The checks#
checks has one item for each check. The name of an item is <step>__<check>, for example document__document_name.
| Field | Contents |
|---|---|
status |
pass, fail, inconclusive, review or unavailable |
engine |
The component that did the check |
details |
The evidence of the check: the read values, the thresholds and the reason |
warnings |
Notes about the check, if any |
counts gives the number of checks with each status.
Important checks:
| Check | It examines |
|---|---|
document__document_document_type |
The document is the type that the customer chose. |
document__document_name |
The name on the document agrees with expected_fields. |
document__document_birthday |
The date of birth agrees. |
document__document_national_id_agreement |
The national code agrees. |
document__document_national_id_format |
The national code on the document has a correct control digit. |
document__document_expiry |
The expiry date of the document is not in the past. |
document__document_mrz |
The machine-readable zone of a passport is correct. |
document__document_portrait |
The photo on the document is usable. |
document__document_temporal_identity_consistency |
The recording shows the same document as the photo. |
face__live_document_face_match |
The live face agrees with the photo on the document. |
face__face_rgb_pad |
The face is a live person, not a photo or a screen. |
face__face_movement |
The customer turned the head as Rokh asked. |
declaration__declaration_words |
The customer said the sentences. |
declaration__declaration_visible_speaking |
The mouth moved with the words. |
declaration__declaration_held_document |
The customer held the same document. |
<step>__device_network_risk |
The combined network and device risk |
A check with "required": false in its details is a report for you only. It never changes the decision. Fraud flags are this type of check.
Coverage#
verification_coverage tells you what Rokh verified:
| Field | Contents |
|---|---|
expected_fields_supplied |
The fields of expected_fields that you sent |
name_match_mode |
full_name or first_name |
identity_checks_complete |
true when Rokh did all identity checks of the request |
Registry#
issuer_verification.status is always not_performed. Rokh does not have access to an Iranian registry. The report never claims a confirmation from a registry.
Recordings and photos#
| Endpoint | Gives |
|---|---|
GET /api/vendor/requests/{id}/media |
The list of recordings, with the hash of each part |
GET /api/vendor/requests/{id}/media/{media_id} |
A recording (WebM). Add ?download=1 to download it. |
GET /api/vendor/requests/{id}/media/{media_id}/poster.jpg |
One frame of a complete recording, as a JPEG picture for a list |
GET /api/vendor/requests/{id}/media/{media_id}/compact.mp4 |
The compact copy of an archived recording (MP4), to play it |
GET /api/vendor/requests/{id}/media/stills/{still_id} |
A photo as the customer sent it. Add ?normalized=1 for the photo that Rokh examined, or ?download=1 to download it. |
GET /api/vendor/requests/{id}/captures/{kind}/image |
The current photo of a view: front, back or selfie |
GET /api/vendor/panel/requests/{id}/evidence.zip |
All evidence in one file, with a list of SHA-256 hashes |
GET /api/vendor/panel/requests/{id}/access-log |
Each person or key that viewed or downloaded the evidence |
Each item of media has stage, attempt, status, sha256, byte_count, chunks, view_url and download_url. An attempt that the customer stopped has the status abandoned and a reason in ended_by: page_closed, customer_restart or session_ended.
A complete item also has duration_seconds and poster_url. duration_seconds is the length of the recording. Rokh measures it from the time stamps in the file, because a browser recording does not give its length. It is null when Rokh cannot read the file. poster_url gives one frame of the recording, from about one third of its length. Rokh makes the picture one time and keeps it. The recording does not change. Use these two fields to show the recordings in a list. They are not evidence and no check uses them.
A complete item also has display_size. It is null for most recordings. Some browsers record the portrait camera picture stretched into a landscape frame: for example 1280x720 from a 720x1280 camera, with no rotation in the file. A phone that turns after the recorder starts gives the same result: the photos of the step then have the turned size of the file. For such a recording, display_size gives the correct size [width, height]. It is the camera size that the page reported, or the size of the photos. Show the recording at this size. Rokh makes the poster_url picture at this size, and the checks read each frame at this size. The recording does not change, and a download gives the file as recorded.
For a finished request, Rokh makes a compact copy of each recording that is older than 3 days. If the copy is at most 80% of the size of the original, Rokh keeps the copy on its disk. Then Rokh moves the original to its archive storage. The item then has compact_url. For other items, compact_url is null. The compact copy is an MP4 file with HEVC video, usually about 40% of the size of the original. It has the same frames at the same times and the same sound. Use compact_url to play the recording. It is not evidence and no check uses it. Some browsers cannot play HEVC video. If your player cannot play the compact copy, use view_url.
An abandoned item that has received parts also has partial, and its view_url and download_url give the part of the recording that arrived. partial has pieces_received, pieces_shown, final_piece_received and evidence (always false). Rokh joins the received parts in their order one time and keeps the result. This part is not evidence and no check uses it. It has no sha256. Use it to see what the customer did in a try that did not finish. An item with the status uploading has no view_url.
For a complete item, view_url and download_url always give the original sealed recording, with the same SHA-256. For an archived recording, the server first gets the original from the archive storage, so the first request can take some seconds. Each check and each recheck also uses the original. If the server cannot get the original from the archive, you get the status 503 with the code recording_archive. Try again later.
The photos of each session are in live_sessions[].stills of the request record, with original_url and view_url.
The addresses in view_url and original_url start with /api/admin/requests/. They work with your API key and your panel session. They give you only your own requests.
Note:
camera_origin_verifiedis alwaysfalse. A browser cannot prove that a recording came from a real camera.
Keep the evidence#
Rokh keeps the reports, the recordings and the photos. Rokh does not delete them automatically. If your rules tell you to keep a copy, download evidence.zip and keep it in your own store.
Check the evidence again#
POST /api/vendor/requests/{id}/reanalyze does the automatic checks again on the same recordings and photos. The new report replaces the old report. The evidence does not change. Use it only when Rokh tells you that a check changed.
Pass a request manually#
A person can examine the evidence of a no_pass request and pass it. You can do this on the request page of the panel or with the API. The Rokh operations team can also do it.
POST /api/vendor/requests/{id}/manual-decision
Authorization: Bearer rk_live_...
Content-Type: application/json
{"decision": "pass", "note": "The operator examined the evidence. The document photo shows a headscarf."}
| Field | Contents |
|---|---|
decision |
pass. This is the only value. |
note |
Why you pass the request. 1 to 2000 characters. You must send it. |
Rokh accepts a manual pass only when the customer completed the request and the automatic decision is no_pass. Rokh gives 409 in other conditions.
After a manual pass:
decisionispassanddecision_reasonsis empty.decided_byismanual.automatic_resultkeeps the automatic decision, score and reasons.manual_decisionhasinitiated_by(rokhorvendor),by,atandnote.- The checks, the score and the evidence do not change.
- A new automatic check keeps the manual pass.
- Your webhook gets
request.completedagain. See A corrected result.
To withdraw a manual pass, send DELETE /api/vendor/requests/{id}/manual-decision. A note in the body is optional. Then the decision is the automatic decision again. manual_decisions keeps the manual pass and its withdrawal.
Rokh does not show the manual decision to the customer.