Get library policies
Source types and public library filters of the teamspace, with the number of libraries they allow. Any member can call it.
1 min read
get/v2/teamspaces/{teamspaceId}/policies
Request example
curl --request GET \
--url https://context7.com/api/v2/teamspaces/{teamspaceId}/policies \
--header 'Authorization: Bearer <token>'import requests
url = "https://context7.com/api/v2/teamspaces/{teamspaceId}/policies"
headers = {
"Authorization": "Bearer <token>",
}
response = requests.request("GET", url, headers=headers)
print(response.text)const response = await fetch('https://context7.com/api/v2/teamspaces/{teamspaceId}/policies', {
method: 'GET',
headers: {
'Authorization': 'Bearer <token>'
}
});
const data = await response.json();
console.log(data);<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://context7.com/api/v2/teamspaces/{teamspaceId}/policies',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://context7.com/api/v2/teamspaces/{teamspaceId}/policies"
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))
}HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://context7.com/api/v2/teamspaces/{teamspaceId}/policies"))
.header("Authorization", "Bearer <token>")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require 'uri'
require 'net/http'
url = URI('https://context7.com/api/v2/teamspaces/{teamspaceId}/policies')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = url.scheme == 'https'
request = Net::HTTP::Get.new(url)
request['Authorization'] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyResponse
{
"sourceTypes": {
"public_repos": {
"enabled": true
},
"private_sources": {
"enabled": true
},
"confluence": {
"enabled": true
},
"uploaded_files": {
"enabled": true
},
"websites": {
"enabled": true
},
"llmstxt": {
"enabled": true
}
},
"libraryFilters": {
"mode": "quality",
"quality": {
"requireVerified": true,
"minTrustScore": 1,
"maxAgeDays": 1,
"blockedLibraries": [
"<string>"
],
"exceptedLibraries": [
"<string>"
],
"repoFilters": {
"minStars": 1,
"allowedLicenses": [
"<string>"
]
},
"websiteFilters": {
"minBacklinks": 1,
"minReferringDomains": 1,
"minOrganicTraffic": 1
}
},
"select": {
"allowedLibraries": [
"<string>"
]
}
},
"accessibleLibraryCount": 1
}{
"error": "validation_error",
"message": "Library name is required"
}{
"error": "invalid_library_id",
"message": "Invalid library ID format. Expected: `/owner/repo` for GitHub repositories, or `/<source>/<id>` for other sources (the URL path of the library on context7.com)"
}{
"error": "invalid_api_key",
"message": "Invalid API key. Please check your API key. API keys should start with 'ctx7sk' prefix."
}{
"error": "access_denied",
"message": "Access denied: Library /owner/repo is not included in your allowed libraries"
}{
"error": "forbidden",
"message": "Only team owners and admins can add private repositories"
}{
"error": "forbidden",
"message": "Private repositories require a pro plan or team. Upgrade at https://context7.com/plans"
}{
"error": "library_not_found",
"message": "Library \"/owner/repo\" not found. Please check the library ID or your access permissions."
}{
"error": "version_not_found",
"message": "Version \"canary\" not found for library \"/owner/repo\". Available versions: v2.0.0, v1.5.0"
}{
"error": "no_snippets_found",
"message": "Could not fetch documentation snippets from the library."
}{
"error": "no_relevant_snippets",
"message": "No documentation in \"/owner/repo\" matched this query. Try a more specific query with different terms, or search for another library that covers this topic."
}{
"error": "team_not_found",
"message": "Team not found or access denied"
}{
"error": "user_not_found",
"message": "User not found"
}{
"error": "no_libraries_found",
"message": "No libraries found for \"nonexistent-lib\". Try a different search term."
}{
"error": "internal_error",
"message": "An error occurred while processing your request"
}get/v2/teamspaces/{teamspaceId}/policies
Authorization
Get your API key at context7.com/dashboard. Treat your API key like a password and store it securely.
Path parameters
Teamspace id (from
GET /v2/teamspaces).Responses
application/json
Policies
Access settings for each documentation source type
Show child attributesHide child attributes
Whether a source type is enabled or disabled
Show child attributesHide child attributes
Whether this source type is enabled
Whether a source type is enabled or disabled
Show child attributesHide child attributes
Whether this source type is enabled
Whether a source type is enabled or disabled
Show child attributesHide child attributes
Whether this source type is enabled
Whether a source type is enabled or disabled
Show child attributesHide child attributes
Whether this source type is enabled
Whether a source type is enabled or disabled
Show child attributesHide child attributes
Whether this source type is enabled
Library access filters. Mode determines which sub-object is active.
Show child attributesHide child attributes
Filter mode: 'quality' for threshold-based filtering, 'select' for manual library selection
Options:
qualityselectnullQuality-mode settings (active when mode is 'quality')
Show child attributesHide child attributes
Restrict to verified libraries only
Minimum trust score, 0-10
Maximum days since last update
Libraries excluded from results
Libraries that bypass all quality filters, blocked list, and source type restrictions
Repo-specific quality filters
Show child attributesHide child attributes
Website-specific quality filters
Number of public libraries currently accessible under these filters
Was this page helpful?