Archives

Smile API can also store and process photos and other files to aid in verifying users' records. If enabled, users may upload photos, scans, or PDF files as a fallback method or as an additional data point for your records and verification use.

These can be any of the following:

Archive TypeWink Widget UploadAPI UploadData ExtractionAPI File TypeFile Subtypes
Income Tax DocumentTAX_DOCUMENTTAX_PAYMENT
PayslipPAYSLIPPAYSLIP
SSS Record Screenshot (Deprecated)SOCIAL_SECURITYPERSONAL_INFORMATION, EMPLOYMENT_INFORMATION
Company IDCOMPANY_IDCOMPANY_ID_FRONT, COMPANY_ID_BACK
NBI Clearance DocumentCLEARANCE_NBIN/A
ID (Front)ID_FRONTN/A
ID (Back)ID_BACKN/A
Bank StatementBACK_STATEMENTN/A
Utility BillsUTILITY_BILLSN/A
Police ClearanceCLEARANCE_POLICEN/A
Barangay ClearanceCLEARANCE_BARANGAYN/A
OthersOTHERSN/A

Additional analysis is done on supported document types to retrieve basic information from the uploaded file such as employment and income information. This allows you to immediately ingest the information from the document without needing to manually transcribe the data.

These user-uploaded files can be retrieved via the Archives endpoint, to allow for download or manual verification if you require.

Files up to a maximum of 15MB are accepted, and can be of the following formats:

  • Portable Network Graphic files (.png)
  • Portable Document Format files (.pdf)
  • Joint Photographic Experts Group files (.jpg or .jpeg)
  • Tag Image File Format files (.tiff)

Files are stored until removed by the user via the SDK, or revoked via the API, or for a maximum of 60 days.

Documents and files that are automatically retrieved from verifiable sources such as permissioned access to payroll systems will also be found under the Documents endpoint. The data retrieved from the document will also be found under the respective data type, such as Employments or Incomes.

🚧

Warning

Archives in Sandbox Mode return only specific payslips. To test Archives while in Sandbox Mode, you may download the sample payslips within the Developer Portal and upload it through the Wink Widget or through the API. Other files uploaded during Sandbox mode will return errors.

The Archive object

AttributeTypeDescription
idstringUnique ID for the archive/file
createdAtdate-timeDate and time when the file was uploaded by the user
providerIdstringAlways set to "user-provided" as the user has uploaded the file themselves
userIdstringUser's ID of the person who uploaded the file
typestringType of file uploaded, can be one of the following: PAYSLIP, TAX_DOCUMENT, COMPANY_ID, SOCIAL_SECURITY
stateobjectCurrent state of the processing for this file, see below
rawFilesarray of objectsAdditional details about the raw file
classificationobjectFile type of the uploaded file based on AI analysis of the file contents
analysisobjectExtracted data based on AI analysis of the file contents

The State object

AttributeTypeDescription
statusstringCurrent status of the analysis of the file, can be one of the following: STARTED, ANALYZED, UNSUPPORTED, ERROR, REVOKED
errorCodestringAny errors found during analysis, can be one of the following: MISSING_MANDATORY_FIELD, INVALID_FIELD_FORMAT, SYSTEM_ERROR
errorMessagestringHuman-readable error message for the errorCode above
updatedAtdate-timeDate and time when the file was last updated/analyzed

The Raw Files object

AttributeTypeDescription
idstringUnique ID of the raw file
createdAtdate-timeDate and time when the file was uploaded by the user
namestringFilename of the file as uploaded by the user
subTypestringType of file updated based on the parent file type
sizeintegerFile size in kilobytes
formatstringFile format of the file, can be one of the following: PDF, PNG, TIFF, JPEG
urlstringAccessible URL to the file

The Classification object

AttributeTypeDescription
fileTypestringFile type of the uploaded file based on AI analysis of the file contents, can be one of the following: PAYSLIP, TAX_DOCUMENT, EMPLOYMENT_CERTIFICATE, OTHERS

The Analysis object

The Analysis object will return extracted data based on the file type of the uploaded file. Other fields that are not found on the file will return null.

