Space content

Import, export, and search content in a space.

Handle your space content programmatically by creating, updating, or listing pages and files. Ideal for bulk operations or synchronizing with external systems.

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Query parameters
querystring · max: 512required
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/search?query=text' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "id": "text",
      "title": "text",
      "path": "text",
      "sections": [
        {
          "id": "text",
          "title": "text",
          "path": "text",
          "body": "text",
          "urls": {
            "app": "https://example.com"
          }
        }
      ],
      "urls": {
        "app": "https://example.com"
      }
    }
  ]
}

Get a space current revision

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "object": "revision",
  "id": "text",
  "parents": [
    "text"
  ],
  "pages": [
    "[Circular Reference]"
  ],
  "files": [
    {
      "id": "text",
      "name": "text",
      "contentType": "text",
      "downloadURL": "text",
      "size": 1,
      "dimensions": {
        "width": 1,
        "height": 1
      },
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ],
  "reusableContents": [
    {
      "id": "text",
      "title": "text",
      "document": "text",
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ],
  "createdAt": "2025-04-12T21:04:01.285Z",
  "git": {
    "oid": "text",
    "message": "text",
    "createdByGitBook": true,
    "url": "text",
    "ref": "text"
  },
  "urls": {
    "app": "https://example.com",
    "published": "https://example.com",
    "public": "https://example.com"
  },
  "type": "edits"
}

Import content in a space

post
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Body
urlstring · urirequired

URL of the content to import.

sourcestring · enumrequiredAvailable options:
Responses
curl -L \
  --request POST \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/import' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "url": "https://example.com",
    "source": "website"
  }'
{
  "revision": "text",
  "importedResources": 1,
  "totalResources": 1
}

List all space pages

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/pages' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "pages": [
    {
      "id": "text",
      "title": "text",
      "emoji": "🎉",
      "icon": "gear",
      "createdAt": "2025-04-12T21:04:01.285Z",
      "updatedAt": "2025-04-12T21:04:01.285Z",
      "markdown": "text",
      "type": "document",
      "urls": {
        "app": "https://example.com"
      },
      "slug": "text",
      "path": "text",
      "description": "text",
      "documentId": "text",
      "pages": [
        "[Circular Reference]"
      ],
      "git": {
        "oid": "text",
        "path": "text"
      },
      "layout": {
        "cover": true,
        "coverSize": "hero",
        "title": true,
        "description": true,
        "tableOfContents": true,
        "outline": true,
        "pagination": true
      },
      "cover": {
        "ref": {
          "kind": "file",
          "file": "text"
        },
        "yPos": 1
      },
      "hidden": true,
      "noIndex": true,
      "noRobotsIndex": true,
      "computed": {
        "type": "builtin:openapi",
        "dependencies": {
          "spec": {
            "ref": {
              "kind": "openapi",
              "spec": "text"
            }
          }
        },
        "props": {
          "doc": "models"
        }
      },
      "computedSeed": "text"
    }
  ]
}

List all space files

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Query parameters
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/files' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "id": "text",
      "name": "text",
      "contentType": "text",
      "downloadURL": "text",
      "size": 1,
      "dimensions": {
        "width": 1,
        "height": 1
      },
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ]
}

Get a space file by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

fileIdstringrequired

The unique id of the file

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/files/{fileId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "name": "text",
  "contentType": "text",
  "downloadURL": "text",
  "size": 1,
  "dimensions": {
    "width": 1,
    "height": 1
  },
  "git": {
    "oid": "text",
    "path": "text"
  }
}
get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

fileIdstringrequired

The unique id of the file

