Storyblok
Search Storyblok's Documentation
  1. Introduction

Introduction

Space plugins operate at the space level and outside the Visual Editor, making them ideal for embedding functionality within Storyblok that does not require direct content editing. For example, the Broken Links Checker to scan for broken links or a Google Analytics app to display data directly in Storyblok.

Integrating with the Management API

Server-side code can interact with the Management API by reading accessToken and spaceId from http.IncomingMessage:

const { query } = req;
const sessionStore = sessionCookieStore(authHandlerParams)({ req, res });
const { accessToken, region, spaceId } = await sessionStore.get(query);

The @storyblok/app-extension-auth library automatically appends storyId and spaceId as query parameters, enabling access to accessToken and region from the session store. With these values, send Management API requests, such as:

new StoryblokClient({
    oauthToken: `Bearer ${accessToken}`,
    region,
})
.get(`spaces/${spaceId.toString(10)}/stories`, { sort_by: 'updated_at:desc' });

Take a look at our starter projects for similar examples.

Space-Level Settings

The Enable settings on space levels toggle in the Extension details at the Partner Portal allows configuration at the space level, available for Space plugins and Tool plugins only. Use OAuth credentials from the OAuth 2.0 API to access these settings.

Retrieve settings with the following endpoint:

curl --location '<https://mapi.storyblok.com/v1/spaces/{{space_id}>}/app_provisions/{{app_id}}' \\
 --header 'Authorization: Bearer {{oauth_token}}'