AltScore
Borrower Central (BC)/Information storage

Secrets API

This API allows managing secrets in the system. It provides endpoints to create, read, update, and delete secrets, as well as special handling for the "workflows" secret.

The base path for all endpoints of this API is /v1/stores/secrets.

The Secret Object

The Secret object represents a secret stored in the system.

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "secret": {
    "API_KEY": "your-api-key-here",
    "DATABASE_PASSWORD": "your-database-password-here"
  }
}

Attributes

AttributeDescriptionType
idUnique identifier of the secretString
secretObject containing the key-value pairs of the secretObject

Available Operations

Create a New Secret

Creates a new secret in the system.

POST /v1/stores/secrets

Input Parameters

ParameterDescriptionTypeRequired
idCustom identifier for the secretStringNo
secretObject containing the key-value pairs of the secretObjectYes
ttlMinutesLifetime of the secret in minutesIntegerNo
toDeleteAtDate and time to delete the secretStringNo

Request Example

{
  "id": "my-secret",
  "secret": {
    "API_KEY": "my-api-key-12345",
    "DATABASE_URL": "postgresql://user:password@localhost/dbname"
  },
  "ttlMinutes": 1440,
  "toDeleteAt": "2023-12-31T23:59:59Z"
}

Successful Response

{
  "id": "my-secret"
}

Update an Existing Secret

Updates an existing secret in the system. You can update one or more key-value pairs of the secret. Non-existent values will be added, existing values will be updated.

PATCH /v1/stores/secrets/:secret_id

Path Parameters

ParameterDescription
secret_idID of the secret to update

Input Parameters

ParameterDescriptionTypeRequired
secretObject containing the key-value pairs to updateObjectYes

Request Example

{
  "secret": {
    "NEW_API_KEY": "new-api-key-67890"
  }
}

Successful Response

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

Get a Secret

Retrieves the information of a specific secret.

GET /v1/stores/secrets/:secret_id

Path Parameters

ParameterDescription
secret_idID of the secret to retrieve

Successful Response

{
  "id": "my-secret",
  "secret": {
    "API_KEY": "my-api-key-12345",
    "DATABASE_URL": "postgresql://user:password@localhost/dbname",
    "NEW_API_KEY": "new-api-key-67890"
  }
}

Delete a Secret

Deletes a secret from the system.

DELETE /v1/stores/secrets/:secret_id

Path Parameters

ParameterDescription
secret_idID of the secret to delete

Successful Response

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

Error Handling

The API may return the following error codes:

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

Additional Notes

  • There is a special secret called "workflows" used to store secrets that will be set as environment variables in the workflow execution environment. Only the "workflow" itself can read the full workflow secret, not even the user can do so.
  • It is not possible to delete the "workflows" secret.
  • There are reserved keys that cannot be used as secret keys: ALTSCORE_CLIENT_ID and ALTSCORE_CLIENT_SECRET.