Query parameters
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/files/{fileId}/backlinks' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "kind": "file",
      "organization": {
        "object": "organization",
        "id": "text",
        "title": "text",
        "createdAt": "2025-04-12T21:04:01.285Z",
        "emailDomains": [
          "text"
        ],
        "hostname": "text",
        "type": "business",
        "useCase": "internalDocs",
        "communityType": "nonProfit",
        "defaultRole": "admin",
        "defaultContent": {
          "type": "site",
          "site": "text"
        },
        "sso": true,
        "ai": true,
        "inviteLinks": true,
        "plan": "free_2024",
        "billing": {
          "interval": "monthly",
          "endDate": "2025-04-12T21:04:01.285Z",
          "hasPaymentFailed": true,
          "isScheduledToCancel": true
        },
        "urls": {
          "location": "https://example.com",
          "app": "https://example.com",
          "logo": "https://example.com"
        },
        "trial": {
          "status": "notapplicable",
          "endDate": "2025-04-12T21:04:01.285Z",
          "decision": "downgrade"
        },
        "customHostname": "text",
        "blocked": {
          "reason": "security"
        },
        "internal_isOnNewTrial": true,
        "internal_billingMigration": {
          "deadline": "2025-04-12T21:04:01.285Z",
          "discountPercent": 1,
          "discountEndDate": "2025-04-12T21:04:01.285Z"
        },
        "permissions": {
          "admin": true,
          "createContent": true
        }
      },
      "space": {
        "object": "space",
        "id": "text",
        "title": "text",
        "emoji": "🎉",
        "visibility": "public",
        "createdAt": "2025-04-12T21:04:01.285Z",
        "updatedAt": "2025-04-12T21:04:01.285Z",
        "deletedAt": "2025-04-12T21:04:01.285Z",
        "editMode": "live",
        "urls": {
          "location": "https://example.com",
          "app": "https://example.com",
          "published": "https://example.com",
          "public": "https://example.com",
          "icon": "https://example.com"
        },
        "organization": "text",
        "parent": "text",
        "gitSync": {
          "repoName": "text",
          "installationProvider": "github",
          "integration": "text",
          "url": "text",
          "updatedAt": "2025-04-12T21:04:01.285Z"
        },
        "visitorAuth": {
          "backend": "custom"
        },
        "revision": "text",
        "defaultLevel": "admin",
        "comments": 1,
        "changeRequests": 1,
        "changeRequestsOpen": 1,
        "changeRequestsDraft": 1,
        "permissions": {
          "access": true,
          "admin": true,
          "edit": true,
          "comment": true,
          "merge": true,
          "review": true
        }
      },
      "versionContext": {
        "type": "revision",
        "revision": "[Circular Reference]"
      },
      "file": {
        "id": "text",
        "name": "text",
        "contentType": "text",
        "downloadURL": "text",
        "size": 1,
        "dimensions": {
          "width": 1,
          "height": 1
        },
        "git": {
          "oid": "text",
          "path": "text"
        }
      }
    }
  ]
}

Get a space page by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

pageIdstringrequired

The unique id of the page

Query parameters
formatstring · enumoptional

Output format for the content.

Available options:
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/page/{pageId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "title": "text",
  "emoji": "🎉",
  "icon": "gear",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "updatedAt": "2025-04-12T21:04:01.285Z",
  "markdown": "text",
  "type": "document",
  "urls": {
    "app": "https://example.com"
  },
  "slug": "text",
  "path": "text",
  "description": "text",
  "documentId": "text",
  "pages": [
    "[Circular Reference]"
  ],
  "git": {
    "oid": "text",
    "path": "text"
  },
  "layout": {
    "cover": true,
    "coverSize": "hero",
    "title": true,
    "description": true,
    "tableOfContents": true,
    "outline": true,
    "pagination": true
  },
  "cover": {
    "ref": {
      "kind": "file",
      "file": "text"
    },
    "yPos": 1
  },
  "hidden": true,
  "noIndex": true,
  "noRobotsIndex": true,
  "computed": {
    "type": "builtin:openapi",
    "dependencies": {
      "spec": {
        "ref": {
          "kind": "openapi",
          "spec": "text"
        }
      }
    },
    "props": {
      "doc": "models"
    }
  },
  "computedSeed": "text"
}
get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

pageIdstringrequired

The unique id of the page

Query parameters
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

statusstring · enumoptional

Text to display to represent the reference. Possible values include:

  • ok - No problems detected for this content reference.
  • broken - The target does not exist in the revision.
  • in-app - The target is a URL link pointing to an internal location in the app.
