curl --request POST \
--url https://context7.com/api/v2/teamspaces/{teamspaceId}/sites \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repoUrl": "https://github.com/acme/docs",
"docsPath": ".",
"branch": "<string>",
"context7Index": true,
"slug": "<string>",
"customDomain": "<string>",
"customDomainPath": "<string>",
"setupId": "<string>"
}
'import requests
url = "https://context7.com/api/v2/teamspaces/{teamspaceId}/sites"
payload = {
"repoUrl": "https://github.com/acme/docs",
"docsPath": ".",
"branch": "<string>",
"context7Index": True,
"slug": "<string>",
"customDomain": "<string>",
"customDomainPath": "<string>",
"setupId": "<string>"
}
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({
repoUrl: 'https://github.com/acme/docs',
docsPath: '.',
branch: '<string>',
context7Index: true,
slug: '<string>',
customDomain: '<string>',
customDomainPath: '<string>',
setupId: '<string>'
})
};
fetch('https://context7.com/api/v2/teamspaces/{teamspaceId}/sites', 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://context7.com/api/v2/teamspaces/{teamspaceId}/sites",
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([
'repoUrl' => 'https://github.com/acme/docs',
'docsPath' => '.',
'branch' => '<string>',
'context7Index' => true,
'slug' => '<string>',
'customDomain' => '<string>',
'customDomainPath' => '<string>',
'setupId' => '<string>'
]),
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://context7.com/api/v2/teamspaces/{teamspaceId}/sites"
payload := strings.NewReader("{\n \"repoUrl\": \"https://github.com/acme/docs\",\n \"docsPath\": \".\",\n \"branch\": \"<string>\",\n \"context7Index\": true,\n \"slug\": \"<string>\",\n \"customDomain\": \"<string>\",\n \"customDomainPath\": \"<string>\",\n \"setupId\": \"<string>\"\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://context7.com/api/v2/teamspaces/{teamspaceId}/sites")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repoUrl\": \"https://github.com/acme/docs\",\n \"docsPath\": \".\",\n \"branch\": \"<string>\",\n \"context7Index\": true,\n \"slug\": \"<string>\",\n \"customDomain\": \"<string>\",\n \"customDomainPath\": \"<string>\",\n \"setupId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://context7.com/api/v2/teamspaces/{teamspaceId}/sites")
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 \"repoUrl\": \"https://github.com/acme/docs\",\n \"docsPath\": \".\",\n \"branch\": \"<string>\",\n \"context7Index\": true,\n \"slug\": \"<string>\",\n \"customDomain\": \"<string>\",\n \"customDomainPath\": \"<string>\",\n \"setupId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repoUrl": "<string>",
"docsPath": "<string>",
"hosting": "off",
"platformHostname": "acme-docs.docs7.io",
"customDomainStatus": "none",
"context7Index": true,
"improveSchedule": "off",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"repositoryId": "<string>",
"installationId": 123,
"branch": "<string>",
"defaultBranch": "<string>",
"analyticsUrl": "<string>",
"workerName": "<string>",
"customDomain": "<string>",
"customDomainPath": "<string>",
"customDomainRouting": "dns",
"customHostnameId": "<string>",
"customDomainError": "<string>",
"customDomainRecords": [
{
"purpose": "domain_ownership",
"type": "CNAME",
"name": "<string>",
"value": "<string>"
}
],
"context7LibraryName": "/acme/docs",
"pullRequestReview": {
"enabled": true,
"response": "comment"
},
"codeWatch": {
"enabled": true,
"repositories": [
{
"repositoryId": "<string>",
"repoUrl": "<string>"
}
]
},
"buildFixSchedule": "off",
"snippetSchedule": "off"
},
"deploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "github_access_missing",
"message": "Give your GitHub account and the Docs7 GitHub App access to this repository, then try again"
}{
"error": "unauthorized",
"message": "Authentication required."
}{
"error": "docs7_pro_required",
"message": "Docs7 Free includes 3 sites. Upgrade to Docs7 Pro to add another."
}{
"error": "not_found",
"message": "Site not found."
}{
"error": "site_conflict"
}{
"error": "internal_error",
"message": "Internal server error."
}{
"error": "source_check_failed"
}Add a Docs7 site
Connect a GitHub repository. Docs7 checks that both the Docs7 GitHub App and the caller’s own GitHub account can read the repository. The caller must have connected GitHub in the Context7 dashboard once (the dashboard stores the GitHub authorization); without it the answer is 400 github_access_missing. hosting chooses whether Docs7 publishes the docs ("on", first build starts) or the site is added for the agents only ("off"); without it, a docsPath with docs.json or mint.json is published and any other is added for the agents only. Developers can set only repoUrl, branch, docsPath, context7Index and hosting. Docs7 Free includes 3 sites and public repositories only.
curl --request POST \
--url https://context7.com/api/v2/teamspaces/{teamspaceId}/sites \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"repoUrl": "https://github.com/acme/docs",
"docsPath": ".",
"branch": "<string>",
"context7Index": true,
"slug": "<string>",
"customDomain": "<string>",
"customDomainPath": "<string>",
"setupId": "<string>"
}
'import requests
url = "https://context7.com/api/v2/teamspaces/{teamspaceId}/sites"
payload = {
"repoUrl": "https://github.com/acme/docs",
"docsPath": ".",
"branch": "<string>",
"context7Index": True,
"slug": "<string>",
"customDomain": "<string>",
"customDomainPath": "<string>",
"setupId": "<string>"
}
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({
repoUrl: 'https://github.com/acme/docs',
docsPath: '.',
branch: '<string>',
context7Index: true,
slug: '<string>',
customDomain: '<string>',
customDomainPath: '<string>',
setupId: '<string>'
})
};
fetch('https://context7.com/api/v2/teamspaces/{teamspaceId}/sites', 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://context7.com/api/v2/teamspaces/{teamspaceId}/sites",
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([
'repoUrl' => 'https://github.com/acme/docs',
'docsPath' => '.',
'branch' => '<string>',
'context7Index' => true,
'slug' => '<string>',
'customDomain' => '<string>',
'customDomainPath' => '<string>',
'setupId' => '<string>'
]),
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://context7.com/api/v2/teamspaces/{teamspaceId}/sites"
payload := strings.NewReader("{\n \"repoUrl\": \"https://github.com/acme/docs\",\n \"docsPath\": \".\",\n \"branch\": \"<string>\",\n \"context7Index\": true,\n \"slug\": \"<string>\",\n \"customDomain\": \"<string>\",\n \"customDomainPath\": \"<string>\",\n \"setupId\": \"<string>\"\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://context7.com/api/v2/teamspaces/{teamspaceId}/sites")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"repoUrl\": \"https://github.com/acme/docs\",\n \"docsPath\": \".\",\n \"branch\": \"<string>\",\n \"context7Index\": true,\n \"slug\": \"<string>\",\n \"customDomain\": \"<string>\",\n \"customDomainPath\": \"<string>\",\n \"setupId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://context7.com/api/v2/teamspaces/{teamspaceId}/sites")
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 \"repoUrl\": \"https://github.com/acme/docs\",\n \"docsPath\": \".\",\n \"branch\": \"<string>\",\n \"context7Index\": true,\n \"slug\": \"<string>\",\n \"customDomain\": \"<string>\",\n \"customDomainPath\": \"<string>\",\n \"setupId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"repoUrl": "<string>",
"docsPath": "<string>",
"hosting": "off",
"platformHostname": "acme-docs.docs7.io",
"customDomainStatus": "none",
"context7Index": true,
"improveSchedule": "off",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"repositoryId": "<string>",
"installationId": 123,
"branch": "<string>",
"defaultBranch": "<string>",
"analyticsUrl": "<string>",
"workerName": "<string>",
"customDomain": "<string>",
"customDomainPath": "<string>",
"customDomainRouting": "dns",
"customHostnameId": "<string>",
"customDomainError": "<string>",
"customDomainRecords": [
{
"purpose": "domain_ownership",
"type": "CNAME",
"name": "<string>",
"value": "<string>"
}
],
"context7LibraryName": "/acme/docs",
"pullRequestReview": {
"enabled": true,
"response": "comment"
},
"codeWatch": {
"enabled": true,
"repositories": [
{
"repositoryId": "<string>",
"repoUrl": "<string>"
}
]
},
"buildFixSchedule": "off",
"snippetSchedule": "off"
},
"deploymentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "github_access_missing",
"message": "Give your GitHub account and the Docs7 GitHub App access to this repository, then try again"
}{
"error": "unauthorized",
"message": "Authentication required."
}{
"error": "docs7_pro_required",
"message": "Docs7 Free includes 3 sites. Upgrade to Docs7 Pro to add another."
}{
"error": "not_found",
"message": "Site not found."
}{
"error": "site_conflict"
}{
"error": "internal_error",
"message": "Internal server error."
}{
"error": "source_check_failed"
}Authorizations
Get your API key at context7.com/dashboard. Treat your API key like a password and store it securely. Every key can read the management API (/v2/teamspaces/*), except personal data: member and invitation emails, library requesters, visitor questions, Docs7 reader searches, conversations, feedback and feature requests, and the GitHub account behind a build. To read those or make changes there, the key must be created with Write access ticked; other keys get 403 write_access_required.
Path Parameters
Teamspace id.
Body
"https://github.com/acme/docs"
Docs folder; . for the root.
"."
Production branch. Default: the repository's default branch.
1 - 255Also index the repository in Context7.
on publishes the docs and needs docs.json or mint.json in docsPath; without one the answer is 400 docs_config_missing, and its message names the folders that have one. off adds the repository for the agents only. Default: on when docsPath has a config, else off.
on, off First label of the platform hostname. Default: owner-repo. Owner or admin.
3 - 40^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$Owner or admin.
Required with proxy routing. Owner or admin.
Required with customDomain. Owner or admin.
dns, proxy The setup ID from the Docs7 Add page's agent prompt. The Add page uses it to follow this site and its first build.
^[a-z0-9]{8,32}$Was this page helpful?