> ## Documentation Index
> Fetch the complete documentation index at: https://docs.recoverbiz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Configuration

> Configure how the AI communicates — prompts, context files, and knowledge base.

Each sub-account's AI behavior is fully configurable through the API or the embedded Settings view.

## Update AI Prompt

`PATCH /accounts/:id/settings/prompt`

Configure how the AI communicates. There are two modes:

### Guided Mode

Configure individual sections that get combined into the final prompt:

<ParamField body="mode" type="string" required>
  Set to `guided`
</ParamField>

<ParamField body="role_persona" type="string">
  Who the AI is (e.g., "You are a friendly loan coordinator at {{company}}")
</ParamField>

<ParamField body="tone_voice" type="string">
  Communication style (e.g., "Professional but warm. Use simple language.")
</ParamField>

<ParamField body="response_style" type="string">
  Format and structure (e.g., "Keep messages under 160 characters when possible.")
</ParamField>

<ParamField body="conversation_rules" type="string">
  Behavioral constraints (e.g., "Never discuss interest rates.")
</ParamField>

<ParamField body="special_instructions" type="string">
  Specific actions (e.g., "Flag financial hardship mentions for human review.")
</ParamField>

```bash theme={null}
curl -X PATCH https://api.recoverbiz.com/v1/accounts/acc_8f3a1b2c/settings/prompt \
  -H "X-Partner-Key: pk_live_abc123def456..." \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "guided",
    "role_persona": "You are a friendly loan coordinator at {{company}}. You help borrowers complete their applications.",
    "tone_voice": "Professional but warm. Use simple language. Never be pushy or aggressive.",
    "response_style": "Keep messages under 160 characters when possible. Use casual punctuation.",
    "conversation_rules": "Never discuss interest rates or specific loan terms. Always direct rate questions to a human agent.",
    "special_instructions": "If the borrower mentions financial hardship, immediately flag for human review."
  }'
```

### Advanced Mode

Full prompt override — you control the entire system prompt:

```bash theme={null}
curl -X PATCH https://api.recoverbiz.com/v1/accounts/acc_8f3a1b2c/settings/prompt \
  -H "X-Partner-Key: pk_live_abc123def456..." \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "advanced",
    "system_prompt": "You are a loan coordinator at {{company}}. Your job is to help borrowers complete their applications by collecting required documents via text message. Be friendly, concise, and never discuss rates or terms."
  }'
```

<Info>
  In both modes, checklist requirements and company context are automatically appended to the prompt. You don't need to include document collection instructions manually.
</Info>

## Upload Context File

`POST /accounts/:id/context/files`

Upload knowledge base files (`.txt`, `.md`) that the AI references during conversations. Max 100KB per file.

```bash theme={null}
curl -X POST https://api.recoverbiz.com/v1/accounts/acc_8f3a1b2c/context/files \
  -H "X-Partner-Key: pk_live_abc123def456..." \
  -F "file=@company_faq.txt"
```

**Response: `201 Created`**

```json theme={null}
{
  "id": "ctx_001",
  "name": "company_faq.txt",
  "file_type": "txt",
  "file_size": 4520,
  "created_at": "2026-02-15T10:30:00Z"
}
```

## List Context Files

`GET /accounts/:id/context/files`

```json theme={null}
{
  "files": [
    { "id": "ctx_001", "name": "company_faq.txt", "file_type": "txt", "file_size": 4520 },
    { "id": "ctx_002", "name": "loan_products.md", "file_type": "md", "file_size": 8200 }
  ]
}
```

## Delete Context File

`DELETE /accounts/:id/context/files/:file_id`

## Add Context URL

`POST /accounts/:id/context/urls`

Point the AI at a web page. The content is scraped and kept in sync — if the page updates, the AI's knowledge updates automatically.

```bash theme={null}
curl -X POST https://api.recoverbiz.com/v1/accounts/acc_8f3a1b2c/context/urls \
  -H "X-Partner-Key: pk_live_abc123def456..." \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://acmelending.com/faq" }'
```

**Response: `201 Created`**

```json theme={null}
{
  "id": "url_001",
  "url": "https://acmelending.com/faq",
  "title": "FAQ - Acme Lending",
  "last_scraped_at": "2026-02-15T10:31:00Z"
}
```

## List Context URLs

`GET /accounts/:id/context/urls`

## Delete Context URL

`DELETE /accounts/:id/context/urls/:url_id`