Available options:
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/page/{pageId}/links' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "stats": {
    "total": 1,
    "broken": {
      "total": 1,
      "changeRequest": 1
    }
  },
  "items": [
    {
      "status": "ok",
      "relation": "reference",
      "targetReference": {
        "kind": "file",
        "organization": {
          "object": "organization",
          "id": "text",
          "title": "text",
          "createdAt": "2025-04-12T21:04:01.285Z",
          "emailDomains": [
            "text"
          ],
          "hostname": "text",
          "type": "business",
          "useCase": "internalDocs",
          "communityType": "nonProfit",
          "defaultRole": "admin",
          "defaultContent": {
            "type": "site",
            "site": "text"
          },
          "sso": true,
          "ai": true,
          "inviteLinks": true,
          "plan": "free_2024",
          "billing": {
            "interval": "monthly",
            "endDate": "2025-04-12T21:04:01.285Z",
            "hasPaymentFailed": true,
            "isScheduledToCancel": true
          },
          "urls": {
            "location": "https://example.com",
            "app": "https://example.com",
            "logo": "https://example.com"
          },
          "trial": {
            "status": "notapplicable",
            "endDate": "2025-04-12T21:04:01.285Z",
            "decision": "downgrade"
          },
          "customHostname": "text",
          "blocked": {
            "reason": "security"
          },
          "internal_isOnNewTrial": true,
          "internal_billingMigration": {
            "deadline": "2025-04-12T21:04:01.285Z",
            "discountPercent": 1,
            "discountEndDate": "2025-04-12T21:04:01.285Z"
          },
          "permissions": {
            "admin": true,
            "createContent": true
          }
        },
        "space": {
          "object": "space",
          "id": "text",
          "title": "text",
          "emoji": "🎉",
          "visibility": "public",
          "createdAt": "2025-04-12T21:04:01.285Z",
          "updatedAt": "2025-04-12T21:04:01.285Z",
          "deletedAt": "2025-04-12T21:04:01.285Z",
          "editMode": "live",
          "urls": {
            "location": "https://example.com",
            "app": "https://example.com",
            "published": "https://example.com",
            "public": "https://example.com",
            "icon": "https://example.com"
          },
          "organization": "text",
          "parent": "text",
          "gitSync": {
            "repoName": "text",
            "installationProvider": "github",
            "integration": "text",
            "url": "text",
            "updatedAt": "2025-04-12T21:04:01.285Z"
          },
          "visitorAuth": {
            "backend": "custom"
          },
          "revision": "text",
          "defaultLevel": "admin",
          "comments": 1,
          "changeRequests": 1,
          "changeRequestsOpen": 1,
          "changeRequestsDraft": 1,
          "permissions": {
            "access": true,
            "admin": true,
            "edit": true,
            "comment": true,
            "merge": true,
            "review": true
          }
        },
        "versionContext": "[Circular Reference]",
        "file": {
          "id": "text",
          "name": "text",
          "contentType": "text",
          "downloadURL": "text",
          "size": 1,
          "dimensions": {
            "width": 1,
            "height": 1
          },
          "git": {
            "oid": "text",
            "path": "text"
          }
        }
      },
      "locationReferences": [
        {
          "kind": "file",
          "organization": {
            "object": "organization",
            "id": "text",
            "title": "text",
            "createdAt": "2025-04-12T21:04:01.285Z",
            "emailDomains": [
              "text"
            ],
            "hostname": "text",
            "type": "business",
            "useCase": "internalDocs",
            "communityType": "nonProfit",
            "defaultRole": "admin",
            "defaultContent": {
              "type": "site",
              "site": "text"
            },
            "sso": true,
            "ai": true,
            "inviteLinks": true,
            "plan": "free_2024",
            "billing": {
              "interval": "monthly",
              "endDate": "2025-04-12T21:04:01.285Z",
              "hasPaymentFailed": true,
              "isScheduledToCancel": true
            },
            "urls": {
              "location": "https://example.com",
              "app": "https://example.com",
              "logo": "https://example.com"
            },
            "trial": {
              "status": "notapplicable",
              "endDate": "2025-04-12T21:04:01.285Z",
              "decision": "downgrade"
            },
            "customHostname": "text",
            "blocked": {
              "reason": "security"
            },
            "internal_isOnNewTrial": true,
            "internal_billingMigration": {
              "deadline": "2025-04-12T21:04:01.285Z",
              "discountPercent": 1,
              "discountEndDate": "2025-04-12T21:04:01.285Z"
            },
            "permissions": {
              "admin": true,
              "createContent": true
            }
          },
          "space": {
            "object": "space",
            "id": "text",
            "title": "text",
            "emoji": "🎉",
            "visibility": "public",
            "createdAt": "2025-04-12T21:04:01.285Z",
            "updatedAt": "2025-04-12T21:04:01.285Z",
            "deletedAt": "2025-04-12T21:04:01.285Z",
            "editMode": "live",
            "urls": {
              "location": "https://example.com",
              "app": "https://example.com",
              "published": "https://example.com",
              "public": "https://example.com",
              "icon": "https://example.com"
            },
            "organization": "text",
            "parent": "text",
            "gitSync": {
              "repoName": "text",
              "installationProvider": "github",
              "integration": "text",
              "url": "text",
              "updatedAt": "2025-04-12T21:04:01.285Z"
            },
            "visitorAuth": {
              "backend": "custom"
            },
            "revision": "text",
            "defaultLevel": "admin",
            "comments": 1,
            "changeRequests": 1,
            "changeRequestsOpen": 1,
            "changeRequestsDraft": 1,
            "permissions": {
              "access": true,
              "admin": true,
              "edit": true,
              "comment": true,
              "merge": true,
              "review": true
            }
          },
          "versionContext": "[Circular Reference]",
          "file": {
            "id": "text",
            "name": "text",
            "contentType": "text",
            "downloadURL": "text",
            "size": 1,
            "dimensions": {
              "width": 1,
              "height": 1
            },
            "git": {
              "oid": "text",
              "path": "text"
            }
          }
        }
      ]
    }
  ]
}
get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

