-
Notifications
You must be signed in to change notification settings - Fork 48
docs: Add Themes API endpoint documentation (#471) #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adiati98
merged 19 commits into
mautic:7.0
from
Promptless:promptless/issue-471-themes-api-page
Jun 1, 2026
+302
−5
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
41374c3
Add Themes API endpoint documentation (#471)
promptless[bot] 749cc08
docs: Add Themes API endpoint documentation (#471)
khawarlatifkhan eab0a86
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 0d99b9b
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 0161946
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 0fb1994
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 38d6b07
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 9c1a79a
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 31556ae
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] be2bd23
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 5f85aaa
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 69f47f5
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 55277c1
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] e999641
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 7596200
Merge branch '7.0' into promptless/issue-471-themes-api-page
promptless[bot] 7d2bcc4
Apply reviewer feedback on Themes API documentation
promptless[bot] 0e55d51
Address PR review feedback for Vale warnings
promptless[bot] 35a45d4
Apply reviewer feedback: capitalize ZIP consistently
promptless[bot] 78387dc
Merge branch '7.0' into promptless/issue-471-themes-api-page
adiati98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,311 @@ | ||
| Themes | ||
| ###### | ||
|
|
||
| Use this endpoint to manipulate and obtain details on Mautic's Themes. | ||
|
|
||
| Using the Mautic API library | ||
| **************************** | ||
|
|
||
| .. vale off | ||
|
|
||
| .. note:: | ||
| You can interact with this API using the :xref:`Mautic API Library` as below, or the various HTTP endpoints described in this document. | ||
|
|
||
| .. vale on | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
| use Mautic\MauticApi; | ||
| use Mautic\Auth\ApiAuth; | ||
|
|
||
| // ... | ||
| $initAuth = new ApiAuth(); | ||
| $auth = $initAuth->newAuth($settings); | ||
| $apiUrl = "https://example.com"; | ||
| $api = new MauticApi(); | ||
| $themesApi = $api->newApi("themes", $auth, $apiUrl); | ||
|
|
||
| .. vale off | ||
|
|
||
| Get Theme | ||
| ********* | ||
|
|
||
| .. vale on | ||
|
|
||
| Retrieves the Theme as a ZIP file with the ``application/zip`` header on success, or a JSON response with error messages on failure. The PHP API library saves the ZIP file to the system's temporary directory and retrieves the path. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
||
| //... | ||
| $response = $themesApi->get($themeName); | ||
|
|
||
| .. vale off | ||
|
|
||
| HTTP request | ||
| ============ | ||
|
adiati98 marked this conversation as resolved.
|
||
|
|
||
| .. vale on | ||
|
|
||
| ``GET /themes/THEME_NAME`` | ||
|
|
||
| Response | ||
| ======== | ||
|
|
||
| * Returns ``200 OK`` when the request successfully retrieves the Theme ZIP file. | ||
|
|
||
| .. code-block:: json | ||
|
|
||
| { | ||
| "file": "/absolute/path/to/the/system/temp/dir/with/the/theme/zip/file" | ||
| } | ||
|
|
||
| .. vale off | ||
|
|
||
| Set temporary file path | ||
| *********************** | ||
|
|
||
| .. vale on | ||
|
adiati98 marked this conversation as resolved.
|
||
|
|
||
| Changes the default temporary directory where the PHP API library creates the ZIP file. Creates the directory if it doesn't exist. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
||
| //... | ||
| $themesApi->setTemporaryFilePath("/absolute/path/to/a/different/temp/dir"); | ||
| $response = $themesApi->get($themeName); | ||
|
|
||
| Response | ||
| ======== | ||
|
|
||
| * Returns ``200 OK`` when the request successfully changes or creates the default temporary directory. | ||
|
|
||
| .. code-block:: json | ||
|
|
||
| { | ||
| "file": "/absolute/path/to/a/different/temp/dir/zipfile" | ||
| } | ||
|
adiati98 marked this conversation as resolved.
|
||
|
|
||
| .. vale off | ||
|
|
||
| List Themes | ||
| *********** | ||
|
|
||
| .. vale on | ||
|
|
||
| Lists all installed Themes with details from their ``config.json`` files. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
||
| //... | ||
| $response = $themesApi->getList(); | ||
|
|
||
| .. vale off | ||
|
|
||
| HTTP request | ||
| ============ | ||
|
adiati98 marked this conversation as resolved.
|
||
|
|
||
| .. vale on | ||
|
|
||
| ``GET /themes`` | ||
|
|
||
| Response | ||
| ======== | ||
|
|
||
| * Returns ``200 OK`` when the request successfully retrieves the Themes list. | ||
|
|
||
| .. code-block:: json | ||
|
|
||
| { | ||
| "themes": { | ||
| "blank": { | ||
| "name": "Blank", | ||
| "key": "blank", | ||
| "config": { | ||
| "name": "Blank", | ||
| "author": "Mautic team", | ||
| "authorUrl": "https://mautic.org", | ||
| "features": [ | ||
| "page", | ||
| "email", | ||
| "form" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| The content for this page requires a major update. The legacy page contains outdated and potentially inaccurate information. You can still access it in the :xref:`legacy repository`. | ||
| Properties | ||
| ---------- | ||
|
|
||
|
adiati98 marked this conversation as resolved.
|
||
| If you're interested in helping develop the new content for this page and others, consider joining the documentation efforts. | ||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 20 15 65 | ||
|
|
||
| Please read the :xref:`dev docs contributing guidelines` and :xref:`Contributing to Mautic’s documentation` to get started. | ||
| * - Name | ||
| - Type | ||
| - Description | ||
| * - ``themes`` | ||
| - array | ||
| - List of installed Themes and their configurations | ||
|
|
||
| Theme object properties | ||
| ----------------------- | ||
|
|
||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 20 15 65 | ||
|
|
||
| * - Name | ||
| - Type | ||
| - Description | ||
|
adiati98 marked this conversation as resolved.
|
||
| * - ``name`` | ||
| - string | ||
| - Display name of the Theme | ||
| * - ``key`` | ||
| - string | ||
| - Directory name and unique identifier of the Theme | ||
| * - ``config`` | ||
| - object | ||
| - Theme configuration from ``config.json`` | ||
|
|
||
| .. vale off | ||
|
|
||
| Config object properties | ||
| ------------------------ | ||
|
|
||
| .. vale on | ||
|
|
||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 20 15 65 | ||
|
|
||
| * - Name | ||
| - Type | ||
| - Description | ||
| * - ``name`` | ||
| - string | ||
| - Theme name | ||
| * - ``author`` | ||
| - string | ||
| - Theme author | ||
| * - ``authorUrl`` | ||
| - string | ||
| - Author's website URL | ||
| * - ``features`` | ||
| - array | ||
| - List of supported features such as ``page``, ``email``, or ``form`` | ||
| * - ``builder`` | ||
| - array | ||
| - Optional list of compatible builders such as ``legacy`` or ``grapeJs`` | ||
|
|
||
| .. vale off | ||
|
|
||
| Create Theme | ||
| ************ | ||
|
|
||
| .. vale on | ||
|
|
||
| Creates a new Theme or updates an existing one from the provided ZIP file. The Theme name comes from the ZIP filename. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
||
| //... | ||
| $data = array( | ||
| 'file' => dirname(__DIR__) . '/' . 'mytheme.zip' | ||
| ); | ||
|
|
||
| $response = $themesApi->create($data); | ||
|
|
||
| Mautic sends the file through a standard POST files array, the same way a browser sends files during upload. | ||
|
|
||
| .. vale off | ||
|
|
||
| HTTP request | ||
| ============ | ||
|
adiati98 marked this conversation as resolved.
|
||
|
|
||
| .. vale on | ||
|
|
||
| ``POST /themes/new`` | ||
|
|
||
| POST parameters | ||
| --------------- | ||
|
|
||
| .. list-table:: | ||
| :header-rows: 1 | ||
| :widths: 20 15 65 | ||
|
|
||
| * - Name | ||
| - Type | ||
| - Description | ||
| * - ``file`` | ||
| - file | ||
| - The ZIP file containing the Theme - **required** | ||
|
|
||
| Response | ||
| ======== | ||
|
|
||
| * Returns ``200 OK`` when the request successfully creates a Theme. | ||
|
|
||
| .. code-block:: json | ||
|
|
||
| { | ||
| "success": true | ||
| } | ||
|
|
||
| Error responses | ||
| --------------- | ||
|
|
||
| The API returns error messages if: | ||
|
|
||
| * The request includes no uploaded file | ||
| * The uploaded file doesn't have a ``.zip`` extension | ||
| * The ZIP file is missing required files - ``config.json`` and ``html/message.html.twig`` | ||
| * The ZIP file contains disallowed file extensions | ||
|
|
||
| .. vale off | ||
|
|
||
| Delete Theme | ||
| ************ | ||
|
|
||
| .. vale on | ||
|
|
||
| Deletes a Theme. The system prevents deletion of stock Themes. | ||
|
|
||
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
||
| //... | ||
| $response = $themesApi->delete($themeName); | ||
|
|
||
| .. vale off | ||
|
|
||
| HTTP request | ||
| ============ | ||
|
adiati98 marked this conversation as resolved.
|
||
|
|
||
| .. vale on | ||
|
|
||
| ``DELETE /themes/THEME_NAME/delete`` | ||
|
|
||
| Response | ||
| ======== | ||
|
|
||
| * Returns ``200 OK`` when the request successfully deletes the Theme. | ||
|
|
||
| .. code-block:: json | ||
|
|
||
| { | ||
| "success": true | ||
| } | ||
|
|
||
| .. note:: | ||
|
|
||
| .. vale on | ||
| Mautic prevents permanent deletion of default Themes bundled with the app. Attempting to delete a default Theme hides it instead. Use the Theme visibility toggle in the Mautic UI to restore hidden default Themes. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.