Create an OpenAPI spec
Adds an OpenAPI spec to the organization, from a URL or from its text. The spec is processed asynchronously and no page is created: to publish its API reference in a space, insert a page that renders it with an insert_computed_page change, through the updateChangeRequestContent operation. That reference fills in once processing completes and is regenerated each time the spec is updated.
A unique entity identifier
^[a-zA-Z0-9_-]+$Slug used as reference
^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$OpenAPI specification has been created
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.
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": "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?