AltScore
Borrower Central (BC)/Information storage

Package API

This API allows you to manage packages in the system. It provides endpoints to create, read, update, and delete packages, as well as perform specific operations like marking packages as stale and managing attachments.

Data packages are used to store structured or unstructured information in the system. They can store reports, documents, external data, and more.

The Package Object

The Package object represents a content package in the system.

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "borrowerId": "789e4567-e89b-12d3-a456-426614174111",
  "dealId": "321e4567-e89b-12d3-a456-426614174333",
  "assetId": "654e4567-e89b-12d3-a456-426614174444",
  "sourceId": "456e4567-e89b-12d3-a456-426614174222",
  "alias": "monthly_report",
  "workflowId": "workflow123",
  "label": "Monthly Report",
  "contentType": "json",
  "tags": ["report", "monthly"],
  "createdAt": "2023-04-01T12:00:00Z",
  "ttl": "2023-04-08T12:00:00Z",
  "hasAttachments": true,
  "forcedStale": false
}

Attributes

AttributeDescriptionType
idUnique identifier for the packageString
borrowerIdAssociated borrower's ID (optional)String
dealIdAssociated deal's ID (optional)String
assetIdAssociated asset's ID (optional)String
sourceIdSource ID of the package (optional)String
aliasAlias for the package (optional)String
workflowIdAssociated workflow ID (optional)String
labelPackage label or nameString
contentTypeType of content in the packageString
tagsList of tags associated with the packageArray of Strings
createdAtPackage creation date and timeString (ISO 8601)
ttlTime-to-live for the package (optional)String (ISO 8601)
hasAttachmentsIndicates whether the package has attachmentsBoolean
forcedStaleIndicates whether the package is marked as stale. Stale packages are excluded from queries by default.Boolean

Available Operations

Create a New Package

Creates a new package in the system.

POST /v1/stores/packages

Input Parameters

ParameterDescriptionTypeRequired
borrowerIdAssociated borrower's IDStringNo
dealIdAssociated deal's IDStringNo
assetIdAssociated asset's IDStringNo
sourceIdSource ID of the packageStringNo
workflowIdAssociated workflow IDStringNo
aliasAlias for the packageStringNo
labelLabel or name of the packageStringNo
tagsList of tags for the packageArray of StringsNo
contentContent of the packageAnyYes
contentTypeType of content in the packageStringNo
ttlMinutesTime-to-live for the package in minutesIntegerNo

Example Request

{
  "borrowerId": "789e4567-e89b-12d3-a456-426614174111",
  "dealId": "321e4567-e89b-12d3-a456-426614174333",
  "assetId": "654e4567-e89b-12d3-a456-426614174444",
  "sourceId": "456e4567-e89b-12d3-a456-426614174222",
  "alias": "monthly_report",
  "label": "Monthly Report",
  "tags": ["report", "monthly"],
  "content": {"data": "report content"},
  "contentType": "json",
  "ttlMinutes": 10080
}

Successful Response

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

Retrieve a Package

Gets details about a specific package.

GET /v1/stores/packages/:package_id

Path Parameters

ParameterDescription
package_idID of the package

Successful Response

Returns the full Package object, as described above.

Retrieve Package Content

Gets the content of a specific package.

GET /v1/stores/packages/:package_id/content

Path Parameters

ParameterDescription
package_idID of the package

Successful Response

Returns the package's content in the format specified by its contentType.

Delete a Package

Deletes a package from the system.

DELETE /v1/stores/packages/:package_id

Path Parameters

ParameterDescription
package_idID of the package

Successful Response

HTTP status code 204 (No Content) if deletion is successful.

Mark Packages as Stale

Marks packages matching specified criteria as stale. Stale packages are excluded from query results by default, making this useful for invalidating cached data without deleting it.

PUT /v1/stores/packages/stale

Input Parameters

ParameterDescriptionTypeRequired
packageIdID of a specific package to markStringNo*
aliasMark packages with this aliasStringNo*
workflowIdMark packages for this workflowStringNo*
borrowerIdMark packages for this borrowerStringNo*
dealIdMark packages for this dealStringNo*
assetIdMark packages for this assetStringNo*
sourceIdMark packages from this sourceStringNo*
forcedStaleMust be set to trueBooleanYes

*At least one filter parameter must be provided. When packageId is provided, it marks only that specific package. When using other filters, validation requires a combination of identifiers (e.g., borrowerId, dealId, or assetId along with alias, workflowId, and sourceId).

Example Request - Mark by Package ID

{
  "packageId": "123e4567-e89b-12d3-a456-426614174000",
  "forcedStale": true
}

Example Request - Mark by Multiple Criteria

{
  "alias": "monthly_report",
  "workflowId": "workflow123",
  "borrowerId": "789e4567-e89b-12d3-a456-426614174111",
  "sourceId": "456e4567-e89b-12d3-a456-426614174222",
  "forcedStale": true
}

Successful Response

HTTP status code 204 (No Content) if the update is successful.

List Packages

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

GET /v1/stores/packages

Stale Package Filtering: By default, packages marked as stale (forcedStale: true) are excluded from query results. To include stale packages in the results, use the include-stale=true query parameter.

Query Parameters

ParameterDescriptionTypeDefault
searchText to search within packagesString
pagePage numberInteger1
per-pageItems per pageInteger10
borrower-idFilter by borrower IDString
deal-idFilter by deal IDString
asset-idFilter by asset IDString
workflow-idFilter by workflow IDString
source-idFilter by source IDString
aliasFilter by aliasString
source-versionFilter by source versionString
from-dateFilter by start dateString
to-dateFilter by end dateString
sort-byField to sort byString
sort-directionSort direction (asc or desc)Stringdesc
include-staleInclude stale packages in resultsBooleanfalse

Successful Response

The response will be a paginated list of Package objects. The total count is returned in the X-Total-Count response header.

Add Attachment to a Package

Adds an attachment to an existing package.

POST /v1/stores/packages/:package_id/attachments

Path Parameters

ParameterDescription
package_idID of the package

Input Parameters

ParameterDescriptionTypeRequired
urlURL of the attachmentStringYes
labelLabel for the attachmentStringNo
fileExtensionFile extensionStringNo
metadataAdditional metadata for the fileObjectNo

Example Request

{
  "url": "https://example.com/attachment.pdf",
  "label": "Supporting Document",
  "fileExtension": "pdf",
  "metadata": {
    "description": "Additional information for the monthly report"
  }
}

Successful Response

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

Retrieve Package Attachments

Retrieves the list of attachments for a specific package.

GET /v1/stores/packages/:package_id/attachments

Path Parameters

ParameterDescription
package_idID of the package

Successful Response

The response will be a list of Attachment objects associated with the package.

Delete an Attachment from a Package

Deletes a specific attachment from a package.

DELETE /v1/stores/packages/:package_id/attachments/:attachment_id

Path Parameters

ParameterDescription
package_idID of the package
attachment_idID of the attachment

Successful Response

HTTP status code 204 (No Content) if the deletion is 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.