AttributeTypeSupported File TypeDescription
startDatedatePAYSLIP, TAX_DOCUMENTStart date of the payslip period, in YYYY-MM-DD format. Null if not available.
endDatedatePAYSLIP, TAX_DOCUMENTEnd date of the payslip period, in YYYY-MM-DD format. Null if not available.
payDatedatePAYSLIPPayment date of the payslip, in YYYY-MM-DD format. Null if not available.
currencydatePAYSLIPCurrency of the payslip in 3 character alpha ISO 4217 format. Null if not available.
baseAmountfloatPAYSLIP, TAX_DOCUMENTBase salary amount. Null if not available.
grossAmountfloatPAYSLIP, TAX_DOCUMENTGross salary payment amount. Null if not available.
netAmountfloatPAYSLIPNet salary payment amount. Null if not available.
employerNamestringPAYSLIP, TAX_DOCUMENTEmployer name from the payslip. Null if not available.
employeeNamestringPAYSLIP, TAX_DOCUMENTEmployee name from the payslip. Null if not available.
ssNumberstringPAYSLIPSocial Security Number from the payslip. Null if not available.
philHealthNumberstringPAYSLIPPhilHealth Identification Number from the payslip. Null if not available.
taxNumberstringPAYSLIP, TAX_DOCUMENTTax Identification Number from the payslip. Null if not available.
pagIbigNumberstringPAYSLIPPag-IBIG Member ID Number from the payslip. Null if not available.
expireDatedateCLEARANCE_NBIExpiry date of the clearance document, in YYYY-MM-DD format. Null if not available.
dateOfBirthdateCLEARANCE_NBIDate of birth, in YYYY-MM-DD format. Null if not available.
firstNamestringCLEARANCE_NBIFirst name from the document. Null if not available.
lastNamestringCLEARANCE_NBILast name from the document. Null if not available.
middleNamestringCLEARANCE_NBIMiddle name from the document. Null if not available.
nbiIdNumberstringCLEARANCE_NBINBI Clearance Document Number from the document. Null if not available.
addressstringCLEARANCE_NBIAddress from the document. Null if not available.
maritalStatusstringCLEARANCE_NBIMarital status from the document. Null if not available.
genderstringCLEARANCE_NBIGender from the document. Null if not available.
citizenshipstringCLEARANCE_NBICitizenship from the document. Null if not available.
remarkstringCLEARANCE_NBIRemarks from the document. Null if not available.

Sample Archive data

{
    "id": "archive-123abc456def789abc123def456abc78",
    "createdAt": "2024-01-01T12:34:56Z",
    "providerId": "tenant-provided",
    "userId": "tenantId-123abc456def789abc123def456abc78",
    "type": null,
    "state": {
        "status": "ANALYZED",
        "errorCode": null,
        "errorMessage": null,
        "updatedAt": "2024-01-01T12:34:56Z"
    },
    "rawFiles": [
        {
            "id": "f-123abc456def789abc123def456abc78",
            "createdAt": "2024-01-01T12:34:56Z",
            "name": "default.pdf",
            "subType": null,
            "size": 123,
            "format": "PDF",
            "url": "https://url-to-file.pdf"
        }
    ],
    "classification": {
        "fileType": "PAYSLIP"
    },
    "analysis": {
        "startDate": "2024-01-01",
        "endDate": "2024-01-15",
        "payDate": null,
        "currency": null,
        "grossAmount": 20000.0,
        "netAmount": 18000.0,
        "employerName": "ABC Corporation",
        "employeeName": "George Palomero",
        "ssNumber": "1234567890",
        "philHealthNumber": "123456789012",
        "taxNumber": null,
        "pagIbigNumber": "123456789012",
        "baseAmount": null,
        "expireDate": null,
        "dateOfBirth": null,
        "firstName": null,
        "lastName": null,
        "middleName": null,
        "nbiIdNumber": null,
        "address": null,
        "maritalStatus": null,
        "gender": null,
        "citizenship": null,
        "remark": null
    }
}

Endpoints

Endpoint
List archivesGET /archives
Create archivePOST /archives
Get archiveGET /archives/{id}
Classify archivePOST /archives/classify

Webhooks

ARCHIVE_STARTED

Fired when a user has uploaded one or several files ("archive") to Smile.

{
   "id": "et-123abc456def789abc123def456abc78",
   "version": 1,
   "type": "ARCHIVE_STARTED",
   "createdAt": "2021-04-14T09:30:24Z",
   "data": {
      "userId": "tenantId-123abc456def789abc123def456abc78",
      "archiveId": "archive-123abc456def789abc123def456abc78"
   }
}

ARCHIVE_ANALYZED

Fired when an archive has been analyzed and converted into JSON data automatically via OCR.

{
   "id": "et-123abc456def789abc123def456abc78",
   "version": 1,
   "type": "ARCHIVE_STARTED",
   "createdAt": "2021-04-14T09:30:24Z",
   "data": {
      "userId": "tenantId-123abc456def789abc123def456abc78",
      "archiveId": "archive-123abc456def789abc123def456abc78"
   }
}

ARCHIVE_REVOKED

Fired when a user removes permission to access or use an archive.

{
   "id": "et-123abc456def789abc123def456abc78",
   "version": 1,
   "type": "ARCHIVE_REVOKED",
   "createdAt": "2021-04-14T09:30:24Z",
   "data": {
      "userId": "tenantId-123abc456def789abc123def456abc78",
      "archiveId": "archive-123abc456def789abc123def456abc78"
   }
}

ARCHIVE_FAILED

Fired when the archive creation or analysis process is unsuccessful.

{
   "id": "et-123abc456def789abc123def456abc78",
   "version": 1,
   "type": "ARCHIVE_FAILED",
   "createdAt": "2021-04-14T09:30:24Z",
   "data": {
      "userId": "tenantId-123abc456def789abc123def456abc78",
      "archiveId": "archive-123abc456def789abc123def456abc78",
      "errorCode": "FILE_UNABLE_TO_RECOGNIZE",
      "errorMessage": "Invalid file!"
   }
}

Event Listeners

The SDK also emits events that can be caught by your native application to allow the application to react and perform functions as needed.

CallbackDataDescription
onUploadsCreateduploads, useridFired when the user uploads files via the SDK. Contains upload array and user's userId