pageIdstringrequired

The unique id of the page

Query parameters
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/page/{pageId}/backlinks' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "kind": "file",
      "organization": {
        "object": "organization",
        "id": "text",
        "title": "text",
        "createdAt": "2025-04-12T21:04:01.285Z",
        "emailDomains": [
          "text"
        ],
        "hostname": "text",
        "type": "business",
        "useCase": "internalDocs",
        "communityType": "nonProfit",
        "defaultRole": "admin",
        "defaultContent": {
          "type": "site",
          "site": "text"
        },
        "sso": true,
        "ai": true,
        "inviteLinks": true,
        "plan": "free_2024",
        "billing": {
          "interval": "monthly",
          "endDate": "2025-04-12T21:04:01.285Z",
          "hasPaymentFailed": true,
          "isScheduledToCancel": true
        },
        "urls": {
          "location": "https://example.com",
          "app": "https://example.com",
          "logo": "https://example.com"
        },
        "trial": {
          "status": "notapplicable",
          "endDate": "2025-04-12T21:04:01.285Z",
          "decision": "downgrade"
        },
        "customHostname": "text",
        "blocked": {
          "reason": "security"
        },
        "internal_isOnNewTrial": true,
        "internal_billingMigration": {
          "deadline": "2025-04-12T21:04:01.285Z",
          "discountPercent": 1,
          "discountEndDate": "2025-04-12T21:04:01.285Z"
        },
        "permissions": {
          "admin": true,
          "createContent": true
        }
      },
      "space": {
        "object": "space",
        "id": "text",
        "title": "text",
        "emoji": "🎉",
        "visibility": "public",
        "createdAt": "2025-04-12T21:04:01.285Z",
        "updatedAt": "2025-04-12T21:04:01.285Z",
        "deletedAt": "2025-04-12T21:04:01.285Z",
        "editMode": "live",
        "urls": {
          "location": "https://example.com",
          "app": "https://example.com",
          "published": "https://example.com",
          "public": "https://example.com",
          "icon": "https://example.com"
        },
        "organization": "text",
        "parent": "text",
        "gitSync": {
          "repoName": "text",
          "installationProvider": "github",
          "integration": "text",
          "url": "text",
          "updatedAt": "2025-04-12T21:04:01.285Z"
        },
        "visitorAuth": {
          "backend": "custom"
        },
        "revision": "text",
        "defaultLevel": "admin",
        "comments": 1,
        "changeRequests": 1,
        "changeRequestsOpen": 1,
        "changeRequestsDraft": 1,
        "permissions": {
          "access": true,
          "admin": true,
          "edit": true,
          "comment": true,
          "merge": true,
          "review": true
        }
      },
      "versionContext": {
        "type": "revision",
        "revision": "[Circular Reference]"
      },
      "file": {
        "id": "text",
        "name": "text",
        "contentType": "text",
        "downloadURL": "text",
        "size": 1,
        "dimensions": {
          "width": 1,
          "height": 1
        },
        "git": {
          "oid": "text",
          "path": "text"
        }
      }
    }
  ]
}

Import content into a space page

post
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

pageIdstringrequired

