AltScore
Borrower Central (BC)

Documents API

This API allows managing documents in the system. It provides endpoints to create, read, update, and delete documents, as well as to handle their attachments.

The Document Object

The Document object represents a document in the system.

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "key": "identification",
  "label": "Identification Document",
  "value": "123456789",
  "tags": ["personal", "verified"],
  "createdAt": "2023-01-01T00:00:00Z",
  "updatedAt": "2023-01-01T00:00:00Z",
  "hasAttachments": true
}

Attributes

AttributeDescriptionType
idUnique identifier of the documentString
borrowerIdID of the borrower associated with the documentString
keyKey identifying the type of documentString
labelDescriptive label of the documentString
valueValue associated with the documentAny
tagsTags associated with the documentArray of String
createdAtDocument creation date and timeString (ISO 8601)
updatedAtLast update date and timeString (ISO 8601)
hasAttachmentsIndicates if the document has attachmentsBoolean

Available Operations

Create a New Document

Creates a new document in the system.

POST /v1/documents

Input Parameters

ParameterDescriptionTypeRequired
borrowerIdID of the borrower associated with the documentStringYes
keyKey identifying the type of documentStringYes
valueValue associated with the documentAnyNo
tagsTags associated with the documentArray of StringNo

Request Example

{
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "key": "identification",
  "value": "123456789",
  "tags": ["personal", "verified"]
}

Successful Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000"
}

Update a Document

Updates an existing document.

PATCH /v1/documents/:document_id

Path Parameters

ParameterDescription
:document_idID of the document to update

Input Parameters

ParameterDescriptionTypeRequired
keyNew document keyStringNo
valueNew value associated with the documentAnyNo
tagsNew tags associated with the documentArray of StringNo

Request Example

{
  "value": "987654321",
  "tags": ["personal", "verified", "updated"]
}

Successful Response

Returns the updated Document object.

Retrieve a Document

Retrieves the information of a specific document.

GET /v1/documents/:document_id

Path Parameters

ParameterDescription
:document_idID of the document to retrieve

Successful Response

Returns the complete Document object.

Delete a Document

Deletes a document from the system.

DELETE /v1/documents/:document_id

Path Parameters

ParameterDescription
:document_idID of the document to delete

Successful Response

Status code 204 (No Content) if the deletion was successful.

List Documents

Retrieves a paginated list of documents with filtering and sorting options.

GET /v1/documents

Query Parameters

ParameterDescriptionType
borrower-idFilter by borrower IDString
searchText to search in documentsString
pagePage number (default: 1)Integer
per-pageItems per page (default: 10)Integer
keyFilter by document keyString
sort-byField to sort byString
sort-directionSorting direction (asc or desc)String

Successful Response

Paginated list of Document objects.

Add an Attachment to a Document

Adds a new attachment to an existing document.

POST /v1/documents/:document_id/attachments

Path Parameters

ParameterDescription
:document_idID of the document to add attachment to

Input Parameters

ParameterDescriptionTypeRequired
urlURL of the attached fileStringYes
labelDescriptive label of the attachmentStringNo
fileExtensionFile extensionStringNo
metadataMetadata associated with the attachmentObjectNo

Request Example

{
  "url": "https://example.com/file.pdf",
  "label": "Identity Document",
  "fileExtension": "pdf",
  "metadata": {
    "size": 1024,
    "pageCount": 2
  }
}

Successful Response

Status code 201 (Created) if the attachment was successfully added.

Upload an Attachment to a Document

Uploads a file as an attachment to an existing document.

POST /v1/documents/:document_id/attachments/upload

Path Parameters

ParameterDescription
:document_idID of the document to upload attachment to

Form Parameters

ParameterDescriptionTypeRequired
fileFile to uploadFileYes
labelDescriptive label of the attachmentStringNo
metadataMetadata in JSON formatStringNo

Successful Response

Status code 201 (Created) if the file was successfully uploaded.

Retrieve Attachments of a Document

Retrieves the list of attachments associated with a document.

GET /v1/documents/:document_id/attachments

Path Parameters

ParameterDescription
:document_idID of the document to retrieve attachments from

Successful Response

List of Attachment objects associated with the document.

Delete an Attachment from a Document

Deletes a specific attachment from a document.

DELETE /v1/documents/:document_id/attachments/:attachment_id

Path Parameters

ParameterDescription
:document_idID of the document
:attachment_idID of the attachment to delete

Successful Response

Status code 204 (No Content) if the attachment was successfully deleted.

Error Handling

The API may return the following error codes:

CodeDescription
400Bad Request
401Unauthorized
403Forbidden
404Not Found
500Internal Server Error

Errors will include a descriptive message in the response body.