Skip to content

read_file

Read the contents of any file from a Bridge Town project. The path is project-relative (e.g. ‘README.md’, ‘model/revenue.py’, ‘data/seed.csv’, ‘assets/logo.png’). Specify branch to read from a non-default branch (e.g. a scenario branch). Omitting branch, passing an empty string, or passing null all resolve to the project’s default branch. Passing the branch name explicitly is equivalent. encoding controls how the file is returned: ‘auto’ sniffs the file and returns ‘text’ for UTF-8 or ‘base64’ for binary; ‘text’ always decodes as UTF-8; ‘base64’ always returns base64-encoded bytes. Returns: path (str) — file path; project (str) — project name; content (str) — file content (text or base64); encoding (str) — ‘text’ or ‘base64’; sha (str) — blob SHA for optimistic concurrency control (pass as expected_sha to update_file or delete_file); size_bytes (int) — raw byte size of the file.

read-only · idempotent

NameTypeRequiredDefaultDescription
project_namestrYes
pathstrYes
encodingstrNo'auto'
branch`strNone`NoNone

Returns a structured object. Top-level fields:

  • path (string)
  • project (string)
  • content (string)
  • encoding (string)
  • sha (string)
  • size_bytes (integer)

See the response example below for the full payload shape.

{
"name": "read_file",
"arguments": {
"project_name": "forecasts",
"path": "model/revenue.py"
}
}
{
"path": "model/revenue.py",
"project": "forecasts",
"content": "import pandas as pd\n\ndef run(inputs):\n ...\n",
"encoding": "text",
"sha": "abc1234def5678901234567890abcdef12345678",
"size_bytes": 482
}
  • Module: Models
  • Requires authentication via API token or Auth0 JWT.