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
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-06-21T04:19:35.120Z",
"updatedAt": "2025-06-21T04:19:35.120Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"lastVersion": "text",
"lastProcessedAt": "2025-06-21T04:19:35.120Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "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-06-21T04:19:35.120Z",
"updatedAt": "2025-06-21T04:19:35.120Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"lastVersion": "text",
"lastProcessedAt": "2025-06-21T04:19:35.120Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "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-06-21T04:19:35.120Z",
"updatedAt": "2025-06-21T04:19:35.120Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"lastVersion": "text",
"lastProcessedAt": "2025-06-21T04:19:35.120Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "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-06-21T04:19:35.120Z",
"updatedAt": "2025-06-21T04:19:35.120Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"lastVersion": "text",
"lastProcessedAt": "2025-06-21T04:19:35.120Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "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-06-21T04:19:35.120Z",
"updatedAt": "2025-06-21T04:19:35.120Z",
"slug": "text",
"sourceURL": "https://example.com",
"processingState": "pending",
"lastVersion": "text",
"lastProcessedAt": "2025-06-21T04:19:35.120Z",
"lastProcessErrorCode": "FETCH_TIMEOUT",
"permissions": {
"view": true,
"edit": true
},
"urls": {
"location": "https://example.com",
"app": "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: */*
OpenAPI specification has been deleted
No content
Was this helpful?