Get a document

This endpoint retrieves the details of a specific document attached to an application, identified by its unique application ID ({id}) and document ID ({documentID}). It provides metadata and a download URL for the document.






Request

Endpoint


Required keys

ParameterDescription
{id}The unique application identifier returned during application creation or listing endpoints.
{documentID}The unique identifier of the document, returned during document upload.

Body Parameters

This endpoint does not require body parameters.



Response

Field Definitions

Field NameTypeDescription
statusStringStatus of the API request (SUCCESS, FAILED).
successBooleanIndicates if the document retrieval was successful.
documentIdStringThe unique identifier of the document.
documentTypeStringType of the document (e.g., "ID", "ProofOfAddress", "BusinessLicense").
descriptionStringOptional description provided during document upload.
uploadedOnStringTimestamp of when the document was uploaded (ISO 8601 format).
fileNameStringOriginal file name of the uploaded document.
fileTypeStringMIME type of the document (e.g., application/pdf, image/jpeg).
fileSizeIntegerSize of the document in bytes.
downloadUrlStringA pre-signed URL to download the document. Valid for a limited time.
errorsArray of StringsAny errors encountered during the document retrieval process.


❗️

Notes

  • The downloadUrl is time-limited; use it promptly to download the document.
  • Ensure secure storage and handling of sensitive documents retrieved using this endpoint.





Payload Examples

Request

cURL Request Example

curl --request GET \
     --url https://api-sandbox.flexfactor.com/v1/onboarding/application/{application_id}/documents/{document_id} \
     --header 'Authorization: bearer {the token returned by /oauth2}' \
     --header 'accept: application/json'




Response

JSON Example for a Successful Retrieval

{
   "status": "SUCCESS",
   "success": true,
   "documentId": "document_789012",
   "documentType": "ID",
   "description": "Uploaded government-issued ID",
   "uploadedOn": "2024-11-16T10:00:00Z",
   "fileName": "gov_id.pdf",
   "fileType": "application/pdf",
   "fileSize": 524288,
   "downloadUrl": "https://api-sandbox.flexfactor.com/download/document_789012?token=xyz123",
   "errors": []
}

JSON Example for a Failed Retrieval

{
   "status": "FAILED",
   "success": false,
   "documentId": null,
   "documentType": null,
   "description": null,
   "uploadedOn": null,
   "fileName": null,
   "fileType": null,
   "fileSize": null,
   "downloadUrl": null,
   "errors": [
       "Document not found.",
       "Invalid application ID or document ID."
   ]
}


Example for Handling Errors

  • If the application ID or document ID is invalid, the API will return an error.
  • If the bearer token is unauthorized, the API will respond with an Unauthorized error.
HTTP/1.1 404 Not Found
Content-Type: application/json

{
  "errors": [
    "Document not found."
  ]
}
HTTP/1.1 401 Unauthorized
Content-Type: application/json

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