Create or update an OpenAPI spec
Creates the organization's OpenAPI spec with this slug, or replaces its source with a new version. The spec is processed asynchronously, and pages that already render it are regenerated once it is. Creating a spec adds no page: to publish its API reference in a space, insert a page that renders it with an insert_computed_page change, through the updateChangeRequestContent operation.
A unique entity identifier
^[a-zA-Z0-9_-]+$Slug of the OpenAPI specification
OpenAPI specification has been updated
The object type, which is always "openapi-spec"
Unique identifier
Date of creation
Date of the last update
Slug used as reference
^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$Processing state
The visibility setting of the OpenAPI spec.
private: The spec is not publicly available.public: The spec is available to anyone with a public link.
ID of the latest version of the OpenAPI specification
Date of the last processing
OpenAPI processing error code
Total number of processing errors before truncation of lastProcessedErrors.
OpenAPI specification has been created
Bad Request
PUT /v1/orgs/{organizationId}/openapi/{specSlug} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 40
{
"source": {
"url": "https://example.com"
}
}{
"object": "openapi-spec",
"id": "text",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2026-01-01T00:00:00.000Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"lastProcessedErrors": [
{
"message": "text",
"code": "text"
}
],
"lastProcessedErrorCount": 1,
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}Last updated
Was this helpful?