AltScore
Borrower Central (BC)

Metrics API

This API allows managing metrics in the system. It provides endpoints to create, read, update, and delete metrics, as well as to perform queries and filtering on them.

The Metric Object

The Metric object represents a metric in the system.

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "key": "credit_score",
  "label": "Credit Score",
  "value": 750,
  "dataType": "number",
  "history": [
    {
      "referenceId": "ref123",
      "executionId": "exec456",
      "value": 750,
      "updatedAt": "2023-04-01T12:00:00Z"
    }
  ],
  "tags": ["credit", "risk"],
  "createdAt": "2023-01-01T00:00:00Z",
  "updatedAt": "2023-04-01T12:00:00Z"
}

Attributes

AttributeDescriptionType
idUnique identifier of the metricString
borrowerIdAssociated borrower ID (optional)String
keyUnique key of the metricString
labelDescriptive label of the metricString
valueCurrent value of the metricAny
dataTypeData type of the metric (string, number)String
historyHistory of metric valuesArray of Object
tagsTags associated with the metricArray of String
createdAtCreation date and time of the metricString (ISO 8601)
updatedAtDate and time of the last updateString (ISO 8601)

Available Operations

Create a New Metric

Creates a new metric in the system.

POST /v1/metrics

Input Parameters:

ParameterDescriptionTypeRequired
borrowerIdAssociated borrower IDStringNo
referenceIdReference IDStringNo
executionIdExecution IDStringNo
keyUnique key of the metricStringYes
valueValue of the metricStringYes
dataTypeData type of the metricStringNo
tagsTags associated with the metricArray of StringNo

Request Example:

{
  "borrowerId": "789e4567-e89b-12d3-a456-426614174001",
  "key": "credit_score",
  "value": "750",
  "tags": ["credit", "risk"]
}

Successful Response:

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

Update an Existing Metric

Updates an existing metric in the system.

PATCH /v1/metrics/:metric_id

Path Parameters:

ParameterDescription
metric_idID of the metric

Input Parameters:

ParameterDescriptionTypeRequired
borrowerIdAssociated borrower IDStringNo
referenceIdReference IDStringNo
executionIdExecution IDStringNo
valueNew value of the metricStringNo
dateDate of the updateStringNo
tagsNew tags associated with the metricArray of StringNo

Request Example:

{
  "value": "780",
  "tags": ["credit", "risk", "updated"]
}

Successful Response:

Returns the updated Metric object.

Retrieve a Metric

Retrieves information of a specific metric.

GET /v1/metrics/:metric_id

Path Parameters:

ParameterDescription
metric_idID of the metric

Successful Response:

Returns the complete Metric object.

Delete a Metric

Deletes a metric from the system.

DELETE /v1/metrics/:metric_id

Path Parameters:

ParameterDescription
metric_idID of the metric

Successful Response:

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

List Metrics

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

GET /v1/metrics

Query Parameters:

ParameterDescriptionType
borrower-idFilter by borrower IDString
keyFilter by metric keyString
searchText to search in metricsString
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:

Paginated list of Metric objects.

Error Handling

The API may return the following error codes:

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

Errors will include a descriptive message in the response body.

On this page