Regenerate pages from the attached spec
:::openapi-operation POST /api/v1/workspaces/{workspace}/openapi/sync AUTH bearerAuth :::
Fetches a URL source again. A failed fetch keeps the stored spec and pages and returns 502. Detached pages are skipped. When the org reviews agent changes, a sync that changes the pages answers 202 with an openapi proposal, and while an attach or a sync of the key waits for review, the call uses the spec of that proposal.
:::codesamples open Code examples
curl -X POST "https://contextowl.co/api/v1/workspaces/string/openapi/sync?note=string" \
-H "Accept: application/json" \
-H "Authorization: Bearer <token>"
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create("https://contextowl.co/api/v1/workspaces/string/openapi/sync?note=string"))
.header("Accept", "application/json")
.header("Authorization", "Bearer <token>")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
import urllib.request
url = "https://contextowl.co/api/v1/workspaces/string/openapi/sync?note=string"
headers = {
"Accept": "application/json",
"Authorization": "Bearer <token>",
}
data = None
req = urllib.request.Request(url, data=data, headers=headers, method="POST")
with urllib.request.urlopen(req) as res:
print(res.status)
print(res.read().decode())
const response = await fetch("https://contextowl.co/api/v1/workspaces/string/openapi/sync?note=string", {
method: "POST",
headers: {
"Accept": "application/json",
"Authorization": "Bearer <token>",
}
});
console.log(response.status);
console.log(await response.json());
package main
import (
"fmt"
"io"
"net/http"
"time"
)
func main() {
req, err := http.NewRequest("POST", "https://contextowl.co/api/v1/workspaces/string/openapi/sync?note=string", nil)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer <token>")
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
bodyBytes, err := io.ReadAll(io.LimitReader(res.Body, 10<<20))
if err != nil {
panic(err)
}
fmt.Println(res.StatusCode)
fmt.Println(string(bodyBytes))
}
// cargo add reqwest --features blocking
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let response = client.request(reqwest::Method::POST, "https://contextowl.co/api/v1/workspaces/string/openapi/sync?note=string")
.header("Accept", "application/json")
.header("Authorization", "Bearer <token>")
.send()?;
println!("{}", response.status());
println!("{}", response.text()?);
Ok(())
}
:::
:::details open Parameters (2)
| NAME | IN | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|---|
workspace |
path | string | yes | Workspace id, or - for the key's bound workspace |
note |
query | string | no | Note for the reviewer when the org reviews agent changes: what the change does and why. A direct write ignores it. |
:::
:::details open Success responses (200, 202)
200
Success
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
configured |
boolean | yes | - |
lastError |
string | no | - |
lastSyncedAt |
string (date-time) | no | - |
sourceType |
string | no | - |
sourceUrl |
string | no | - |
specBytes |
integer | no | - |
specFormat |
string | no | - |
specTitle |
string | no | - |
specVersion |
string | no | - |
stats |
OpenAPISyncStats object | no | - |
unchanged |
boolean | no | - |
updatedAt |
string (date-time) | no | - |
{
"configured": true,
"lastError": "string",
"lastSyncedAt": "string",
"sourceType": "string",
"sourceUrl": "string",
"specBytes": 0,
"specFormat": "string",
"specTitle": "string",
"specVersion": "string",
"stats": {
"created": 0,
"deleted": 0,
"unchanged": 0,
"updated": 0
},
"unchanged": true,
"updatedAt": "string"
}
202
The org reviews changes from agent keys, so the change waits in a proposal for an editor. Nothing changed for readers.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
message |
string | yes | What happened and what to tell the user |
pendingReview |
boolean | yes | True: the org reviews changes from agent keys, so the change waits in a proposal for an editor. Nothing changed for readers. |
proposal |
ReviewProposal object | yes | - |
{
"message": "string",
"pendingReview": true,
"proposal": {
"baseRevision": "string",
"entryId": 0,
"id": 0,
"objectType": "string",
"outcome": "string",
"reviewUrl": "string",
"slug": "string",
"status": "string",
"summary": "string",
"target": "string"
}
}
:::
:::details Error responses (400, 401, 403, 404, 409, 422, 429, 500, 502)
400
invalid_openapi: the fetched spec is not a valid OpenAPI document. The stored spec and pages stay.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
401
unauthorized: the access key is missing, invalid or expired.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
403
permission_denied: the key lacks the permission. two_factor_required: the org requires admins to turn on two-factor authentication.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
404
not_found: no such workspace, or no OpenAPI spec is attached to it.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
409
openapi_slug_collision: a generated page would take the slug of an article.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
422
openapi_too_complex: the schema references of the spec expand beyond the limit of the server.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
429
rate_limited: too many requests. Wait for the time in the Retry-After header.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
500
internal: the server failed.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
502
openapi_fetch_failed: the server could not fetch the spec URL. The stored spec and pages stay.
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
:::