Get an app code file
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 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 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.
Set branch_id to read a branch's files instead of main's. Each branch has its own sandbox, so the first read of a branch also takes longer. A merged branch can't be read: the call returns a 409. On an app imported from GitHub, reading a merged branch can instead return the files as they were when the branch was created, so don't rely on it there.
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>
Request
- Base URLhttps://app.base44.com
- URLhttps://app.base44.com/api/apps/{app_id}/code/content
- AuthHTTP bearer
Path parameters
ID of the app whose code to read.
Query parameters
Path of the file, relative to the app root.
ID of the branch to work on, as returned by List branches. Omit it to work on the app's main branch.
Response
The file's text.
Example response
{
"path": "src/pages/Home.jsx",
"content": "export default function Home() {\n return <h1>Home</h1>;\n}\n"
}Changes
- info
added the new optional
queryrequest parameterbranch_id - info
added the non-success response with the status
- info
- info
the endpoint scheme security
PersonalAccessTokenAuthwas added to the API
- info