Download OpenAPI specification:Download
Resistant Documents provides this API to programmatically interact with its document analysis engine. Interaction with the API can be divided into three phases:
In the first step, the submission is created by posting to the /v2/submission endpoint. The response contains a submission_id uniquely identifying the document to be analyzed throughout the entire interaction, and is used to fetch analysis results later.
Submission response also returns upload_url containing a pre-signed URL. This URL should be used to upload the actual document to be analyzed in the second step. Please note the document has to be uploaded using HTTP PUT method with Content-Type HTTP header set to application/octet-stream.
In the last step, client should repeatedly poll using the /v2/submission/{submission_id}/fraud endpoint for analysis results. The best practice is to use polling with an exponential back-off to reduce load on the API.
The standard client credentials flow:
BASIC_AUTH=$(echo -n $CLIENT_ID:$CLIENT_SECRET | base64)
curl --request POST \
--url 'https://eu.id.resistant.ai/oauth2/aus2un1hkrKhPjir4417/v1/token' \
--header 'accept: application/json' \
--header "authorization: Basic $BASIC_AUTH" \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'grant_type=client_credentials&scope=submissions.read submissions.write'
{
"access_token": "eyJhbG[...]1LQ",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "submissions.read submissions.write"
}
Authorization: Bearer eyJhbG[...]1LQ
Please note that Token URL is specific for a given environment. Correct URL is in the corresponding environment documentation.
clientCredentials https://eu.id.resistant.ai/oauth2/aus2un1hkrKhPjir4417/v1/tokensubmissions.read - Read analysis results for a submission
submissions.write - Create a new submission
Create a new submission for a document to be analyzed
| query_id | string or null (Query ID) [ 0 .. 1024 ] characters User-defined ID of analyzed file - typically refers to internal ID of the analyzed document in user's CMS. Please ensure the query_id of any document is reviewed prior to submitting to ensure no PII is shared. Query_id is used for subsequent indexing of outputs from the document forensics analysis. |
| pipeline_configuration | string (PipelineConfiguration) Enum: "FRAUD_ONLY" "CLASSIFICATION_ONLY" "QUALITY_ONLY" "QUALITY_AND_FRAUD" Type of analysis pipeline to execute. |
| enable_decision | boolean (Adaptive Decision enable flag) Default: false
|
| enable_submission_characteristics | boolean (Submission characteristics enable flag.) Default: false
|
{- "query_id": "string",
- "pipeline_configuration": "FRAUD_ONLY",
- "enable_decision": false,
- "enable_submission_characteristics": false
}{- "submission_id": "stringstringstringstring",
}Attach submission characteristics to the submission. Submission characteristics are properties associated with the original submission of the document (i.e., from the end user). In descriptions of the properties, "user" refers to the person who initially submitted the document, "customer" refers to a customer of Resistant.ai using this API.
Calling this endpoint is only allowed if enable_submission_characteristics is set to true when creating the submission. When submission characteristics are enabled for the submission, submitting then is required (the document will not be analyzed without them).
| submission_id required | string |
object or null (Document characteristics) Properties associated with the analyzed document. | |
object or null (Device characteristics) Properties associated with the device used to submit the document. | |
object or null (User identity characteristics) Properties identifying the user who submitted the document. | |
object or null (Characteristics related to a transaction with the user) Properties of a transaction between the user and customer, e.g., load or purchase. | |
object or null (Characteristics related to an email interaction with the user) Properties of an email interaction between the user and customer, e.g. email or subject hashes. | |
| submission_time | string or null (Document submission time) Time of document submission by the end user |
| customer_tenant_id | string or null (Customer-assigned identifier tenant identifier) <= 1024 characters Customer-assigned identifier of a customer's tenant (e.g., internal merchant ID) |
{- "document_characteristics": {
- "document_type": "unknown",
- "document_type_string": "string",
- "issuing_country_code": "string",
- "document_id": "string",
- "document_filename": "string",
- "document_score": "string",
- "status": "string",
- "document_position_on_image": {
- "corner_1": {
- "x": 0,
- "y": 0
}, - "corner_2": {
- "x": 0,
- "y": 0
}, - "corner_3": {
- "x": 0,
- "y": 0
}, - "corner_4": {
- "x": 0,
- "y": 0
}
}, - "source_channel": "api",
- "document_side": "front"
}, - "device_characteristics": {
- "device_ip_address": "string",
- "server_ip_address": "string",
- "country_code": "GBR",
- "country_name": "string",
- "city": "string",
- "postal_code": "string",
- "gcs_latitude": 38.77554692,
- "gcs_longitude": -75.1396939,
- "isp": "string",
- "referer": "string",
- "user_agent": "Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0",
- "browser_description": "string",
- "device_platform": "string",
- "device_language": "en",
- "screen_height": 0,
- "screen_width": 0,
- "device_fingerprint": "string"
}, - "identity_characteristics": {
- "first_name": "string",
- "last_name": "string",
- "email": "string",
- "user_id": "string",
- "user_group_id": "string",
- "phone_number": "string",
- "date_of_birth": "2020-01-30"
}, - "transaction_characteristics": {
- "amount_usd": 120.5,
- "maturity_days": 60
}, - "email_characteristics": {
- "originator_address_hashes": [
- "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
], - "originator_domain_hashes": [
- "486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7"
], - "subject_hash": "bbcfcbdecdfec348f558015cc36d01ab27081c2cef9dad3e44d9277b46de2f72",
- "number_of_recipients": 0,
- "recipient_hashes": [
- "486ea46224d1bb4fb680f34f7c9ad96a8f24ec88be73ea8e5a6c65260e9cb8a7"
], - "body_embedding": "string",
- "subject_embedding": "string"
}, - "submission_time": "string",
- "customer_tenant_id": "string"
}{- "message": "string"
}Fetch fraud analysis result
| submission_id required | string |
| with_metadata | boolean Default: false Enables indicator medatadata in the response object |
{- "status": "SUCCESS",
- "analysis_time": "string",
- "file_type": "unsupported",
- "mime_type": "string",
- "deployment_version": "string",
- "query_id": "string",
- "sha256": "stringstringstringstringstringstringstringstringstringstringstri",
- "filtered_parsed_pages": [
- 0
], - "num_pages": 0,
- "score": "NORMAL",
- "sample_metadata": {
- "producer": "string",
- "creator": "string",
- "creation_date": "string",
- "mod_date": "string",
- "author": "string",
- "title": "string",
- "keywords": "string",
- "subject": "string"
}, - "indicators": [
- {
- "indicator_id": "string",
- "type": "RISK",
- "category": "string",
- "title": "string",
- "description": "string",
- "metadata": {
- "type": "DataOnly",
- "column_names": [
- "string"
], - "data": [
- [
- "string"
]
]
}, - "indicator_attributes": {
- "indicator_id": "in_transaction_cluster",
- "serial_fraud_cluster_id": "string",
- "cluster_submission_ids_sample": [
- "string"
], - "cluster_query_ids_sample": [
- "string"
]
}, - "origin": "fraud"
}
], - "document_class": {
- "id": "string",
- "type": "mixed",
- "document_class_type": "DocumentClass"
}
}Fetch content extraction result
| submission_id required | string |
{- "status": "SUCCESS",
- "analysis_time": "string",
- "file_type": "unsupported",
- "mime_type": "string",
- "deployment_version": "string",
- "query_id": "string",
- "sha256": "stringstringstringstringstringstringstringstringstringstringstri",
- "contents": [
- {
- "card_generation": "UNKNOWN",
- "issuing_country": "str",
- "id_card_type": "CzeBack2012",
- "content_type": "IdCard",
- "personal_no": "string",
- "machine_readable_summary": {
- "raw_lines": [
- "string"
], - "date_of_birth_str": "string",
- "date_of_expiration_str": "string",
- "card_no": 0,
- "last_name": "string",
- "first_name": "string",
- "nationality": "str",
- "sex": "string"
}, - "barcode_str": "string",
- "permanent_stay": "string",
- "academic_degree": "string",
- "issued_by": "string",
- "marital_status": "UNKNOWN"
}
]
}{- "status": "SUCCESS",
- "analysis_time": "string",
- "file_type": "unsupported",
- "mime_type": "string",
- "deployment_version": "string",
- "query_id": "string",
- "sha256": "stringstringstringstringstringstringstringstringstringstringstri",
- "score": "HIGH_QUALITY",
- "sample_metadata": {
- "producer": "string",
- "creator": "string",
- "creation_date": "string",
- "mod_date": "string",
- "author": "string",
- "title": "string",
- "keywords": "string",
- "subject": "string"
}, - "indicators": [
- {
- "indicator_id": "string",
- "type": "RISK",
- "category": "string",
- "title": "string",
- "description": "string",
- "metadata": {
- "type": "DataOnly",
- "column_names": [
- "string"
], - "data": [
- [
- "string"
]
]
}, - "origin": "quality"
}
]
}Fetch Adaptive Decision result. Note that if the response is too large, the endpoint may send a 302 FOUND response with a Location header pointing to result download location. Clients must follow such redirect.
| submission_id required | string |
| embed | string Example: embed=fraud Coma-separated list of |
{- "status": "SUCCESS",
- "decision": "string",
- "decision_inputs": {
- "fraud": {
- "url": "/v2/submission/submission123/fraud",
- "data": {
- "status": "SUCCESS",
- "analysis_time": "string",
- "file_type": "unsupported",
- "mime_type": "string",
- "deployment_version": "string",
- "query_id": "string",
- "sha256": "stringstringstringstringstringstringstringstringstringstringstri",
- "filtered_parsed_pages": [
- 0
], - "num_pages": 0,
- "score": "NORMAL",
- "sample_metadata": {
- "producer": "string",
- "creator": "string",
- "creation_date": "string",
- "mod_date": "string",
- "author": "string",
- "title": "string",
- "keywords": "string",
- "subject": "string"
}, - "indicators": [
- {
- "indicator_id": "string",
- "type": "RISK",
- "category": "string",
- "title": "string",
- "description": "string",
- "metadata": {
- "type": "DataOnly",
- "column_names": [
- "string"
], - "data": [
- [
- "string"
]
]
}, - "indicator_attributes": {
- "indicator_id": "in_transaction_cluster",
- "serial_fraud_cluster_id": "string",
- "cluster_submission_ids_sample": [
- "string"
], - "cluster_query_ids_sample": [
- "string"
]
}, - "origin": "fraud"
}
], - "document_class": {
- "id": "string",
- "type": "mixed",
- "document_class_type": "DocumentClass"
}
}
}
}, - "adaptive_decision_version": "string",
- "reason": { }
}Fetch classification of the type of the submitted document
| submission_id required | string |
{- "status": "SUCCESS",
- "analysis_time": "string",
- "deployment_version": "string",
- "query_id": "string",
- "sha256": "stringstringstringstringstringstringstringstringstringstringstri",
- "mime_type": "string",
- "document_classification": {
- "score": "CLASSIFIED",
- "document_type": "id_document",
- "detailed_type": "birth_certificate",
- "issuer_parent": {
- "name": "string",
- "country": "string",
- "issuer_id": "07825439",
- "legal_address": {
- "street_address": "16192 COASTAL HWY, LEWES, DE 19958"
}
}, - "issuer": {
- "name": "string",
- "country": "string",
- "issuer_id": "07825439",
- "legal_address": {
- "street_address": "16192 COASTAL HWY, LEWES, DE 19958"
}
}, - "variant": "string"
}
}Add custom feedback for the document analysis result. Comment value is sanitized.
| submission_id required | string |
| analysis_feedback required | string (Analysis Feedback) Enum: "CORRECT" "NOT_CORRECT" Type of feedback on the result of document analysis. |
| comment | string or null (Feedback comment) [ 0 .. 1024 ] characters Additional feedback comment. |
{- "analysis_feedback": "CORRECT",
- "comment": "string"
}{- "analysis_feedback": "CORRECT",
- "comment": "string",
- "updated": "string"
}Get custom feedback for the document analysis result previously stored with a PUT request to this endpoint.
| submission_id required | string |
{- "analysis_feedback": "CORRECT",
- "comment": "string",
- "updated": "string"
}