Overview
If you need to identify which of your users have created User Saved Blocks, you can retrieve this information using the Unlayer API.
The API returns both User Saved Blocks and Shared Project Blocks for a specific user, allowing you to determine which users have saved blocks and how many they have created.
API Endpoint
Use the following endpoint to retrieve the blocks for a specific user:
GET https://api.unlayer.com/v2/editor/blocks?displayMode=<displayMode>&userId=<userId>
Replace:
<displayMode>with one of the supported display modes:emailwebdocumentpopup
<userId>with your specific user ID.
Authenticate the request using your Project API Key with HTTP Basic Authentication, the same authentication method used by the Export API.
Important Notes
Before implementing this workflow, keep the following in mind:
Unlayer does not provide an endpoint to retrieve all of your users. You'll need to use the user IDs stored in your own application.
Requests are made per user and per display mode. There is currently no bulk endpoint to retrieve this information for all users at once.
This workflow uses the v2 Blocks API. The newer v3 endpoint requires an in-editor authentication token and is not suitable for this use case.
Common Use Cases
This API can be used to:
Identify which users have created User Saved Blocks.
Count the number of User Saved Blocks each user has.
Prepare for migrations or storage changes.
Audit User Saved Block usage across your application.
Generate internal usage reports.
Frequently Asked Questions
Can I retrieve all users who have saved blocks?
No. You'll need to use the list of user IDs maintained by your own application and retrieve the blocks for each user individually.
Can I retrieve all User Saved Blocks in a single request?
No. The API retrieves blocks for one user at a time, so you'll need to iterate through your users and the supported display modes.
Which API should I use?
Use the v2 Blocks API for this workflow. The v3 endpoint requires an in-editor authentication token and is not intended for retrieving User Saved Blocks using your Project API credentials.
