> ## Documentation Index
> Fetch the complete documentation index at: https://visaflo.ca/knowledge-base/llms.txt
> Use this file to discover all available pages before exploring further.

# Records

> Create and find leads, clients, and cases in your VisaFlo workspace.

## Use VisaFlo IDs

Each successful create returns a VisaFlo record ID. Save it and use it for later file uploads, task creation, notes, status updates, and lookups.

`caseId` is a VisaFlo record ID. It is not the human-readable `caseNumber` displayed in the dashboard.

## Leads

### Create a Lead

`POST /api/public/lead/create`

| Field                | Required | Description           |
| -------------------- | -------- | --------------------- |
| `firstName`          | Yes      | Lead's first name.    |
| `email`              | Yes      | Lead email.           |
| `lastName`           | No       | Lead's last name.     |
| `phone`              | No       | Phone number.         |
| `countryOfResidence` | No       | Country of residence. |

```json theme={null}
{
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane@example.com",
  "phone": "+1 555 0100",
  "countryOfResidence": "Canada"
}
```

### Search Leads

`GET /api/public/lead/search`

Pass at least one of `email` (exact match) or `name` (name prefix). Search before creating a lead when an upstream system can retry delivery.

## Clients

### Create a Client

`POST /api/public/client/create`

| Field       | Required | Description          |
| ----------- | -------- | -------------------- |
| `firstName` | Yes      | Client's first name. |
| `email`     | Yes      | Client email.        |
| `lastName`  | No       | Client's last name.  |
| `phone`     | No       | Phone number.        |

### Search Clients

`GET /api/public/client/search`

Pass `email` for an exact match or `name` for a name prefix. A search response includes the record values needed to decide whether to reuse the client.

## Cases

### Create a Case

`POST /api/public/case/create`

Case payloads vary by case type. Use the VisaFlo case-type payload format from **Settings** > **API Settings** when configuring a new case integration. Persist the returned case ID before making follow-on requests.

### Find a Case

`GET /api/public/case/search`

Provide at least one query parameter:

| Parameter     | Match type                                    |
| ------------- | --------------------------------------------- |
| `caseId`      | Exact VisaFlo record ID.                      |
| `caseNumber`  | Exact human-readable file/application number. |
| `clientEmail` | Exact client email.                           |

When you provide more than one parameter, VisaFlo applies all filters.

```bash theme={null}
curl "https://api.visaflo.app/api/public/case/search?clientEmail=jane@example.com" \
  -H "X-API-Key: YOUR_API_KEY"
```

### Read or Update a Case

| Method  | Endpoint                          | Purpose                                   |
| ------- | --------------------------------- | ----------------------------------------- |
| `GET`   | `/api/public/case/:caseId`        | Get a case with its client and assignees. |
| `PATCH` | `/api/public/case/:caseId/status` | Update the case status.                   |