The unique id of the page

Body
urlstring · urirequired

URL of the content to import.

sourcestring · enumrequiredAvailable options:
Responses
curl -L \
  --request POST \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/page/{pageId}/import' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "url": "https://example.com",
    "source": "website"
  }'
{
  "revision": "text",
  "importedResources": 1,
  "totalResources": 1
}

Get a space page by its path

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

pagePathstringrequired

The path of the page in the revision.

Query parameters
formatstring · enumoptional

Output format for the content.

Available options:
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/path/{pagePath}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "title": "text",
  "emoji": "🎉",
  "icon": "gear",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "updatedAt": "2025-04-12T21:04:01.285Z",
  "markdown": "text",
  "type": "document",
  "urls": {
    "app": "https://example.com"
  },
  "slug": "text",
  "path": "text",
  "description": "text",
  "documentId": "text",
  "pages": [
    "[Circular Reference]"
  ],
  "git": {
    "oid": "text",
    "path": "text"
  },
  "layout": {
    "cover": true,
    "coverSize": "hero",
    "title": true,
    "description": true,
    "tableOfContents": true,
    "outline": true,
    "pagination": true
  },
  "cover": {
    "ref": {
      "kind": "file",
      "file": "text"
    },
    "yPos": 1
  },
  "hidden": true,
  "noIndex": true,
  "noRobotsIndex": true,
  "computed": {
    "type": "builtin:openapi",
    "dependencies": {
      "spec": {
        "ref": {
          "kind": "openapi",
          "spec": "text"
        }
      }
    },
    "props": {
      "doc": "models"
    }
  },
  "computedSeed": "text"
}

Get a space reusable content by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

reusableContentIdstringrequired

The unique id of the reusable content

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/reusable-contents/{reusableContentId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "title": "text",
  "document": "text",
  "git": {
    "oid": "text",
    "path": "text"
  }
}

Get a space computed document

post
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Query parameters
schemastring · enumoptional

Version of the schema used for the document.

Available options:
Body
sourceone ofrequired

Parameters for a computed content managed by an integration

seedstringrequired

Seed to use for the generation of IDs.

