Get an app code file

<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 one file in the app's source.

Get paths from List app code files. A file that list leaves out, such as package-lock.json, can still be read by naming it.

Only UTF-8 text files up to 5 MB can be read. A path outside the app is refused, and so are the app's .git folder and .agents/.env, which Base44 manages and which can hold credentials.

Reads come from the app's live sandbox, the same files the builder's code 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 300 requests a 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, including a read-only one, from anyone with access to the app, viewers included. Workspace API keys are not authorized for it.</Note>

get/api/apps/{app_id}/code/content

Path parameters

app_idstring required

ID of the app whose code to read.

ID of the app whose code to read.

Query parameters

pathstring required

Path of the file, relative to the app root.

Path of the file, relative to the app root.

Response

The file's text.

pathstring required

Path of the file, relative to the app root.

contentstring required

The file's full text.

Example response

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

Changes

Changed in 1 of the 22 revisions of this API.1

Of the 22 revisions, 1 has no diff computed.