Get Repository File
curl --request GET \
--url https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content', 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://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"repoName": "<string>",
"path": "<string>",
"content": "<string>",
"language": "<string>",
"sizeBytes": 1,
"binary": true,
"tooLarge": true,
"base64": "<string>",
"mimeType": "<string>",
"revision": "<string>",
"unsupported": true
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}Replica
Get Repository File
Reads a repository file for preview or editing. Editable text files include a revision to pass as expectedRevision when saving.
GET
/
v1
/
workspaces
/
{workspaceId}
/
repo-files
/
content
Get Repository File
curl --request GET \
--url https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content', 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://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.replicas.dev/v1/workspaces/{workspaceId}/repo-files/content")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"repoName": "<string>",
"path": "<string>",
"content": "<string>",
"language": "<string>",
"sizeBytes": 1,
"binary": true,
"tooLarge": true,
"base64": "<string>",
"mimeType": "<string>",
"revision": "<string>",
"unsupported": true
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}{
"error": "<string>",
"details": "<string>",
"code": "<string>"
}Authorizations
API key authentication. Obtain your API key from the Replicas dashboard under Organization → Settings → API Keys.
Path Parameters
Query Parameters
Repository-relative file path.
Example:
"src/index.ts"
Response
Repository file content and metadata
Repository file content and metadata. Editable text files include content and revision; supported binary previews may include base64 and mimeType.
Required range:
x >= 0SHA-256 revision to pass as expectedRevision when saving editable text.
Pattern:
^[a-f0-9]{64}$⌘I