Mautic API Endpoints

Updated on February 9, 2026

This page documents every Mautic REST API endpoint the plugin calls. All requests are made through the MauticApiClient class, which wraps wp_remote_request() and handles authentication headers (Basic Auth or OAuth2 Bearer token), JSON encoding, error handling, and automatic token refresh for OAuth2.

All endpoint paths are relative to your Mautic instance URL. For example, if your Mautic URL is https://mautic.example.com, the full URL for /api/contacts/new would be https://mautic.example.com/api/contacts/new.

Contacts

Create Contact

PropertyValue
MethodPOST
Endpoint/api/contacts/new
When CalledWhen creating a new contact that does not yet exist in Mautic. Called by the createOrUpdateContact() method when no existing contact is found by email.
Data SentJSON object containing contact fields: email, firstname, lastname, phone, address1, city, state, zipcode, country, tags (array), and any custom fields such as mautic_woo_order_data, mautic_woo_cart_data, mautic_woo_recovery_url, mautic_woo_total_spent, mautic_woo_order_count, mautic_woo_coupon_code.

Edit Contact

PropertyValue
MethodPATCH
Endpoint/api/contacts/{id}/edit
When CalledWhen updating an existing contact in Mautic. Called by the createOrUpdateContact() method when an existing contact is found by email. Also called directly to update the coupon code field after abandoned cart sync and to clear cart data fields on recovery.
Data SentJSON object with the fields to update. Only changed fields need to be included. The {id} path parameter is the Mautic contact ID.

Get Contact

PropertyValue
MethodGET
Endpoint/api/contacts/{id}
When CalledWhen retrieving a specific contact by their Mautic ID.
Data SentNone. The {id} path parameter is the Mautic contact ID.

Search Contacts by Email

PropertyValue
MethodGET
Endpoint/api/contacts
When CalledWhen looking up a contact by email address before creating or updating. Also used by the connection test to verify connectivity.
Data SentQuery parameters: search=email:user@example.com and limit=1 for email lookups, or limit=1 alone for connection tests.

Contact Fields

Get Contact Fields

PropertyValue
MethodGET
Endpoint/api/fields/contact
When CalledWhen checking which custom fields exist in Mautic. Called by the “Check Fields” button on the Mautic Fields settings tab and by the auto-create fields logic.
Data SentNone.

Create Contact Field

PropertyValue
MethodPOST
Endpoint/api/fields/contact/new
When CalledWhen creating a missing custom field in Mautic. Called by the “Create Fields” button on the Mautic Fields tab and by the auto-create logic during abandoned cart sync and order sync.
Data SentJSON object: label (display name), alias (machine name), type (field type: text, url, or number).

The plugin uses the following custom field aliases:

AliasLabelTypePurpose
mautic_woo_order_dataLast Order DatatextJSON string containing the latest order details (order ID, status, total, discount, coupons, currency, date, payment method, and line items).
mautic_woo_cart_dataAbandoned Cart DatatextJSON string containing abandoned cart details (total, currency, recovery URL, and item list).
mautic_woo_recovery_urlCart Recovery URLurlThe full URL a customer can click to restore their abandoned cart and go to checkout.
mautic_woo_total_spentTotal SpentnumberThe customer’s lifetime total spent in WooCommerce.
mautic_woo_order_countOrder CountnumberThe total number of orders the customer has placed in WooCommerce.
mautic_woo_coupon_codeRecovery Coupon CodetextThe WooCommerce coupon code generated for abandoned cart recovery emails.

Tags

Get Tags

PropertyValue
MethodGET
Endpoint/api/tags
When CalledWhen retrieving existing tags from Mautic.
Data SentNone.

Create Tag

PropertyValue
MethodPOST
Endpoint/api/tags/new
When CalledWhen creating a new tag in Mautic that does not already exist.
Data SentJSON object: tag (the tag name string).

Notes

Create Note

PropertyValue
MethodPOST
Endpoint/api/notes/new
When CalledWhen the “Add Notes” option is enabled in Order Sync settings. A note is created on the Mautic contact after each order sync.
Data SentJSON object: lead (Mautic contact ID), type ("general"), text (note title and body separated by a newline, containing order and product details).

Emails

Send Email to Contact

PropertyValue
MethodPOST
Endpoint/api/emails/{email_id}/contact/{contact_id}/send
When CalledWhen the Email Trigger feature is enabled in Order Sync settings and a template ID is configured for the current order status. Sends a transactional email via Mautic when an order transitions to a specific status.
Data SentJSON object: tokens (optional key-value pairs for template variable replacement). The {email_id} and {contact_id} path parameters are the Mautic email template ID and contact ID respectively.

Segments

Add Contact to Segment

PropertyValue
MethodPOST
Endpoint/api/segments/{segment_id}/contact/{contact_id}/add
When CalledWhen the Abandoned Cart module has a segment ID configured. After syncing an abandoned cart to Mautic, the contact is added to the specified segment.
Data SentNone. The {segment_id} and {contact_id} path parameters are the Mautic segment ID and contact ID respectively.

Authentication

All API requests include authentication headers managed by the AuthFactory class. The plugin supports two authentication methods:

  • Basic Auth – Sends an Authorization: Basic header with Base64-encoded username and password credentials.
  • OAuth2 – Sends an Authorization: Bearer header with the access token. If a 401 response is received, the plugin automatically attempts to refresh the token and retry the request once.

Request Headers

Every API request includes the following headers in addition to the authentication header:

HeaderValue
Content-Typeapplication/json
Acceptapplication/json

Error Handling

The API client handles errors at multiple levels:

  • WordPress HTTP errors – If wp_remote_request() returns a WP_Error, the error message is captured and returned in the response array.
  • HTTP 4xx/5xx responses – If the Mautic server returns a status code of 400 or higher, the error message is extracted from the response body.
  • OAuth2 token expiration – If a 401 response is received with OAuth2 authentication, the plugin automatically refreshes the access token and retries the request once.
  • Unique email conflicts – If creating a contact fails because the email already exists, the plugin retries the operation as an edit.
  • Region field rejections – If Mautic rejects the state or country fields, the plugin retries without those fields.

All requests use a 30-second timeout.

Next