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.

Request Parameters

ParameterRequiredTypeDescription
clientIDyesstringTransactAPI Client ID
developerAPIKeyyesstringTransactAPI Developer Key
partyIdyesstringParty ID that is generated by the API when a party is created (createParty)
documentTitleyesstringUploaded document title. Please use prefix "documentTitle0=" in the value of documentTitle field
file_nameyesstringUploaded document file name. Please use prefix "filename0=" in the value of file_name field
userfile0yesstringRaw 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.
createdIpAddressyesstringRequested 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, userfileand filename are indexed parameters. You may provide multiple userfile parameters (e.g. userfile0, userfile1, userfile2, ...). Each userfile parameter must be accompanied by a corresponding documentTitle and filename. 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

ParameterTypeDescription
statusCodestringAPI Status Code
statusDescstringAPI Status Description
document_detailsstringDocument 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 codeTAPI error codeDescription
404103Invalid credentials
4001400Invalid content-type (must be multipart/form-data)
4001400No file data set in request
404106Invalid request parameters
404106partyId required but not provided
404198partyId does not exist
4221422documentTitlemalformed
4221422file_name malformed
4221422userfile0required but not provided
404106documentTitlecount does not match userfilecount
404106userfilename count does not match userfilecount
404106File content does not meet minimum byte size requirement (1 kilobyte)

Test it Yourself!

Language
Click Try It! to start a request and see the response here!