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 typeUpload via Wink WidgetUpload via API
SSS Records
Income Tax Document
Payslips
Company ID

Additional analysis is done on SSS records, income tax documents, and payslips 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.

Documents and files that are automatically retrieved from verifiable sources such as payroll systems will be found under the Documents endpoint. The data retrieved from the document will 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

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 rawFiles 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
sizeintegerFile size in kilobytes
formatstringFile format of the file, can be one of the following: PDF, PNG, TIFF, JPEG
urlstringAccessible URL to the file

Sample Archive data

{
   "id": "archive-123abc456def789abc123def456abc78",
   "createdAt": "2022-11-01T10:00:00Z",
   "providerId": "user-provided",
   "userId": "tenandId-123abc456def789abc123def456abc78",
   "type": "TAX_DOCUMENT",
   "state": {
     "status": "ANALYZED",
     "errorCode": null,
     "errorMessage": null,
     "updatedAt": "2022-11-17T02:04:21Z"
   },
   "rawFiles": [
      {
         "id": "f-123abc456def789abc123def456abc78",
         "createdAt": "2022-11-01T10:00:00Z",
         "name": "ITR-2020-2021.png",
         "subType": "TAX_PAYMENT",
         "size": 300,
         "format": "PNG",
         "url": "https://url-to-file.png"
      }
      ]
   },
   {
      "id": "archive-123abc456def789abc123def456abc78",
      "createdAt": "2022-11-01T10:00:00Z",
      "providerId": "user-provided",
      "userId": "tenantId-123abc456def789abc123def456abc78",
      "type": "PAYSLIP",
      "state": {
         "status": "UNSUPPORTED",
         "errorCode": null,
         "errorMessage": null,
         "updatedAt": "2022-11-17T02:04:21Z"
      },
      "rawFiles": [
      {
         "id": "f-123abc456def789abc123def456abc78",
         "createdAt": "2022-11-01T10:00:00Z",
         "name": "payslip-november-2022.jpeg",
         "subType": "PAYSLIP",
         "size": 100,
         "format": "JPEG",
         "url": "https://url-to-file.jpeg"
      }
      ]
   }
}

Endpoints

Endpoint
List archivesGET /archives
Get archiveGET /archives/{id}
Upload payslip filePOST /archives/-/payslips/uploadRawFile

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