Tweets
Use this endpoint to obtain details on Mautic’s Tweets.
Note
The Tweets feature is part of the Mautic Bundle for Social Plugin. Integration with Twitter must be active for this API to work.
Using the Mautic API library
You can interact with this API using the Mautic API Library as below, or the various HTTP endpoints described in this document.
<?php
use Mautic\MauticApi;
use Mautic\Auth\ApiAuth;
// ...
$initAuth = new ApiAuth();
$auth = $initAuth->newAuth($settings);
$apiUrl = "https://example.com";
$api = new MauticApi();
$tweetApi = $api->newApi("tweets", $auth, $apiUrl);
Get Tweet
Retrieves an individual Tweet by ID.
<?php
//...
$tweet = $tweetApi->get($id);
HTTP request
GET /tweets/ID
Response
Returns
200 OKwhen the request successfully retrieves the Tweet.
{
"tweet": {
"isPublished": true,
"dateAdded": "2026-02-03T17:51:58+00:00",
"dateModified": "2026-03-28T11:03:03+00:00",
"createdBy": 1,
"createdByUser": "John Doe",
"modifiedBy": 1,
"modifiedByUser": "John Doe",
"id": 1,
"name": "Thank you tweet",
"text": "Hi {twitter_handle}\n\nThanks for ...",
"description": "Used in the Product A campaign 1",
"language": "en",
"category": {
"createdByUser": "John Doe",
"modifiedByUser": null,
"id": 185,
"title": "Thank you tweets",
"alias": "thank-you-tweets",
"description": null,
"color": "244bc9",
"bundle": "global"
},
"mediaId": null,
"mediaPath": null,
"sentCount": 3,
"favoriteCount": 0,
"retweetCount": 0
}
}
Tweet properties
Name |
Type |
Description |
|---|---|---|
|
integer |
ID of the Tweet |
|
string |
Title of the Tweet |
|
string |
Message content of the Tweet. Maximum 280 characters. |
|
string |
Internal description for the Tweet |
|
boolean |
Tweet publication status |
|
datetime |
Activation date and time for the Tweet |
|
datetime |
Deactivation date and time for the Tweet |
|
datetime |
Tweet record creation date and time |
|
integer |
ID of the User who created the Tweet |
|
string |
Name of the User who created the Tweet |
|
datetime |
Tweet record last modification date and time |
|
integer |
ID of the User who last modified the Tweet |
|
string |
Name of the User who last modified the Tweet |
|
string |
The language code for the Tweet, such as |
|
object |
The Category for the Tweet |
|
string |
ID of the Twitter media object attached to the Tweet |
|
string |
Path to the local media file |
|
integer |
Number of times this Tweet has been sent |
|
integer |
Number of favorites or likes on the Tweet |
|
integer |
Number of retweets |
List Tweets
Retrieves a list of Tweets.
<?php
// ...
$tweets = $tweetApi->getList($searchFilter, $start, $limit, $orderBy, $orderByDir, $publishedOnly, $minimal);
HTTP request
GET /tweets
Query parameters
Name |
Type |
Description |
|---|---|---|
|
string |
String or search command to filter entities |
|
integer |
Starting row for the returned entities - defaults to 0 |
|
integer |
Maximum number of entities to return - defaults to 30 |
|
string |
Column to sort by. Any column in the response is valid. Note: convert |
|
string |
Order direction - |
|
boolean |
Returns only currently published entities |
|
boolean |
Returns only a simple mapped object of entities without additional lists in it |
Response
Returns
200 OKwhen the request successfully retrieves the Tweets list.
{
"total": 1,
"tweets": [
{
"isPublished": true,
"dateAdded": "2026-02-03T17:51:58+00:00",
"dateModified": "2026-03-28T11:03:03+00:00",
"createdBy": 1,
"createdByUser": "John Doe",
"modifiedBy": 1,
"modifiedByUser": "John Doe",
"id": 1,
"name": "Thank you tweet",
"text": "Hi {twitter_handle}\n\nThanks for ...",
"description": "Used in the Product A campaign 1",
"language": "en",
"category": null,
"mediaId": null,
"mediaPath": null,
"sentCount": 3,
"favoriteCount": 0,
"retweetCount": 0
}
]
}
Properties
Name |
Type |
Description |
|---|---|---|
|
integer |
Total count of Tweets |
|
array |
An array of Tweet objects |
For the rest of the properties, refer to Tweet properties.
Create Tweet
Creates a new Tweet.
<?php
$data = [
'name' => 'Tweet A',
'text' => 'This is my first tweet created via API.',
];
$tweet = $tweetApi->create($data);
HTTP request
POST /tweets/new
POST parameters
Name |
Type |
Description |
|---|---|---|
|
string |
Title of the Tweet. Required. |
|
string |
Message content of the Tweet. Maximum 280 characters. Required. |
|
string |
Internal description for the Tweet |
|
boolean |
Tweet publication status |
|
datetime |
Activation date and time for the Tweet |
|
datetime |
Deactivation date and time for the Tweet |
|
string |
The language code for the Tweet, such as |
|
integer |
ID of the Category for the Tweet |
|
integer |
ID of an Asset to link to the Tweet |
|
integer |
ID of a Page to link to the Tweet |
Response
Returns
201 Createdwhen the request successfully creates a Tweet.
The response is a JSON object similar to Get Tweet.
Properties
Refer to Tweet properties.
Edit Tweet
Edits a Tweet.
This operation supports PUT or PATCH depending on the desired behavior:
PUT: full replacement. The request creates a new Tweet if the ID is missing. If the ID exists, the request clears all existing data and replaces it with the provided values.PATCH: partial update. The request only updates field values based on the request data. The request fails when the Tweet ID doesn’t exist.
<?php
$id = 1;
$data = [
'name' => 'Tweet A',
'text' => 'This is my first tweet created via API.',
];
// Create a new Tweet if ID 1 isn't found
$createIfNotFound = true;
$tweet = $tweetApi->edit($id, $data, $createIfNotFound);
HTTP request
PUT /tweets/ID/edit: updates an existing Tweet or creates a new one when the ID doesn’t exist.PATCH /tweets/ID/edit: updates an existing Tweet. The request fails when the ID doesn’t exist.
POST parameters
Accepts the same parameters as those described in Create Tweet. All parameters are optional.
Response
PUT: returns200 OKwhen the request successfully updates the Tweet or201 Createdwhen the request creates a Tweet.PATCH: returns200 OKwhen the request successfully updates the Tweet or404 Not Founderror when the Tweet ID doesn’t exist.
The response is a JSON object similar to Get Tweet.
Properties
Refer to Tweet properties.
Delete Tweet
Deletes a Tweet.
<?php
$tweet = $tweetApi->delete($id);
HTTP request
DELETE /tweets/ID/delete
Response
Returns
200 OKwhen the request successfully deletes the Tweet.
The response is a JSON object containing the data of the deleted Tweet, similar to Get Tweet.
Properties
Refer to Tweet properties.