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
environment | HTTP method | endpoint |
---|---|---|
Sandbox testing | POST | https://api-sandbox.flex-charge.com/v1/onboarding/application/{id}/documents |
Production environment | POST | https://api.flex-charge.com/v1/onboarding/application/{id}/documents |
Required keys
Parameter | Description |
---|---|
{id} | The unique application identifier returned during application creation or listing endpoints. |
bearer token | The auth token returned by /oauth2/token |
Body
Field Name | Type | Required | Description |
---|---|---|---|
document | File | Yes | The file to be uploaded. Must conform to accepted formats and size limits. |
documentType | String | Yes | Specifies the type of document being uploaded (e.g., "ID" , "ProofOfAddress" , "BusinessLicense" ). |
description | String | Optional | An optional description or note about the document. |
Accepted Document Formats
- JPEG
- PNG
- XSL
- CSV
- DOC
Size Limits
- Maximum size per file: 10MB
Response
Field Definitions
Field Name | Type | Description |
---|---|---|
status | String | Status of the upload request (SUCCESS , FAILED ). |
success | Boolean | Indicates if the document upload was successful. |
result | String | A confirmation message for the document upload (e.g., "Document uploaded successfully."). |
errors | Array of Strings | Any errors encountered during the upload process. |
uploadedDocumentId | String | The 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."
]
}
Updated 2 days ago