# Read the text

> Reads the text inside the document, free. A scan or a photo has none, so it says the document is scanned, and an AI agent step after it can read the file itself.

Source: https://docs.go-lumen.ai/reference/steps/read-text

## At a glance

| Property | Value |
| --- | --- |
| **Step name** | `read-text` |
| **Resource** | ClusterStep (`lumen.ai/v1alpha1`) |
| **Palette group, category** | read, files |
| **Credits** | **1** credit each time it succeeds |
| **Side effects** | no |
| **Installation must provide** | nothing |

## Inputs

| Property | Value |
| --- | --- |
| **Needs** | `file` |
| **Produces** | `text` |
| **Works on** | item: one document at a time |

Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See [Documents and data](https://docs.go-lumen.ai/concepts/how-flows-run.md#documents-and-data).

## Outputs

A later node references an output as `{nodeId.field}` in text, or `nodeId.field` in a condition.

| Output | Type |
| --- | --- |
| `text` | string |
| `scanned` | boolean |

## Settings

Set under `config:` on the flow node. Text settings may contain `{nodeId.field}` placeholders.

| Setting | Type | Default | Description |
| --- | --- | --- | --- |
| `fallback` | string | `"none"` | Fallback is what happens to a scan or a photo, which has no text inside: none (the default) passes it on with no text and scanned true, for an AI agent step to read the file itself; ocr reads it with OCR, not available yet. (one of none, ocr) |
| `pages` | boolean |  | Pages marks where each page of a PDF starts, a line \[\[page N\]\] before it, in reading order, so what reads the text after can say which page a passage is on (Lighthouse citations). Off keeps the text as it always was. |

The full JSON Schema of these settings: [read-text.schema.json](https://docs.go-lumen.ai/schemas/steps/read-text.schema.json).

## Use it in a flow

A node that runs `read-text` goes under `spec.nodes` of a [Flow](https://docs.go-lumen.ai/concepts/how-flows-run.md#the-flow-as-yaml). Give it any id, and list the next node ids in next.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: read-text-example
  namespace: tenant-acme
spec:
  displayName: "Read the text"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [read-text]
  nodes:
    - id: read-text
      stepRef: {name: read-text}
```
