The REST API
Introduction
'Read the “', Introduction, '” section'The StudioCMS REST API is a powerful tool that allows you to interact with your StudioCMS content programmatically. It provides a simple and flexible way to manage and serve your content using Astro DB.
The StudioCMS REST API is powered by Astro Endpoints and offers a RESTful interface for interacting with your StudioCMS content. Below is a breakdown of the StudioCMS REST API and its components.
API Tokens
'Read the “', API Tokens, '” section'To access the StudioCMS REST API’s protected endpoints, you need to provide an API token in the Authorization
header of your requests. You can generate an API token by logging into the StudioCMS Dashboard and navigating to the “API Tokens” section in the user profile.
Endpoints
'Read the “', Endpoints, '” section'The StudioCMS REST API provides several endpoints that allow you to interact with your StudioCMS content. These endpoints are primarily used internally by StudioCMS but can also be accessed by developers to interact with StudioCMS data. The following are the endpoints provided by the StudioCMS REST API:
Public Endpoints
'Read the “', Public Endpoints, '” section'These endpoints are accessible to the public and do not require authentication. They provide read-only access to the StudioCMS content tree. Therefore, these endpoints only support GET
requests.
/studiocms_api/rest/v1/public/folders/
: Provides a list of all public folders in the StudioCMS content tree./studiocms_api/rest/v1/public/folders/[id]
: Provides details for a specific public folder in the StudioCMS content tree./studiocms_api/rest/v1/public/pages/
: Provides a list of all public pages in the StudioCMS content tree./studiocms_api/rest/v1/public/pages/[id]
: Provides details for a specific public page in the StudioCMS content tree.
Protected Endpoints
'Read the “', Protected Endpoints, '” section'/studiocms_api/rest/v1/folders/
: Provides a list of all folders in the StudioCMS content tree./studiocms_api/rest/v1/folders/[id]
: Provides details for a specific folder in the StudioCMS content tree./studiocms_api/rest/v1/pages/
: Provides a list of all pages in the StudioCMS content tree./studiocms_api/rest/v1/pages/[id]
: Provides details for a specific page in the StudioCMS content tree./studiocms_api/rest/v1/pages/[id]/history/
: Provides a list of all page history entries in the StudioCMS content tree./studiocms_api/rest/v1/pages/[id]/history/[id]
: Provides details for a specific page history entry in the StudioCMS content tree./studiocms_api/rest/v1/settings/
: Provides the StudioCMS settings for the current project./studiocms_api/rest/v1/users/
: Provides a list of all users in the StudioCMS project./studiocms_api/rest/v1/users/[id]
: Provides details for a specific user in the StudioCMS project.