curl --request POST \
--url https://app.codealive.ai/api/tools/read_file \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data_source": "CodeAlive-AI/agent-framework",
"path": "README.md"
}
'import requests
url = "https://app.codealive.ai/api/tools/read_file"
payload = {
"data_source": "CodeAlive-AI/agent-framework",
"path": "README.md"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({data_source: 'CodeAlive-AI/agent-framework', path: 'README.md'})
};
fetch('https://app.codealive.ai/api/tools/read_file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.codealive.ai/api/tools/read_file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data_source' => 'CodeAlive-AI/agent-framework',
'path' => 'README.md'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.codealive.ai/api/tools/read_file"
payload := strings.NewReader("{\n \"data_source\": \"CodeAlive-AI/agent-framework\",\n \"path\": \"README.md\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.codealive.ai/api/tools/read_file")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data_source\": \"CodeAlive-AI/agent-framework\",\n \"path\": \"README.md\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codealive.ai/api/tools/read_file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data_source\": \"CodeAlive-AI/agent-framework\",\n \"path\": \"README.md\"\n}"
response = http.request(request)
puts response.read_body{
"obj": {
"found": true,
"files": [
{
"identifier": "CodeAlive-AI/agent-framework::README.md",
"path": "README.md",
"dataSource": {
"type": "Repository",
"name": "agent-framework"
},
"fullName": "CodeAlive-AI/agent-framework",
"startLine": 1,
"endLine": 2,
"contentByteSize": 96,
"numberedContent": "1: # Agent Framework\n2: Multi-agent orchestration framework."
}
],
"candidates": [],
"sameNameCandidates": [],
"sameNameTotalCount": 0,
"hint": "Content is line-numbered; request start_line/end_line ranges for large files."
},
"rendered": "{\"found\":true,\"files\":[{\"identifier\":\"CodeAlive-AI/agent-framework::README.md\",\"path\":\"README.md\",\"startLine\":1,\"endLine\":2,\"numberedContent\":\"1: # Agent Framework\\n2: Multi-agent orchestration framework.\"}],\"hint\":\"Content is line-numbered; request start_line/end_line ranges for large files.\"}"
}Read a repository file
Reads one file by its exact repository-relative path, returning line-numbered content. This is the fallback reader: when a previous search already returned an artifact identifier for the file, prefer fetch_artifacts. Bound large files with start_line/end_line. When the path does not resolve, the response includes candidate paths with the same file name so the call can be repaired.
curl --request POST \
--url https://app.codealive.ai/api/tools/read_file \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data_source": "CodeAlive-AI/agent-framework",
"path": "README.md"
}
'import requests
url = "https://app.codealive.ai/api/tools/read_file"
payload = {
"data_source": "CodeAlive-AI/agent-framework",
"path": "README.md"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({data_source: 'CodeAlive-AI/agent-framework', path: 'README.md'})
};
fetch('https://app.codealive.ai/api/tools/read_file', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.codealive.ai/api/tools/read_file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data_source' => 'CodeAlive-AI/agent-framework',
'path' => 'README.md'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.codealive.ai/api/tools/read_file"
payload := strings.NewReader("{\n \"data_source\": \"CodeAlive-AI/agent-framework\",\n \"path\": \"README.md\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.codealive.ai/api/tools/read_file")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data_source\": \"CodeAlive-AI/agent-framework\",\n \"path\": \"README.md\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.codealive.ai/api/tools/read_file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data_source\": \"CodeAlive-AI/agent-framework\",\n \"path\": \"README.md\"\n}"
response = http.request(request)
puts response.read_body{
"obj": {
"found": true,
"files": [
{
"identifier": "CodeAlive-AI/agent-framework::README.md",
"path": "README.md",
"dataSource": {
"type": "Repository",
"name": "agent-framework"
},
"fullName": "CodeAlive-AI/agent-framework",
"startLine": 1,
"endLine": 2,
"contentByteSize": 96,
"numberedContent": "1: # Agent Framework\n2: Multi-agent orchestration framework."
}
],
"candidates": [],
"sameNameCandidates": [],
"sameNameTotalCount": 0,
"hint": "Content is line-numbered; request start_line/end_line ranges for large files."
},
"rendered": "{\"found\":true,\"files\":[{\"identifier\":\"CodeAlive-AI/agent-framework::README.md\",\"path\":\"README.md\",\"startLine\":1,\"endLine\":2,\"numberedContent\":\"1: # Agent Framework\\n2: Multi-agent orchestration framework.\"}],\"hint\":\"Content is line-numbered; request start_line/end_line ranges for large files.\"}"
}Authorizations
API Key authentication using Bearer token. Example: "Authorization: Bearer {apiKey}"
Body
Repository-relative file path returned by get_file_tree, semantic_search, or grep_search.
Optional success projection. Omit to return both obj and rendered; use json for obj only; use agentic for rendered text only. Repairable errors always return both obj.error and rendered.
json, agentic One repository name or id returned by get_data_sources. Required when more than one repository is visible.
Optional 1-based start line.
Optional 1-based end line.
Response
Success envelope. obj has found, files[] with line-numbered content (numberedContent, startLine, endLine), same-name candidates when the path did not resolve, and a hint; rendered is the JSON-serialized form of obj. Repairable failures (missing or invalid arguments, ambiguous or unknown data sources) also return HTTP 200 with obj.error = { code, message, retry, try } and a rendered <tool_error> block; repair the arguments and retry.
Was this page helpful?