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

# Struct & Type Casting

> How the struct field shapes API responses and how Sixtyfour casts values to the types you expect.

Most Sixtyfour intelligence endpoints accept a `struct` field that defines exactly what data you want returned in `structured_data`. This guide explains how `struct` works and how the API resolves and casts types.

## How `struct` works

Each key in `struct` becomes a field in the response's `structured_data`, and its value tells the agent what to find. You can pass either a plain-English description or an object with `description` and `type`:

```json theme={null}
{
  "struct": {
    "email": "The individual's email address",
    "num_employees": {"description": "Approximate employee count", "type": "int"}
  }
}
```

The agent uses these descriptions to guide its research. Be specific — `"company's primary Instagram handle"` returns better results than `"social"`.

<Tip>For endpoints that support `struct` (e.g., [Company Intelligence](/api-reference/endpoint/company-intelligence), [People Intelligence](/api-reference/endpoint/people-intelligence), [QA Agent](/api-reference/endpoint/qa-agent)), only fields specified in `struct` appear in `structured_data`.</Tip>

## Type casting

The API automatically handles type casting with intelligent type preservation.

### Resolution priority

Type resolution follows this priority:

1. **Explicit type definitions** in `struct` (highest)
2. **Original input types** from the request body (e.g., `target_company`, `lead_info`, `data`)
3. **Inferred types** from example values in `struct`
4. **String** (default)

### Supported types

| Type                                | Example values                              |
| ----------------------------------- | ------------------------------------------- |
| `"str"` or `"string"`               | `"Pacific View Studios"`                    |
| `"int"` or `"integer"`              | `50`, `1000`                                |
| `"float"`                           | `95.5`, `3.14`                              |
| `"bool"` or `"boolean"`             | `true`, `false`                             |
| `"list"`                            | `["item1", "item2"]`                        |
| `"list[str]"`                       | `["item1", "item2"]`                        |
| `"list[int]"`                       | `[1, 2, 3]`                                 |
| `"list[float]"`                     | `[1.5, 2.7, 3.14]`                          |
| `"list[bool]"` or `"list[boolean]"` | `[true, false]`                             |
| `"dict"`                            | `"{\"key\": \"value\"}"` (stringified JSON) |

<Note>The `"dict"` type returns a stringified JSON value, not a nested typed object. Parse it client-side with `json.loads()` (Python) or `JSON.parse()` (JavaScript).</Note>

### Examples

**Type override** — explicit `type` in `struct` overrides the original input type:

```json theme={null}
{
  "lead_info": {"age": 30, "is_active": true},
  "struct": {
    "age": {"type": "str"},
    "location": "Current location"
  }
}
// Output: {"age": "30", "is_active": true, "location": "New York"}
```

**Explicit type definition** — useful when you want predictable shapes:

```json theme={null}
{
  "struct": {
    "age": {"description": "Person's age", "type": "int"},
    "is_verified": {"description": "Status", "type": "bool"}
  }
}
// Output: {"age": 30, "is_verified": true}
```

**Type inference from values** — types are inferred from the example values you pass:

```json theme={null}
{
  "struct": {
    "score": 95.5,
    "active": false,
    "count": 42
  }
}
```
