| 1 |
# Elementor Library Connect REST API |
| 2 |
|
| 3 |
This module provides REST API endpoints for connecting and disconnecting your WordPress site to the Elementor Library, similar in purpose to the [](https://developers.elementor.com/docs/cli/library-connect/Elementor CLI Library Connect command](https://developers.elementor.com/docs/cli/library-connect/](https://developers.elementor.com/docs/cli/library-connect/). |
| 4 |
|
| 5 |
## Overview |
| 6 |
|
| 7 |
The REST API allows programmatic connection and disconnection to the Elementor Library, which is useful for automation, integrations, and testing. |
| 8 |
**Note:** The REST API is intended for internal and advanced use, mirroring the functionality of the CLI command. |
| 9 |
|
| 10 |
## Endpoints |
| 11 |
|
| 12 |
### 1. Connect to Elementor Library |
| 13 |
|
| 14 |
- **URL:** `/index.php?rest_route=/elementor/v1/library/connect` |
| 15 |
- **Method:** `POST` |
| 16 |
- **Permissions:** Requires the `manage_options` capability (typically administrators). |
| 17 |
- **Body Parameters:** |
| 18 |
- `token` (string, required): The connect token from your Elementor account dashboard. |
| 19 |
|
| 20 |
#### Example Request |
| 21 |
|
| 22 |
```http |
| 23 |
POST /index.php?rest_route=/elementor/v1/library/connect |
| 24 |
Content-Type: application/json |
| 25 |
Authorization: Basic {{encoded_wp_credentials}} |
| 26 |
|
| 27 |
{ |
| 28 |
"token": "YOUR_CLI_TOKEN" |
| 29 |
} |
| 30 |
``` |
| 31 |
|
| 32 |
#### Example Success Response |
| 33 |
|
| 34 |
```json |
| 35 |
{ |
| 36 |
"success": true, |
| 37 |
"message": "Connected successfully." |
| 38 |
} |
| 39 |
``` |
| 40 |
|
| 41 |
#### Example Error Response |
| 42 |
|
| 43 |
```json |
| 44 |
{ |
| 45 |
"code": "elementor_library_not_connected", |
| 46 |
"message": "Failed to connect to Elementor Library.", |
| 47 |
"data": { |
| 48 |
"status": 500 |
| 49 |
} |
| 50 |
} |
| 51 |
``` |
| 52 |
|
| 53 |
--- |
| 54 |
|
| 55 |
### 2. Disconnect from Elementor Library |
| 56 |
|
| 57 |
- **URL:** `/index.php?rest_route=/elementor/v1/library/connect` |
| 58 |
- **Method:** `DELETE` |
| 59 |
- **Permissions:** Requires the `manage_options` capability. |
| 60 |
|
| 61 |
#### Example Request |
| 62 |
|
| 63 |
```http |
| 64 |
DELETE /index.php?rest_route=/elementor/v1/library/connect |
| 65 |
Authorization: Basic {{encoded_wp_credentials}} |
| 66 |
``` |
| 67 |
|
| 68 |
#### Example Success Response |
| 69 |
|
| 70 |
```json |
| 71 |
{ |
| 72 |
"success": true, |
| 73 |
"message": "Disconnected successfully." |
| 74 |
} |
| 75 |
``` |
| 76 |
|
| 77 |
#### Example Error Response |
| 78 |
|
| 79 |
```json |
| 80 |
{ |
| 81 |
"code": "elementor_library_disconnect_error", |
| 82 |
"message": "Error message here", |
| 83 |
"data": { |
| 84 |
"status": 500 |
| 85 |
} |
| 86 |
} |
| 87 |
``` |
| 88 |
|
| 89 |
--- |
| 90 |
|
| 91 |
## Permissions |
| 92 |
|
| 93 |
All endpoints require the user to have the `manage_options` capability. |
| 94 |
|
| 95 |
## Error Handling |
| 96 |
|
| 97 |
Errors are returned as standard WordPress REST API error objects, with a `code`, `message`, and HTTP status. |
| 98 |
|
| 99 |
## Reference |
| 100 |
|
| 101 |
- For CLI usage and more context, see the [](https://developers.elementor.com/docs/cli/library-connect/Elementor CLI Library Connect documentation](https://developers.elementor.com/docs/cli/library-connect/](https://developers.elementor.com/docs/cli/library-connect/). |
| 102 |
|