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

# Result Schema

> Use resultSchema to shape the JSON returned when a case completes.

`resultSchema` tells Offload what structure you want in the final `result` field when a case completes successfully.

## What The API Validates

The create-case handler only validates that `resultSchema` is an object.

It does not currently validate:

* whether the object is a complete JSON Schema document
* whether the schema is internally consistent
* whether every required field is realistically extractable from the conversation

Use a JSON Schema-shaped object anyway, but treat validation as best-effort prompt guidance rather than strict schema enforcement.

## Good Example

```json theme={null}
{
  "type": "object",
  "properties": {
    "signedW9Received": { "type": "boolean" },
    "taxId": { "type": "string" },
    "receivedAt": { "type": "string" }
  },
  "required": ["signedW9Received"]
}
```

## Good Schema Design Rules

* Keep the schema focused on data your application will actually use.
* Prefer explicit booleans and strings over vague free-form blobs.
* Use optional properties for data that may not always be available.
* Put workflow instructions in `goal` or `constraints`, not in the schema.

## What Not To Put In The Schema

* attachment download URLs
* raw file bytes
* instructions like "follow up twice"
* fields that can only be known from internal business systems

Attachments already flow through the top-level `attachments` array.

## Useful Patterns

### Document Collection

```json theme={null}
{
  "type": "object",
  "properties": {
    "received": { "type": "boolean" },
    "documentType": { "type": "string" },
    "receivedAt": { "type": "string" }
  },
  "required": ["received"]
}
```

### Scheduling Confirmation

```json theme={null}
{
  "type": "object",
  "properties": {
    "confirmed": { "type": "boolean" },
    "scheduledTime": { "type": "string" },
    "timezone": { "type": "string" }
  },
  "required": ["confirmed"]
}
```

### Invoice Follow-Up

```json theme={null}
{
  "type": "object",
  "properties": {
    "invoiceReceived": { "type": "boolean" },
    "invoiceNumber": { "type": "string" },
    "amount": { "type": "string" }
  },
  "required": ["invoiceReceived"]
}
```

## Practical Advice

* Start with a small schema.
* Add fields only when you can act on them downstream.
* Expect `result` to be absent until the case reaches `COMPLETED`.
* Be prepared for schema-shaped output quality to depend on the conversation quality and the clarity of your requested fields.
