AltScore
Borrower Central (BC)

Borrower Fields API

This API allows managing custom fields associated with borrowers in the system. It provides endpoints to create, read, update, and delete borrower fields, as well as to perform queries and searches on these fields.

BorrowerField Object

The BorrowerField object represents a custom field associated with a borrower.

JSON Example:

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "key": "income",
  "label": "Annual Income",
  "value": 50000,
  "dataType": "number",
  "tags": ["financial", "yearly"],
  "history": [
    {
      "referenceId": "form123",
      "value": 50000,
      "updatedAt": "2023-01-01T00:00:00Z"
    }
  ],
  "createdAt": "2023-01-01T00:00:00Z",
  "updatedAt": "2023-01-01T00:00:00Z"
}

Attributes

AttributeDescriptionType
idUnique identifier of the fieldString
borrowerIdAssociated borrower's IDString
keyKey or name of the fieldString
labelDescriptive label of the field (optional)String
valueValue of the fieldAny
dataTypeData type of the valueString
tagsTags associated with the fieldArray of String
historyHistory of field valuesArray of Object
createdAtDate and time of field creationString (ISO 8601)
updatedAtDate and time of the last field updateString (ISO 8601)

Available Operations

Create a Borrower Field

Creates a new borrower field in the system.

POST /v1/borrower-fields

Input Parameters:

ParameterDescriptionTypeRequired
borrowerIdBorrower's IDStringYes
formIdForm ID (optional)StringNo
referenceIdReference ID (optional)StringNo
keyKey or name of the fieldStringYes
valueValue of the fieldAnyYes
dataTypeData type of the valueStringYes
tagsTags associated with the fieldArray of StringNo

Request Example:

{
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "formId": "form123",
  "key": "income",
  "value": 50000,
  "dataType": "number",
  "tags": ["financial", "yearly"]
}

Successful Response:

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

Update a Borrower Field

Updates an existing borrower field.

PATCH /v1/borrower-fields/:field_id

Path Parameters:

ParameterDescription
field_idID of the field to update

Input Parameters:

ParameterDescriptionTypeRequired
borrowerIdBorrower's IDStringYes
formIdForm ID (optional)StringNo
referenceIdReference ID (optional)StringNo
valueNew value of the fieldAnyYes
tagsNew tags associated with the fieldArray of StringNo

Request Example:

{
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "referenceId": "form124",
  "value": 55000,
  "tags": ["financial", "yearly", "updated"]
}

Successful Response:

The response will be the updated BorrowerField object.

Get a Borrower Field

Retrieves information of a specific borrower field.

GET /v1/borrower-fields/:field_id

Path Parameters:

ParameterDescription
field_idID of the field to retrieve

Successful Response:

The response will be the complete BorrowerField object.

Delete a Borrower Field

Deletes a borrower field from the system.

DELETE /v1/borrower-fields/:field_id

Path Parameters:

ParameterDescription
field_idID of the field to delete

Successful Response:

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

List Borrower Fields

Retrieves a paginated list of borrower fields with filtering and sorting options.

GET /v1/borrower-fields

Query Parameters:

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

Successful Response:

The response will be a paginated list of BorrowerField objects.

[Query] Get Existing Values of a Borrower Field

GET /v1/borrower-fields/queries/count-distinct-values

Query Parameters:

ParameterDescriptionType
keyKey of the field to query (mandatory)String

Successful Response:

The response will be the set of all values present in the queried model.

[Command] Update All X Values of a Borrower Field to a Y Value

POST /v1/borrower-fields/commands/bulk-update-values

Input Parameters

ParameterDescriptionTypeRequired
keyField keyStringYes
currentValueValue to be replacedStringYes
targetValueNew valueStringYes

Request Example:

{
  "key": "nationality",
  "currentValue": "mexican",
  "targetValue": "MX"
}

Successful Response:

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

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.