Cash-Advance Scores

The Insight Service exposes two cash-advance score endpoints, both served by the prod-insight-api Lambda. Scores are sourced from Pave and reflect the probability that a user will repay a cash advance within a given time window.

Endpoints

GET /{user_id}/scores/cash_advance

Returns the most recent cash-advance score for the user from the prod-pave DynamoDB scores entity. The score is written by the miner Lambda each time Pave insight mining runs for the user.

Data path:

Request → prod-insight-api
  └─▶ DynamoDB CashAdvanceScoreRepo.Get(user_id)
        ├─ found → 200 with score payload
        └─ not found → 404 (score not yet available; miner has not run for this user)

Response shape:

{
  "user_id": "<floatme_user_id>",
  "date": "2024-01-15T12:00:00Z",
  "scores": [
    {
      "score": 85,
      "highest_amount": 100,
      "lowest_amount": 25
    }
  ]
}

score is an integer representing the repayment probability percentage. Each entry in scores corresponds to an advance amount bracket — multiple entries represent the score at different loan amounts (in $25 increments per the Pave scoring model).

GET /{user_id}/scores/cash_advance_history

This endpoint is deprecated. Pave removed the underlying API it relied on. The endpoint remains in the spec and code for backwards compatibility but calls the Pave repayment scores API which is no longer supported.

Returns historical repayment probabilities across three time windows: 15d, 30d, and 45d. Unlike cash_advance, this endpoint calls Pave directly rather than reading from DynamoDB cache.

Response shape:

{
  "user_id": "<floatme_user_id>",
  "date": "2024-01-15",
  "scores": {
    "full_payment_15d": 0.82,
    "full_payment_30d": 0.88,
    "full_payment_45d": 0.91
  }
}

Score Lifecycle

Scores are populated by the miner Lambda as part of the Pave mining pipeline:

Pave mining (miner Lambda)
  ├─▶ Pave.GetCashAdvanceScore(user_id)
  └─▶ DynamoDB CashAdvanceScoreRepo.Save(user_id, scores)

The prod-insight-api Lambda reads the cached value from DynamoDB — it does not call Pave directly for GET /scores/cash_advance. This means scores are only as fresh as the last successful mining run for the user.

DynamoDB Entity

The scores entity in prod-pave stores the score data written by the miner. See DynamoDB Tables for the full key construction and attribute schema.