# Loan Purchases
> A Loan Purchase records the purchase of seasoned receivables on a loan Account, moving funds out of a source Account.

[Events](https://increase.com/documentation/webhooks.md) will be generated for this resource. The possible event categories are: `loan_purchase.created`.

## The Loan Purchase object
### Example
```json
{
  "amount": 100,
  "created_at": "2020-01-31T23:59:59Z",
  "id": "loan_purchase_998w3thud40bt7uxop2s",
  "idempotency_key": null,
  "loan_account_id": "account_in71c4amph0vgo2qllky",
  "source_account_id": "account_in71c4amph0vgo2qllky",
  "transaction_id": "transaction_uyrp7fld2ium70oa7oi",
  "type": "loan_purchase"
}
```
### Attributes
- `amount` (integer)
  The amount of the purchase in the minor unit of the currency. For dollars, this is cents.

- `created_at` (string)
  The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Loan Purchase was created.

- `id` (string)
  The Loan Purchase identifier.

- `idempotency_key` (string, nullable)
  The idempotency key you chose for this object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about [idempotency](https://increase.com/documentation/idempotency-keys).

- `loan_account_id` (string)
  The identifier of the loan Account whose receivables were purchased.

- `source_account_id` (string)
  The identifier of the Account that funded the purchase.

- `transaction_id` (string, nullable)
  The identifier of the Transaction created on the source Account.

- `type` (string)
  A constant representing the object's type. For this resource it will always be `loan_purchase`.

## List Loan Purchases
GET /loan_purchases

### Example
```curl
curl \
  --url "${INCREASE_URL}/loan_purchases" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
```

### Query Parameters
- `cursor` (string, optional)
  Return the page of entries after this one.

- `limit` (integer, optional)
  Limit the size of the list that is returned. The default (and maximum) is 100 objects.
  Default: `100`

- `idempotency_key` (string, optional)
  Filter records to the one with the specified `idempotency_key` you chose for that object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about [idempotency](https://increase.com/documentation/idempotency-keys).

### Returns a Loan Purchase List object:
```json
{
  "data": [
    {
      "amount": 100,
      "created_at": "2020-01-31T23:59:59Z",
      "id": "loan_purchase_998w3thud40bt7uxop2s",
      "idempotency_key": null,
      "loan_account_id": "account_in71c4amph0vgo2qllky",
      "source_account_id": "account_in71c4amph0vgo2qllky",
      "transaction_id": "transaction_uyrp7fld2ium70oa7oi",
      "type": "loan_purchase"
    }
  ],
  "next_cursor": "v57w5d"
}
```

## Create a Loan Purchase
POST /loan_purchases

### Example
```curl
curl -X "POST" \
  --url "${INCREASE_URL}/loan_purchases" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d $'{
    "amount": 100,
    "loan_account_id": "account_in71c4amph0vgo2qllky",
    "source_account_id": "account_in71c4amph0vgo2qllky"
  }'
```

### Body Parameters
- `amount` (integer, required)
  The amount to purchase in the minor unit of the currency. For dollars, this is cents.

- `loan_account_id` (string, required)
  The identifier of the loan Account whose receivables are being purchased.

- `source_account_id` (string, required)
  The identifier of the Account funding the purchase.

## Retrieve a Loan Purchase
GET /loan_purchases/{loan_purchase_id}

### Example
```curl
curl \
  --url "${INCREASE_URL}/loan_purchases/loan_purchase_998w3thud40bt7uxop2s" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
```
### Path Parameters
- `loan_purchase_id` (string, required)
  The identifier of the Loan Purchase.