OpenAPI
Upload, access, or version-control your OpenAPI specifications directly in GitBook.
Was this helpful?
Upload, access, or version-control your OpenAPI specifications directly in GitBook.
Was this helpful?
Was this helpful?
The OpenAPI endpoints let you integrate your existing or newly generated OpenAPI definitions into GitBook. This includes uploading, updating, and retrieving specs.
The object type, which is always "openapi-spec"
Unique identifier
Date of creation
Date of the last update
Slug used as reference
^[a-z0-9]+(?:-[a-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
The unique id of the organization
Identifier of the page results to fetch.
The number of results per page
OK
OK
The unique id of the organization
Slug used as reference
^[a-z0-9]+(?:-[a-z0-9]+)*$
OpenAPI specification has been created
Bad Request
The unique id of the organization
Slug of the OpenAPI specification
OpenAPI specification has been updated
OpenAPI specification has been created
Bad Request
The unique id of the organization
Slug of the OpenAPI specification
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.OpenAPI specification visibility has been updated
Bad Request
No matching OpenAPI specification found
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-08-26T22:07:16.661Z",
"updatedAt": "2025-08-26T22:07:16.661Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-26T22:07:16.661Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-08-26T22:07:16.661Z",
"updatedAt": "2025-08-26T22:07:16.661Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-26T22:07:16.661Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-08-26T22:07:16.661Z",
"updatedAt": "2025-08-26T22:07:16.661Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-26T22:07:16.661Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
GET /v1/orgs/{organizationId}/openapi HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"next": {
"page": "text"
},
"count": 1,
"items": [
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-08-26T22:07:16.661Z",
"updatedAt": "2025-08-26T22:07:16.661Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-26T22:07:16.661Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
]
}
POST /v1/orgs/{organizationId}/openapi HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 54
{
"slug": "text",
"source": {
"url": "https://example.com"
}
}
GET /v1/orgs/{organizationId}/openapi/{specSlug} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-08-26T22:07:16.661Z",
"updatedAt": "2025-08-26T22:07:16.661Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-26T22:07:16.661Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
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"
}
}
DELETE /v1/orgs/{organizationId}/openapi/{specSlug} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
PATCH /v1/orgs/{organizationId}/openapi/{specSlug} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 24
{
"visibility": "private"
}
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-08-26T22:07:16.661Z",
"updatedAt": "2025-08-26T22:07:16.661Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-26T22:07:16.661Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}