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-08-06T04:40:12.724Z",
"updatedAt": "2025-08-06T04:40:12.724Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-06T04:40:12.724Z",
"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
OK
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-08-06T04:40:12.724Z",
"updatedAt": "2025-08-06T04:40:12.724Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-06T04:40:12.724Z",
"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]+)*$
OpenAPI specification has been created
Bad Request
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-08-06T04:40:12.724Z",
"updatedAt": "2025-08-06T04:40:12.724Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-06T04:40:12.724Z",
"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
OK
No matching OpenAPI specification found
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-06T04:40:12.724Z",
"updatedAt": "2025-08-06T04:40:12.724Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-06T04:40:12.724Z",
"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
OpenAPI specification has been updated
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": "2025-08-06T04:40:12.724Z",
"updatedAt": "2025-08-06T04:40:12.724Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-06T04:40:12.724Z",
"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
Specification did not exist
OpenAPI specification has been deleted
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.
OpenAPI specification visibility has been updated
Bad Request
No matching OpenAPI specification found
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-06T04:40:12.724Z",
"updatedAt": "2025-08-06T04:40:12.724Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"visibility": "private",
"lastVersion": "text",
"lastProcessedAt": "2025-08-06T04:40:12.724Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "https://example.com",
"published": "https://example.com"
}
}
Was this helpful?