Modulify

Read one source file

read_file

Reads one text file from a site's source code by its exact path.

POST /v1/read_fileScopecode:readRead only

Like list_files, it reads the preview branch of the site repository rather than the running container, so just after a generation the content can still be the version from before the agent edited it. Take the path from list_files, and the answer carries the file's path, size and content.

Binary files and files larger than 200 KB are refused rather than truncated, so read a narrower file instead. A read that fails on GitHub's side returns an error, never empty content, and a path that is not in the site answers That file was not found in this site! See Read a file.

Request

Call it with a POST to https://api.modulify.ai/v1/read_file, sending the inputs below as a JSON object. The token needs the code:read scope.

It only reads and changes nothing, so retrying it is safe.

curl -X POST https://api.modulify.ai/v1/read_file \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","path":"PATH"}'

Over MCP, the same method is the read_file tool.

Inputs

Input Type Required Description
projectId string Yes The site id.
path string Yes The exact file path, for example app/page.tsx. A leading slash is ignored.

Response

Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.