Get app code files

Changed on

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Returns the text of up to 32 files in the app's source in one call.

Get paths from List app code files. files is keyed by each path as Base44 normalized it, so ./src/App.jsx comes back as src/App.jsx, and a path you send twice comes back once. Each file holds either its content or an error, so one unreadable file doesn't fail the call. Only UTF-8 text files up to 5 MB can be read.

max_bytes caps the total size of the files returned. Files are read in the order you send them, and a file that would take the total over max_bytes comes back with the error batch_limit_exceeded and no content, while later files that still fit are read. Read the ones left out in another call. The other errors are file_not_found, file_too_large for a file over 5 MB, not_text for a folder or a file that isn't UTF-8 text, file_forbidden, invalid_path and file_read_failed.

A path outside the app, the app root, the app's .git folder and .agents/.env fail the whole call rather than a single file.

Reads come from the app's live sandbox, the same files the app editor shows, including changes that haven't been published yet. If no sandbox is running, the call starts one, so the first call after a quiet period takes noticeably longer than later ones.

Internally this route can follow a feature branch, but the parameter that selects one isn't part of the public API, so reads come from the app's main line.

This is limited to 120 requests per minute per app for each workspace's personal API keys, so every key in a workspace shares one allowance. Some workspaces have a different limit.

<Note>This endpoint accepts a personal API key belonging to a user with editor access to the app. A read-only key is refused even though this endpoint only reads, and workspace API keys are not accepted.</Note>

post/api/apps/{app_id}/code/content/batch

Request

  • Base URL: https://app.base44.com
  • URL: https://app.base44.com/api/apps/{app_id}/code/content/batch
  • Auth: HTTP bearer

Path parameters

app_idstring required

ID of the app whose code to read.

Request body

pathsstring[] required

Paths of up to 32 files, relative to the app root.

max_bytesinteger

Most bytes of file text to return across all the files, up to 5242880 (5 MB).

Example request

{
  "paths": [
    "src/App.jsx",
    "src/pages/Home.jsx"
  ],
  "max_bytes": 1048576
}

Response

Each file's text, or why it couldn't be read.

filesobject required

Each file, keyed by its path relative to the app root.

Example response

{
  "files": {
    "src/pages/Home.jsx": {
      "content": "export default function Home() {\n  return <h1>Home</h1>;\n}\n"
    },
    "src/pages/Missing.jsx": {
      "error": "file_not_found"
    }
  }
}

Changes