# Trust + Identity

`POST https://api.agilitycredit.net/v3/prefill/trust-and-identity`

Docs page: https://apidocs.agilitycredit.com/api/prefill-trust-and-identity · Tag: Prefill

Runs the **Trust Score** and, when it clears the threshold and none of the optional `abandon_prefill_reason_codes` matched, the **Identity Prefill** — in a single call. Identify the session with the `Agc-Session-Id` header returned from `POST /prefill/auth`. When trust fails, or a caller abandon code matches, the response stops after trust with `proceeded_to_prefill: false` and `completed: true`. On success, `identity` is returned and `completed` is `false` (Verify Standalone may follow). > **Note:** this endpoint runs billable identity verification calls. Send a **fresh** `Idempotency-Key` per attempt.

Authentication: `Authorization: Bearer <api key>`.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | header | yes | A unique, idempotent key. We recommend to use a guid |
| `Agc-Tenant-Id` | header | yes | The tenant ID provided by Agility Credit. |
| `Agc-User-Id` | header | yes | The requestor user ID. |
| `Agc-Session-Id` | header | yes | The prefill session identifier returned from Auth Initial (POST /prefill/auth). |

## Request body (`application/json`)

Optional prefill options (abandon codes / secret). Send `{}` to run with defaults.

Schema: `ProvePrefillRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `abandon_prefill_reason_codes` | array of string |  | Trust reason codes that should stop the flow before prefill runs. If any code returned by the trust score is in this list, prefill is skipped and the trust result is returned with `proceeded_to_prefill: false`. Common examples: `NO`, `LP`,… |
| `secret` | string |  | Optional shared secret. When it matches the secret supplied at Auth Initial, the response is signed with an `X-Agc-Signature` header. |

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Trust result, plus prefill identity when the flow proceeded | ProvePrefillResponse |
| 400 | Bad Request | BadRequestResponse |
| 401 | Unauthorized | UnauthorizedResponse |
| 403 | Forbidden | UnauthorizedResponse |
| 410 | Gone - the session expired or was not found. Restart with POST /prefill/auth. | BadRequestResponse |
| 429 | Too Many Requests | TooManyRequestsResponse |
| 500 | Internal Server Error | AgilityServerErrorResponse |
Top-level 200 fields: `session_id`, `trust_score`, `trust_passed`, `trust_threshold`, `trust_reason_codes`, `reason_code_details`, `proceeded_to_prefill`, `abandoned_reason_codes`, `identity`, `identity_challenge_required`, `completed`.

### Error bodies

400:

```json
{
  "status": "Bad Request - Invalid Parameters",
  "error": "Failed schema validation. Error: data.pull_type must be one of ['prequal', 'hard'], Path: ['data', 'pull_type'], Data: prequalification"
}
```

401:

```json
{
  "message": "Unauthorized"
}
```

403:

```json
{
  "message": "Unauthorized"
}
```

410:

```json
{
  "status": "Bad Request - Invalid Parameters",
  "error": "Failed schema validation. Error: data.pull_type must be one of ['prequal', 'hard'], Path: ['data', 'pull_type'], Data: prequalification"
}
```

429:

```json
{
  "error": "Too Many Requests"
}
```

500:

```json
{
  "message": "Agility Server Error"
}
```