Responses
curl -L \
  --request POST \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/computed/document' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "source": {
      "type": "builtin:openapi",
      "dependencies": {
        "spec": {
          "ref": {
            "kind": "openapi",
            "spec": "text"
          }
        }
      },
      "props": {
        "doc": "models"
      }
    },
    "seed": "text"
  }'
{
  "object": "document",
  "data": {
    "schemaVersion": 1,
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "nodes": [
    {
      "object": "block",
      "type": "paragraph",
      "key": "text",
      "nodes": [
        {
          "object": "inline",
          "type": "link",
          "key": "text",
          "nodes": [
            {
              "object": "text",
              "key": "text",
              "leaves": [
                {
                  "object": "leaf",
                  "text": "text",
                  "marks": [
                    {
                      "object": "mark",
                      "type": "bold"
                    }
                  ]
                }
              ]
            }
          ],
          "data": {
            "ref": {
              "kind": "file",
              "file": "text"
            }
          },
          "isVoid": false
        }
      ],
      "isVoid": false,
      "data": {}
    }
  ]
}

Get a space computed revision

post
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Body
sourceone ofrequired

Parameters for a computed content managed by an integration

seedstringrequired

Seed to use for the generation of IDs.

Responses
curl -L \
  --request POST \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/content/computed/revision' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "source": {
      "type": "builtin:openapi",
      "dependencies": {
        "spec": {
          "ref": {
            "kind": "openapi",
            "spec": "text"
          }
        }
      },
      "props": {
        "models": true
      }
    },
    "seed": "text"
  }'
{
  "pages": [
    {
      "id": "text",
      "title": "text",
      "emoji": "🎉",
      "icon": "gear",
      "createdAt": "2025-04-12T21:04:01.285Z",
      "updatedAt": "2025-04-12T21:04:01.285Z",
      "markdown": "text",
      "type": "document",
      "urls": {
        "app": "https://example.com"
      },
      "slug": "text",
      "path": "text",
      "description": "text",
      "documentId": "text",
      "pages": [
        "[Circular Reference]"
      ],
      "git": {
        "oid": "text",
        "path": "text"
      },
      "layout": {
        "cover": true,
        "coverSize": "hero",
        "title": true,
        "description": true,
        "tableOfContents": true,
        "outline": true,
        "pagination": true
      },
      "cover": {
        "ref": {
          "kind": "file",
          "file": "text"
        },
        "yPos": 1
      },
      "hidden": true,
      "noIndex": true,
      "noRobotsIndex": true,
      "computed": {
        "type": "builtin:openapi",
        "dependencies": {
          "spec": {
            "ref": {
              "kind": "openapi",
              "spec": "text"
            }
          }
        },
        "props": {
          "doc": "models"
        }
      },
      "computedSeed": "text"
    }
  ],
  "files": [
    {
      "id": "text",
      "name": "text",
      "contentType": "text",
      "downloadURL": "text",
      "size": 1,
      "dimensions": {
        "width": 1,
        "height": 1
      },
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ]
}

Get a space document by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

documentIdstringrequired

ID of the document in the space

Query parameters
schemastring · enumoptional

Version of the schema used for the document.

Available options:
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/documents/{documentId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "object": "document",
  "data": {
    "schemaVersion": 1,
    "ANY_ADDITIONAL_PROPERTY": "anything"
  },
  "nodes": [
    {
      "object": "block",
      "type": "paragraph",
      "key": "text",
      "nodes": [
        {
          "object": "inline",
          "type": "link",
          "key": "text",
          "nodes": [
            {
              "object": "text",
              "key": "text",
              "leaves": [
                {
                  "object": "leaf",
                  "text": "text",
                  "marks": [
                    {
                      "object": "mark",
                      "type": "bold"
                    }
                  ]
                }
              ]
            }
          ],
          "data": {
            "ref": {
              "kind": "file",
              "file": "text"
            }
          },
          "isVoid": false
        }
      ],
      "isVoid": false,
      "data": {}
    }
  ]
}

Get a space revision

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "object": "revision",
  "id": "text",
  "parents": [
    "text"
  ],
  "pages": [
    "[Circular Reference]"
  ],
  "files": [
    {
      "id": "text",
      "name": "text",
      "contentType": "text",
      "downloadURL": "text",
      "size": 1,
      "dimensions": {
        "width": 1,
        "height": 1
      },
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ],
  "reusableContents": [
    {
      "id": "text",
      "title": "text",
      "document": "text",
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ],
  "createdAt": "2025-04-12T21:04:01.285Z",
  "git": {
    "oid": "text",
    "message": "text",
    "createdByGitBook": true,
    "url": "text",
    "ref": "text"
  },
  "urls": {
    "app": "https://example.com",
    "published": "https://example.com",
    "public": "https://example.com"
  },
  "type": "edits"
}

Get space revision semantic changes

get

Return the semantic changes between a revision and its parent.

Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
limitnumberoptional

Limit the number of changes returned

Default: 10
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/changes' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "changes": [
    {
      "type": "page_created",
      "page": {
        "id": "text",
        "type": "document",
        "title": "text",
        "path": "text"
      }
    }
  ],
  "more": 1
}

List all pages in a space revision

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/pages' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "pages": [
    {
      "id": "text",
      "title": "text",
      "emoji": "🎉",
      "icon": "gear",
      "createdAt": "2025-04-12T21:04:01.285Z",
      "updatedAt": "2025-04-12T21:04:01.285Z",
      "markdown": "text",
      "type": "document",
      "urls": {
        "app": "https://example.com"
      },
      "slug": "text",
      "path": "text",
      "description": "text",
      "documentId": "text",
      "pages": [
        "[Circular Reference]"
      ],
      "git": {
        "oid": "text",
        "path": "text"
      },
      "layout": {
        "cover": true,
        "coverSize": "hero",
        "title": true,
        "description": true,
        "tableOfContents": true,
        "outline": true,
        "pagination": true
      },
      "cover": {
        "ref": {
          "kind": "file",
          "file": "text"
        },
        "yPos": 1
      },
      "hidden": true,
      "noIndex": true,
      "noRobotsIndex": true,
      "computed": {
        "type": "builtin:openapi",
        "dependencies": {
          "spec": {
            "ref": {
              "kind": "openapi",
              "spec": "text"
            }
          }
        },
        "props": {
          "doc": "models"
        }
      },
      "computedSeed": "text"
    }
  ]
}

List all space revision files

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

Query parameters
pagestringoptional

Identifier of the page results to fetch.

limitnumber · max: 1000optional

