Upload Document
Request URL
POST /akepa/document/upload/:documentId
Description
This endpoint can be used to upload a document file to be stored within the specified document entity. The documentId
should be included as a path parameter and is obtained by first making a request to the /akepa/document/generate endpoint.
Use multipart/form-data
mode to upload the file.
The system will respond with HTTP status 200
if the file was successfully accepted.
The system will respond with HTTP status 400
if the given documentId
was not found.
Request Body
Snippet Examples
javascript
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const fileStream = fs.createReadStream('./file/path/fileName.jpg');
const form = new FormData();
form.append('file', fileStream, 'fileName.jpg');
const data = form;
const config = {
method: 'POST',
url: '${CONNECTFI_BASE_URL}/akepa/document/upload/:documentId',
headers: {
...form.getHeaders(),
'x-connectfi-token': "A long random string token received from /auth/get-token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "CONNECTFI_BASE_URL/akepa/document/upload/:documentId" --form "file=@./file/path/fileName.jpg" --header "x-connectfi-token: A long random string token received from /auth/get-token request"
Successful Response Examples
200 AKEPA/DOCUMENT/UPLOAD/:DOCUMENTID FRONT SUCCESSFUL RESPONSE
HEADERS
Header | Value |
---|---|
Content-Type | multipart/form-data |
x-connectfi-token | A long random string token received from /auth/get-token request |
PARAMETERS
Parameter | Description | Value |
---|---|---|
documentId | doc_4iLwO3xW6hyfrNW5ojMVy2 |
REQUEST BODY
RESPONSE BODY
{
"code": "0",
"data": {
"id": "doc_4iLwO3xW6hyfrNW5ojMVy2",
"aggregatorId": "CLIENTID",
"uploadStatus": true,
"workflow": "PERSONAL",
"name": "license",
"extension": "jpg",
"type": "license",
"dtsCreatedAt": "2023-11-01T16:48:58.524Z"
},
"requestId": "a143225078d611eeb5658f28ab5fe311"
}
200 AKEPA/DOCUMENT/UPLOAD/:DOCUMENTID BACK SUCCESSFUL RESPONSE
HEADERS
Header | Value |
---|---|
Content-Type | multipart/form-data |
x-connectfi-token | A long random string token received from /auth/get-token request |
PARAMETERS
Parameter | Description | Value |
---|---|---|
documentId | doc_4iLwO3xW6hyfrNW5ojMVy2 |
REQUEST BODY
RESPONSE BODY