# Loan Application Sessions
> Loan Application Sessions let your customers apply for credit by completing Increase-hosted forms. Create a session and redirect your customer to the returned URL. When they're done, they'll be redirected back to your site.

## The Loan Application Session object
### Example
```json
{
  "created_at": "2020-01-31T23:59:59Z",
  "entity_id": "entity_n8y8tnk2p9339ti393yi",
  "expires_at": "2020-02-01T05:59:59+00:00",
  "id": "loan_application_session_un3dwu1nfktknfd89p8a",
  "idempotency_key": null,
  "program_id": "program_i2v2os4mwza1oetokh9i",
  "redirect_url": "https://example.com/loan-application/completed",
  "session_url": "https://onboarding.increase.com/loan_application/sessions?id=HIrdj46cXyyNqT5RDcIR38dzPqzRBgTdG84XwzOz",
  "status": "active",
  "type": "loan_application_session"
}
```
### Attributes
- `created_at` (string)
  The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Loan Application Session was created.

- `entity_id` (string, nullable)
  The identifier of the Entity associated with this session, if one has been created.

- `expires_at` (string)
  The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Loan Application Session will expire.

- `id` (string)
  The Loan Application Session's 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).

- `program_id` (string)
  The identifier of the Program the customer is applying to.

- `redirect_url` (string)
  The URL to redirect to after the session is complete. Increase will include the query parameters `loan_application_session_id` and `entity_id` when redirecting.

- `session_url` (string, nullable)
  The URL containing the loan application form. You should share this link with your customer. Only present when the session is active.

- `status` (enum)
  The status of the Loan Application Session.
  Cases:
  * `active` (The Loan Application Session is active.)
  * `expired` (The Loan Application Session has expired.)

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

## List Loan Application Sessions
GET /loan_application_sessions

### Example
```curl
curl \
  --url "${INCREASE_URL}/loan_application_sessions" \
  -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.

- `status.in` (array of enums, optional)
  Filter Loan Application Sessions for those with the specified status or statuses. For GET requests, this should be encoded as a comma-delimited string, such as `?in=one,two,three`.
  Cases:
  * `active` (The Loan Application Session is active.)
  * `expired` (The Loan Application Session has expired.)

- `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 Application Session List object:
```json
{
  "data": [
    {
      "created_at": "2020-01-31T23:59:59Z",
      "entity_id": "entity_n8y8tnk2p9339ti393yi",
      "expires_at": "2020-02-01T05:59:59+00:00",
      "id": "loan_application_session_un3dwu1nfktknfd89p8a",
      "idempotency_key": null,
      "program_id": "program_i2v2os4mwza1oetokh9i",
      "redirect_url": "https://example.com/loan-application/completed",
      "session_url": "https://onboarding.increase.com/loan_application/sessions?id=HIrdj46cXyyNqT5RDcIR38dzPqzRBgTdG84XwzOz",
      "status": "active",
      "type": "loan_application_session"
    }
  ],
  "next_cursor": "v57w5d"
}
```

## Create a Loan Application Session
POST /loan_application_sessions

### Example
```curl
curl -X "POST" \
  --url "${INCREASE_URL}/loan_application_sessions" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d $'{
    "entity_id": "entity_n8y8tnk2p9339ti393yi",
    "prefill_parameters": [
      {
        "key": "posh_group_identifier",
        "value": "applicant_12345"
      }
    ],
    "program_id": "program_i2v2os4mwza1oetokh9i",
    "redirect_url": "https://example.com/loan-application/session"
  }'
```

### Body Parameters
- `entity_id` (string, optional)
  The identifier of the customer Entity applying for credit. You typically create this Entity out of band.

- `prefill_parameters` (array of objects, optional)
  Values for the Program's application parameters that are not collected from the applicant in the session. You must provide a value for each such parameter.

  - `prefill_parameters.key` (string, required)
    The parameter's key.

  - `prefill_parameters.value` (string, required)
    The value for the parameter.

- `program_id` (string, required)
  The identifier of the Program the customer is applying to.

- `redirect_url` (string, required)
  The URL to redirect the customer to after they complete the loan application form. The redirect will include `loan_application_session_id` and `entity_id` query parameters.

## Retrieve a Loan Application Session
GET /loan_application_sessions/{loan_application_session_id}

### Example
```curl
curl \
  --url "${INCREASE_URL}/loan_application_sessions/loan_application_session_un3dwu1nfktknfd89p8a" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
```
### Path Parameters
- `loan_application_session_id` (string, required)
  The identifier of the Loan Application Session.

## Expire a Loan Application Session
POST /loan_application_sessions/{loan_application_session_id}/expire

### Example
```curl
curl -X "POST" \
  --url "${INCREASE_URL}/loan_application_sessions/loan_application_session_un3dwu1nfktknfd89p8a/expire" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
```
### Path Parameters
- `loan_application_session_id` (string, required)
  The identifier of the Loan Application Session to expire.