Search app files

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

Searches the app's files for a pattern and returns the matching lines.

Every sandbox-bridge endpoint runs against the app's live sandbox, the same filesystem the Base44 builder edits, so a change here is visible in the builder immediately.

The pattern is a regular expression by default; set is_regex: false to match it literally. Narrow the search with path to a subtree and glob to a filename pattern. Matching is case-insensitive unless you set case_sensitive.

Finding nothing is a 200 with an empty matches, not a 404. Results are capped at max_results (200 by default, 1000 at most) and the output at 1 MB, and truncated tells you when either cap bit, so treat a true there as "narrow the search" rather than "no more matches".

Base44 keeps its own protected trees out of the results, so a pattern that exists only there returns nothing.

This endpoint is limited to 120 requests per minute per app, shared with the other sandbox-bridge endpoints that only read.

<Note>The sandbox bridge needs a Builder plan or higher on the app's workspace, and answers 402 below that. Workspace API keys are not authorized and are rejected with a 403, and it is unavailable for agent apps. A personal API key works as-is. An OAuth access token needs the apps:read scope; the read endpoints don't require sandbox:write.</Note>

<Tip>Every error response carries a stable extra_data.code alongside the human-readable message. Branch on the code rather than on the message text or the status.</Tip>

post/api/apps/{app_id}/sandbox-bridge/grep

Path parameters

app_idstring required

ID of the app whose sandbox to operate on.

ID of the app whose sandbox to operate on.

Request body

branch_idstring nullable

Optional Base44 branch ID. Omit to operate on main.

patternstring required

Search pattern.

pathstring nullable

Subtree to search, relative to the app root. Default: whole app.

is_regexboolean

Treat the pattern as a regex (default) or a literal string.

case_sensitiveboolean

Case-sensitive match. Default false.

globstring nullable

Optional file glob filter, e.g. "*.tsx".

max_resultsinteger

Maximum number of match lines to return.

Response

The matching lines, empty when nothing matched.

truncatedboolean required

true when there was more to return: either more matches than max_results, or output that hit the 1 MB cap. One very long line can set this with few matches.

returned_matchesinteger required

How many entries matches holds.

Example response

{
  "matches": [
    {
      "line": 2,
      "path": "src/pages/Home.jsx",
      "text": "  return <h1>Hello</h1>;"
    }
  ],
  "returned_matches": 1
}

Changes