The number of results per page

metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/files' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "next": {
    "page": "text"
  },
  "count": 1,
  "items": [
    {
      "id": "text",
      "name": "text",
      "contentType": "text",
      "downloadURL": "text",
      "size": 1,
      "dimensions": {
        "width": 1,
        "height": 1
      },
      "git": {
        "oid": "text",
        "path": "text"
      }
    }
  ]
}

Get a space revision file by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

fileIdstringrequired

The unique id of the file

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/files/{fileId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "name": "text",
  "contentType": "text",
  "downloadURL": "text",
  "size": 1,
  "dimensions": {
    "width": 1,
    "height": 1
  },
  "git": {
    "oid": "text",
    "path": "text"
  }
}

Get a space revision page by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

pageIdstringrequired

The unique id of the page

Query parameters
formatstring · enumoptional

Output format for the content.

Available options:
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/page/{pageId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "title": "text",
  "emoji": "🎉",
  "icon": "gear",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "updatedAt": "2025-04-12T21:04:01.285Z",
  "markdown": "text",
  "type": "document",
  "urls": {
    "app": "https://example.com"
  },
  "slug": "text",
  "path": "text",
  "description": "text",
  "documentId": "text",
  "pages": [
    "[Circular Reference]"
  ],
  "git": {
    "oid": "text",
    "path": "text"
  },
  "layout": {
    "cover": true,
    "coverSize": "hero",
    "title": true,
    "description": true,
    "tableOfContents": true,
    "outline": true,
    "pagination": true
  },
  "cover": {
    "ref": {
      "kind": "file",
      "file": "text"
    },
    "yPos": 1
  },
  "hidden": true,
  "noIndex": true,
  "noRobotsIndex": true,
  "computed": {
    "type": "builtin:openapi",
    "dependencies": {
      "spec": {
        "ref": {
          "kind": "openapi",
          "spec": "text"
        }
      }
    },
    "props": {
      "doc": "models"
    }
  },
  "computedSeed": "text"
}

Get a space revision page by its path

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

pagePathstringrequired

The path of the page in the revision.

Query parameters
formatstring · enumoptional

Output format for the content.

Available options:
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/path/{pagePath}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "title": "text",
  "emoji": "🎉",
  "icon": "gear",
  "createdAt": "2025-04-12T21:04:01.285Z",
  "updatedAt": "2025-04-12T21:04:01.285Z",
  "markdown": "text",
  "type": "document",
  "urls": {
    "app": "https://example.com"
  },
  "slug": "text",
  "path": "text",
  "description": "text",
  "documentId": "text",
  "pages": [
    "[Circular Reference]"
  ],
  "git": {
    "oid": "text",
    "path": "text"
  },
  "layout": {
    "cover": true,
    "coverSize": "hero",
    "title": true,
    "description": true,
    "tableOfContents": true,
    "outline": true,
    "pagination": true
  },
  "cover": {
    "ref": {
      "kind": "file",
      "file": "text"
    },
    "yPos": 1
  },
  "hidden": true,
  "noIndex": true,
  "noRobotsIndex": true,
  "computed": {
    "type": "builtin:openapi",
    "dependencies": {
      "spec": {
        "ref": {
          "kind": "openapi",
          "spec": "text"
        }
      }
    },
    "props": {
      "doc": "models"
    }
  },
  "computedSeed": "text"
}

Get a space revision reusable content by its ID

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

revisionIdstringrequired

The unique id of the revision

reusableContentIdstringrequired

The unique id of the reusable content

Query parameters
metadatabooleanoptional

If false is passed, "git" mutable metadata will not returned. Passing false can optimize performances of the lookup.

Default: true
computedbooleanoptional

If false is passed, content will not be computed

Default: true
Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/revisions/{revisionId}/reusable-contents/{reusableContentId}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "text",
  "title": "text",
  "document": "text",
  "git": {
    "oid": "text",
    "path": "text"
  }
}

Get a URL of the content of a space as PDF

get
Authorizations
Path parameters
spaceIdstringrequired

The unique id of the space

Query parameters
onlybooleanoptional

Generate a PDF only for the provided page.

pagestringoptional

ID of a specific page to generate a PDF for.

Responses
curl -L \
  --url 'https://api.gitbook.com/v1/spaces/{spaceId}/pdf' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "url": "https://example.com"
}

Was this helpful?