Skip to main content
Version: 2026.1

RTK Query API

The RTK Query API (slices) is automatically generated via @rtk-query/codegen-openapi from the OpenAPI specification. This ensures that API definitions, including schemas and types, stay consistent with the backend. Automating this process reduces manual effort, minimizes errors, and keeps the API up-to-date with backend changes.

The generated API slices are fully typed, providing strong TypeScript support and fewer runtime errors. These slices integrate with RTK Query, enabling features such as:

  • Auto-Generated Types: The API slices include TypeScript types generated from the OpenAPI specification. All request parameters, response data, and other API-related structures are strongly typed.
  • Data Caching: Automatically cache API responses for efficient data reuse.
  • Automatic Refetching: Keep your data fresh by refetching it when necessary.
  • Error Handling: Simplify error management with built-in mechanisms.

SDK Imports

Import the generated API slices directly from the SDK. For an overview of available imports, see the SDK API directory.

tip

The structure of the API imports mirrors the folder structure of the linked SDK API directory.

Examples:

// Fetch details of an asset by its ID
import { useAssetGetByIdQuery } from '@pimcore/studio-ui-bundle/api/asset';

// Add a new data object to the system
import { useDataObjectAddMutation } from '@pimcore/studio-ui-bundle/api/data-object';

// Submit a workflow action for a specific element
import { useWorkflowActionSubmitMutation } from '@pimcore/studio-ui-bundle/api/workflow';

All hooks above are generated from the OpenAPI specification. They handle data fetching, loading states, and error management.

For a general explanation of how Studio SDK imports work, refer to the SDK Imports Section.