OpenAPI
Upload, access, or version-control your OpenAPI specifications directly in GitBook.
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 OpenAPISpec object
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-07-08T22:47:46.267Z",
"updatedAt": "2025-07-08T22:47:46.267Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-07-08T22:47:46.267Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
The unique id of the organization
Identifier of the page results to fetch.
The number of results per page
GET /v1/orgs/{organizationId}/openapi HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
OK
{
"next": {
"page": "text"
},
"count": 1,
"items": [
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-07-08T22:47:46.267Z",
"updatedAt": "2025-07-08T22:47:46.267Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-07-08T22:47:46.267Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
]
}
The unique id of the organization
Slug used as reference
^[a-z0-9]+(?:-[a-z0-9]+)*$
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"
}
}
{
"object": "openapi-spec",
"id": "text",
"createdAt": "2025-07-08T22:47:46.267Z",
"updatedAt": "2025-07-08T22:47:46.267Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-07-08T22:47:46.267Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
The unique id of the organization
Slug of the OpenAPI specification
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-07-08T22:47:46.267Z",
"updatedAt": "2025-07-08T22:47:46.267Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-07-08T22:47:46.267Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
The unique id of the organization
Slug of the OpenAPI specification
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": "2025-07-08T22:47:46.267Z",
"updatedAt": "2025-07-08T22:47:46.267Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-07-08T22:47:46.267Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
The unique id of the organization
Slug of the OpenAPI specification
DELETE /v1/orgs/{organizationId}/openapi/{specSlug} HTTP/1.1
Host: api.gitbook.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
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.
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-07-08T22:47:46.267Z",
"updatedAt": "2025-07-08T22:47:46.267Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-07-08T22:47:46.267Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
Was this helpful?