Document
This endpoint is used to upload a document that is not associated with a specific customer (also referred to as a separate document). This document can then be linked to a specific customer using the /customer/kyc/document-link endpoint. There are three steps that must occur to upload a document that is not associated with a particular customer.
- First, a document ID must be generated using the /document/generate endpoint. This is the ID that will be used to refer to the document in the connectFi system. This ID can also be used to later create an association between the document and a specific customer, essentially linking the document to the customer. (see /customer/kyc/document-link)
- Store the returned document ID locally.
- Once a document ID exists, the document file can be uploaded using the /document/upload/:documentId endpoint. Make sure to include the document ID as a path parameter when making this request.
After the document id has been generated and a file has been uploaded for it, then you may use a document-link request to associate the document with an existing customer document id. (see linking a document to an existing customer)
The following endpoints are deprecated.
Endpoint or Section | Action |
---|---|
/document/generate | Generate a document ID |
/document/upload/:documentId | Upload the document file |
Generate a Separate Document ID (deprecated)
Description:
This endpoint will generate a random document ID. This ID is not associated with any particular customer when generated. The document ID, along with an initial upload status of false will be returned in JSON format. As long as a valid "x-connectfi-token" is included in the request headers, this request will always return status code 200. No request body or path parameters are needed. After successfully generating a document ID, you will then need to upload the document file using the /document/upload/:documentId endpoint.
Request method and URL:
POST /document/generate
Request headers:
{
"x-connectfi-token": "a long random string" //Authorization token received from /auth/get-token request
}
Request body: none
Possible responses:
200 (HTTP response status code) -- Success, a document ID is returned
{
"code": "0", //Success
"data": {
"id": "sdoc_41S8eM8HpVb12fKSCLF1S0", //document ID in connectFi
"uploadStatus": false //initial upload status of false
}
}
Upload a Separate Document File (deprecated)
Description:
This endpoint will upload a document file that is not associated with any specific customer. The document ID generated in the prerequisite /document/generate request above is required as a path parameter. You may use this endpoint multiple times with the same document ID. However, subsequent requests will overwrite the previously uploaded file. If you wish to upload more than one file using this endpoint, you will need to first generate document IDs for each file.
Use multipart/form-data
mode to upload the file.
The document file that you upload may be an image, a PDF, a word document, etc. Only one document may be uploaded at a time.
Request method and URL:
POST /document/upload/:documentId
Request headers:
{
"Content-Type": "multipart/form-data",
"x-connectfi-token": "a long random string" //Authorization token received from /auth/get-token request
}
Request body: File data will be passed using multipart/form-data mode.
Possible responses:
200 (HTTP response status code) -- Success, document was uploaded
{
"code": "0", //Success
"data": {
"id": "sdoc_41S8eM8HpVb12fKSCLF1S0", //document ID in connectFi
"uploadStatus": true, //upload status updated to true
"extension": "png" //file extension of the document
}
}
400 (HTTP response status code) -- Separate document not found
In this example, an invalid document ID was given. Make sure that you have generated a document ID using a /document/generate request before uploading the corresponding document file.