post https://api-sandboxdash.norcapsecurities.com/tapiv3/index.php/v3/uploadPartyDocument
This endpoint is used to upload a document and associate it with an individual party. A valid party must exist to use this endpoint, and parties can be created using the createParty endpoint. The request must use the multipart/form-data content type to ensure proper handling of file uploads.
Log in to see full request history
Request Parameters
Parameter | Required | Type | Description |
---|---|---|---|
clientID | yes | string | TransactAPI Client ID |
developerAPIKey | yes | string | TransactAPI Developer Key |
partyId | yes | string | Party ID that is generated by the API when a party is created (createParty) |
documentTitle | yes | string | Uploaded document title. Please use prefix "documentTitle0=" in the value of documentTitle field |
file_name | yes | string | Uploaded document file name. Please use prefix "filename0=" in the value of file_name field |
userfile0 | yes | string | Raw file data. Specification of raw file data is application specific. Accepted file types are PDF, JPG, PNG, HEIC and BMP. Minimum file size is 1 kB. Maximum file size is 100 MB. Please refer to the Sample Requests section for reference implementations. |
createdIpAddress | yes | string | Requested IP Address |
Requirements
- File size: Files must be at least 1 kB and cannot exceed 100 MB.
- Accepted Formats: pdf, jpg, jpeg, and png.
- Content Type: The request must use
multipart/form-data
for proper file handling. - Multiple Files:
documentTitle
,userfile
andfilename
are indexed parameters. You may provide multiple userfile parameters (e.g.userfile0
,userfile1
,userfile2
, ...). Each userfile parameter must be accompanied by a correspondingdocumentTitle
andfilename
. These should be separated by an&
character. (e.g. (cURL)--form 'documentTitle="documentTitle0=DOC_TITLE_0&documentTitle1=DOC_TITLE_1"'
) - A valid party ID is required; use the createParty endpoint if the party does not exist.
Sample Requests
curl --location --request POST 'https://api-sandboxdash.norcapsecurities.com/tapiv3/index.php/v3/uploadPartyDocument'
--form 'clientID=someclientid'
--form 'partyId=somepartyid'
--form 'createdIpAddress="42.106.177.219"'
--form 'file_name="filename0=Testing Document Size12.pdf"'
--form 'userfile0=@"/path/to/file"'
--form 'documentTitle="documentTitle0=Testing Document Size12.pdf"'
--form 'developerAPIKey=somedeveloperAPIkey'
import axios from 'axios';
import { Readable } from 'stream';
import FormData from 'form-data';
const apiHost = process.env.TAPI_HOST || 'https://api-sandboxdash.norcapsecurities.com';
const tapiUriSegment = 'tapiv3/index.php/v3';
const tapiUri = `${apiHost}/${tapiUriSegment}`;
const mimeType = 'application/json';
const tapi = axios.create({
baseURL: tapiUri,
timeout: 10000,
headers: { accept: mimeType, 'content-type': mimeType },
});
const auth = {
clientID: process.env.TAPI_CLIENT_ID,
developerAPIKey: process.env.TAPI_API_KEY,
};
const uploadPartyDocument = (partyId, file) => {
const data = new FormData();
data.append('clientID', auth.clientID);
data.append('developerAPIKey', auth.developerAPIKey);
data.append('partyId', partyId);
data.append('file_name', `filename0="${file.originalname}"`);
data.append('documentTitle', `documentTitle0="${file.originalname}"`);
data.append('userfile0', Readable.from(file.buffer), { filename: file.originalname });
return tapi.post('/uploadPartyDocument', data, {
timeout: 60000,
headers: { data.getHeaders() },
});
};
const partyId = process.env.TAPI_PARTY_ID;
const fakeFile = {
buffer: Buffer.from('a'.repeat(1e3)),
originalname: 'test-party-file.pdf',
};
const response = await uploadPartyDocument(partyId, fakeFile);
console.log(response.data);
/*
output:
{
statusCode: '101',
statusDesc: 'Ok',
document_details: 'Document has been uploaded Successfully'
}
*/
Response Parameters
Parameter | Type | Description |
---|---|---|
statusCode | string | API Status Code |
statusDesc | string | API Status Description |
document_details | string | Document has been uploaded |
Errors(s) | string | (optional) provides more information about error response |
Sample Response
{
"statusCode": "101",
"statusDesc": "Ok",
"document_details": "Document has been uploaded Successfully"
}
Errors
HTTP response code | TAPI error code | Description |
---|---|---|
404 | 103 | Invalid credentials |
400 | 1400 | Invalid content-type (must be multipart/form-data) |
400 | 1400 | No file data set in request |
404 | 106 | Invalid request parameters |
404 | 106 | partyId required but not provided |
404 | 198 | partyId does not exist |
422 | 1422 | documentTitle malformed |
422 | 1422 | file_name malformed |
422 | 1422 | userfile0 required but not provided |
404 | 106 | documentTitle count does not match userfile count |
404 | 106 | userfile name count does not match userfile count |
404 | 106 | File content does not meet minimum byte size requirement (1 kilobyte) |
Test it Yourself!
Responses