Update a context file
curl --request PATCH \
--url https://{instance}.omniapp.co/api/v1/context-files/{contextFileId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "Fiscal years start in February.\n\nReport revenue in EUR."
}
'import requests
url = "https://{instance}.omniapp.co/api/v1/context-files/{contextFileId}"
payload = { "content": "Fiscal years start in February.
Report revenue in EUR." }
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({content: 'Fiscal years start in February.\n\nReport revenue in EUR.'})
};
fetch('https://{instance}.omniapp.co/api/v1/context-files/{contextFileId}', 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://{instance}.omniapp.co/api/v1/context-files/{contextFileId}",
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([
'content' => 'Fiscal years start in February.
Report revenue in EUR.'
]),
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://{instance}.omniapp.co/api/v1/context-files/{contextFileId}"
payload := strings.NewReader("{\n \"content\": \"Fiscal years start in February.\\n\\nReport revenue in EUR.\"\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://{instance}.omniapp.co/api/v1/context-files/{contextFileId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"Fiscal years start in February.\\n\\nReport revenue in EUR.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.omniapp.co/api/v1/context-files/{contextFileId}")
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 \"content\": \"Fiscal years start in February.\\n\\nReport revenue in EUR.\"\n}"
response = http.request(request)
puts response.read_body{
"file": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "AGENTS.md",
"type": "always_context",
"updatedAt": "2026-02-01T09:31:00.000Z",
"characters": 55
}
}{
"detail": "File body exceeds 20000 characters",
"status": 400
}{
"detail": "You do not have editor access to this file",
"status": 403
}{
"detail": "<string>",
"status": 404
}{
"detail": "Method Not Allowed",
"status": 405
}Context Files
Update a context file
This endpoint is experimental and may change.
Replaces the whole body of one context file with content. Returns the file’s metadata.
PATCH
/
v1
/
context-files
/
{contextFileId}
Update a context file
curl --request PATCH \
--url https://{instance}.omniapp.co/api/v1/context-files/{contextFileId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"content": "Fiscal years start in February.\n\nReport revenue in EUR."
}
'import requests
url = "https://{instance}.omniapp.co/api/v1/context-files/{contextFileId}"
payload = { "content": "Fiscal years start in February.
Report revenue in EUR." }
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({content: 'Fiscal years start in February.\n\nReport revenue in EUR.'})
};
fetch('https://{instance}.omniapp.co/api/v1/context-files/{contextFileId}', 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://{instance}.omniapp.co/api/v1/context-files/{contextFileId}",
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([
'content' => 'Fiscal years start in February.
Report revenue in EUR.'
]),
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://{instance}.omniapp.co/api/v1/context-files/{contextFileId}"
payload := strings.NewReader("{\n \"content\": \"Fiscal years start in February.\\n\\nReport revenue in EUR.\"\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://{instance}.omniapp.co/api/v1/context-files/{contextFileId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"content\": \"Fiscal years start in February.\\n\\nReport revenue in EUR.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.omniapp.co/api/v1/context-files/{contextFileId}")
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 \"content\": \"Fiscal years start in February.\\n\\nReport revenue in EUR.\"\n}"
response = http.request(request)
puts response.read_body{
"file": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "AGENTS.md",
"type": "always_context",
"updatedAt": "2026-02-01T09:31:00.000Z",
"characters": 55
}
}{
"detail": "File body exceeds 20000 characters",
"status": 400
}{
"detail": "You do not have editor access to this file",
"status": 403
}{
"detail": "<string>",
"status": 404
}{
"detail": "Method Not Allowed",
"status": 405
}Authorizations
bearerAuthorgApiKey
Can be either an Organization API Key or Personal Access Token (PAT).
Include in the Authorization header as: Bearer YOUR_TOKEN
Path Parameters
The file's id. Use List context files to retrieve IDs.
Example:
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Body
application/json
The content to replace the file's body, up to 20000 characters. This will replace the file's entire body. Read the file first with the Read a context file endpoint and then use this endpoint to submit your changes.
Example:
"Fiscal years start in February."
Response
The file's metadata. Use Read a context file to view the updated content body.
Was this page helpful?

