Attach a document to an application

This endpoint is used to attach documents to a specific application, identified by its unique ID ({id}).





Request

Endpoints


Required keys

ParameterDescription
{id}The unique application identifier returned during application creation or listing endpoints.
bearer tokenThe auth token returned by /oauth2/token

Body

Field NameTypeRequiredDescription
documentFileYesThe file to be uploaded. Must conform to accepted formats and size limits.
documentTypeStringYesSpecifies the type of document being uploaded (e.g., "ID", "ProofOfAddress", "BusinessLicense").
descriptionStringOptionalAn optional description or note about the document.

Accepted Document Formats

  • PDF
  • JPEG
  • PNG
  • XSL
  • CSV
  • DOC

Size Limits

  • Maximum size per file: 10MB


Response

Field Definitions

Field NameTypeDescription
statusStringStatus of the upload request (SUCCESS, FAILED).
successBooleanIndicates if the document upload was successful.
resultStringA confirmation message for the document upload (e.g., "Document uploaded successfully.").
errorsArray of StringsAny errors encountered during the upload process.
uploadedDocumentIdStringThe unique identifier assigned to the uploaded document.


Notes

  • Maintain secure storage of sensitive documents, adhering to compliance requirements.
  • Use the DocumentId for further actions related to the document, such as retrieval or deletion.




Payload Examples

Request

cURL Request Example

curl --request POST \
     --url https://api-sandbox.flexfactor.com/v1/onboarding/application/{application_id}/documents \
     --header 'Authorization: bearer {the token returned by /oauth2}' \
     --header 'accept: application/json' \
     --header 'content-type: multipart/form-data' \
     --form 'document=@"/path/to/document.pdf"' \
     --form 'documentType="ID"' \
     --form 'description="Uploaded government-issued ID"'

Response

JSON Example for a Successful Upload

{
   "status": "SUCCESS",
   "success": true,
   "result": "Document uploaded successfully.",
   "uploadedDocumentId": "document_789012",
   "errors": []
}

JSON Example for a Failed Upload

{
   "status": "FAILED",
   "success": false,
   "result": null,
   "uploadedDocumentId": null,
   "errors": [
       "Unsupported file format.",
       "Document size exceeds the maximum limit."
   ]
}

Example for Handling Errors

  • If the file format is not supported or the file size exceeds the limit, the API will return an appropriate error message.
  • If the bearer token is invalid or missing, the API will respond with an Unauthorized error.
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
  "errors": [
    "Unsupported file format."
  ]
}
HTTP/1.1 401 Unauthorized
Content-Type: application/json

{
  "errors": [
    "Authentication failed. Invalid bearer token."
  ]
}