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

# Read a URL File as Text in Jinba Flow

> Fetch text, CSV, JSON, XML, YAML, or HTML from a direct URL with INPUT_FILE_AS_TEXT and use its contents in a flow.

Use `INPUT_FILE_AS_TEXT` when a flow needs the contents of a file available at a direct URL. The `value` input accepts one URL or an array of URLs. The result is the file content as text: one string for a single URL, or an array for multiple URLs. A one-element array returns one string.

## Fetch the file content

```yaml theme={null}
- id: read_file
  tool: INPUT_FILE_AS_TEXT
  input:
    - name: value
      value: "https://example.com/config.json"
    - name: description
      value: "Configuration to process"
```

Replace the URL with a reachable direct file URL. On success, inspect `result` for the text you expect. The file picker lists plain text, CSV, HTML, XML, JSON, and YAML types; this tool returns text rather than parsing those formats. `description` is optional. `use_as_input` defaults to `true`, and `optional` defaults to `false`.

## Use the returned text

A later step can consume the returned text directly; parse JSON or CSV explicitly when you need fields or rows:

```yaml theme={null}
- id: summarize_file
  tool: OPENAI_INVOKE
  needs: [read_file]
  input:
    - name: prompt
      value: |
        Summarize the content of this file. If it is CSV, identify its columns.
        {{steps.read_file.result}}
```

For a CSV workflow that needs parsed rows, use `INPUT_CSV_FILE` instead; see [Summarize a CSV file](/en/pages/tools/files/input#example-summarize-a-csv-file). Avoid putting API keys or other secrets from a configuration file into an AI prompt.

## Check a JSON configuration file

Parse the text in Python and check for required keys without printing their values:

```yaml theme={null}
- id: read_config
  tool: INPUT_FILE_AS_TEXT
  input:
    - name: value
      value: "https://example.com/config.json"

- id: check_config
  tool: PYTHON_SANDBOX_RUN
  needs: [read_config]
  input:
    - name: data_type
      value: OBJECT
    - name: code
      value: |
        import json

        text = r'''{{steps.read_config.result}}'''.strip()
        required = ["database_url", "api_key"]

        try:
            config = json.loads(text) if text else None
            error = None if isinstance(config, dict) else "Config must be a JSON object"
        except json.JSONDecodeError as e:
            config, error = None, f"Invalid JSON: {e}"

        missing = [key for key in required if not config.get(key)] if error is None else []

        print(json.dumps({"valid": error is None and not missing, "error": error, "missing": missing}))
```

`steps.check_config.result.data.valid` is `true` only when the file is a JSON object with every required key set. Otherwise `result.data.error` explains a parse problem or `result.data.missing` lists keys that are absent or empty. Edit `required` to match your file. To reject bad JSON sent to a published workflow instead, use [Input JSON with Validation](/en/pages/tools/validation/input).

## Check file input failures

If no URL is supplied, the step fails with “File URL is required.” A failed fetch reports its HTTP status. Check the URL, access permissions, and response status. A file larger than 100 MiB, a download that takes longer than 5 minutes, or more than 50 URLs in one step also fails the step (see [Download limits](/en/pages/tools/files/input#download-limits)). If `optional` is `true` and no URL is supplied, `result` is `null`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.