curl --request PATCH \
--url https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"libraryId": "<string>"
}
'import requests
url = "https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}"
payload = {
"text": "<string>",
"libraryId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', libraryId: '<string>'})
};
fetch('https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}', 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}/rules/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'libraryId' => '<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}/rules/{ruleId}"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"libraryId\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"libraryId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"libraryId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"text": "<string>",
"createdBy": "<string>",
"createdAt": 123,
"libraryType": "repo",
"docsUrl": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Update a rule's text
Replaces the text. Send the rule’s libraryId for a library rule (the id does not move a rule between libraries). Owners and admins only, paid owner plan.
curl --request PATCH \
--url https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"libraryId": "<string>"
}
'import requests
url = "https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}"
payload = {
"text": "<string>",
"libraryId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', libraryId: '<string>'})
};
fetch('https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}', 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}/rules/{ruleId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'libraryId' => '<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}/rules/{ruleId}"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"libraryId\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"libraryId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"libraryId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"text": "<string>",
"createdBy": "<string>",
"createdAt": 123,
"libraryType": "repo",
"docsUrl": "<string>",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}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 (from GET /v2/teamspaces).
Rule id (a key of global or of libraries[libraryId] in the rule list).
Body
1 - 1000Library id starting with /. Omit or null for a rule on every library.
Was this page helpful?