Mautic API v2

How to plan and build an integration against the API Platform based /api/v2 endpoint in a self-hosted Mautic instance, from prerequisites and authentication to mapping, testing and support.

On this page

How the Mautic API v2 endpoint connects your systems

Connecting Mautic to another system is an API integration, not a plugin. The question for most teams is which interface the integration should call: the original Mautic REST API or the /api/v2 endpoint, which is built on API Platform. The v2 endpoint is described as self-documenting, with interactive documentation and standardized endpoints, which matters when an external team needs to read the contract, test requests and build a client without reverse-engineering the original API. Contact and campaign data flows in both directions in most of these projects, so the choice affects how the integration reads contacts, writes activity and handles errors, and it should be settled before the build starts.

The research behind this page does not confirm the endpoint list, the authentication options or the version support for /api/v2, so do not assume any of them. Open the API documentation for the exact Mautic release you run and check which resources the v2 endpoint exposes for contacts, segments, campaigns and companies, whether it accepts the same credentials as the original API, and whether it is enabled by default or must be switched on. Compare that list against the fields and actions your integration needs, including any custom fields in your contact model. Where a resource is missing from v2, plan to call the original REST API for that resource instead, and record that split in the integration design so a later upgrade does not silently break it.

Treat the interface decision as part of your upgrade plan. Mautic's release line moves on a published cadence, so an integration built against one endpoint's behavior needs a regression test set and a named owner who checks each upgrade against the vendor documentation. Ask whichever team or partner builds the integration to document the endpoints used, the credentials and API user each call runs under, and the expected response codes. Those records are what make it possible to confirm the integration still works after an upgrade without rediscovering it from the code.

What a Mautic API v2 integration needs before work starts

Most API v2 problems trace back to decisions made before the build: the release line, the server stack, who the API user is and where requests come from. Settle these six items first, because each one sets a constraint on the endpoints, credentials and test plan that follow.

Confirm the release line

Pick the Mautic release line before anything else, because API v2 behavior and fixes depend on the version you run. Mautic 7.2 receives active and security support until 30 September 2026, and 7.3 is planned as the long-term support release with security support through 31 December 2027. Check the releases page for your line and confirm that /api/v2 is available on that release before designing any calls.

Mautic releases

Server stack and hosting

Mautic 7.0 requires PHP 8.2, 8.3, 8.4 or 8.5, MySQL 5.7 or higher with InnoDB or MariaDB 10.2 or higher, and Apache, Nginx or IIS. Node's npm is needed from Mautic 5.0 onward. The project states that Mautic should not run on shared hosting and recommends a VPS or dedicated server, because scheduled jobs and queued processing need a reliable environment. Confirm the exact versions for your release and record them in the build document.

Mautic requirements

Dedicated API user and authentication method

Decide how the other system authenticates before the build starts, since changing the method later touches every client and stored secret. Create a dedicated API user with only the permissions the integration needs, and do not reuse a personal administrator account. Record who owns the user, how its credentials are rotated and which role limits its access. Confirm which authentication methods the API accepts on your release.

Authentication docs

HTTPS and reverse proxy settings

Mautic builds public URLs from its configured site address, so a reverse proxy in front of the application must pass the public scheme and host correctly. Serve the API only over HTTPS everywhere, terminate certificates at a point your team manages, and confirm which forwarded headers and trusted proxy addresses your release expects. Wrong settings can break callback URLs and webhook targets, and they often go unnoticed in a test environment that runs over plain HTTP.

Non-production Mautic instance

Build the integration on a separate Mautic instance with its own database, mail transport and API credentials, and load only test or anonymized contacts. Point outbound webhooks and any connected CRM at sandbox endpoints, so a test run cannot write to live systems or email real people. Keep the test instance on the same release line as production, and rehearse each upgrade there before production.

Access to the other system's API

Obtain API access to the target system before the design is final. Confirm the account, the permissions or scopes it grants, whether a sandbox tenant exists, and what rate limits apply. Store its credentials in the secrets system your team already operates, and keep them out of files that many administrators can read. Ask the vendor how keys are rotated and whether the integration user can be limited to the objects Mautic will touch.

How requests and events move between Mautic and the other system

The flow starts in the calling application, which sends HTTPS requests with credentials it reads from its own secret store. The request crosses the trust boundary into the Mautic host, passes the web server or proxy, and reaches Mautic API v2, which authenticates the API user before reading or writing the database. Cron-driven jobs and the messenger consumer run as separate background flows that also use the database, so check that they keep running when API traffic is quiet.

Request path into Mautic API v2 alongside the cron and messenger background flows.

Choosing between the original REST API and the v2 endpoint

A team starting from nothing has the most freedom to choose, and the main risk is designing around an endpoint that does not expose the objects it needs. Begin with an inventory of every record the integration will read or write, such as contacts, companies, segments or campaign membership, and check each one against the v2 documentation on the release you plan to run.

  • Endpoint coverage first: Mark each object as covered, partly covered or missing. Do not assume that a v2 endpoint exists just because the original REST API has one.
  • Interactive docs as the working spec: The self-documenting interactive docs let engineers send test requests and read response schemas before writing client code. Keep a copy of the documented schema with the integration's design records.
  • Pagination and error formats: Confirm how list responses are paged, how page sizes are set and what error bodies look like. Write the client and its retry logic against those formats, not against assumptions carried over from other APIs.
  • Fallback for gaps: Where a required object is missing from v2, decide in advance whether the original REST API will cover that object alone, and document the mixed design.
  • Release check: Confirm the endpoint exists in the release your operations team will run, not only in the development branch.

Before committing, test the full design against a staging instance on the same release line as production.

How to configure the v2 integration in the right order

This sequence moves from confirming the Mautic release and API access to a tested, scoped connection that creates and updates contacts reliably. Each step closes with a check, so the team knows the previous layer works before it adds the next.

  1. Confirm the Mautic release and API access

    The platform administrator records the Mautic release line in use and checks it against the release schedule on the Mautic releases page. For example, a 7.2 instance receives security support until 30 September 2026, so the support end date belongs in the integration record. Next, confirm that API access is enabled in the instance configuration and that the staging address serves the interactive API documentation at the v2 endpoint. Done when the release version, support end date and documentation page are all recorded and reachable from the integration team's network.

  2. Create a dedicated API user with a narrow role

    The Mautic administrator creates a user that exists only for this integration, with a shared-purpose mailbox that the team controls. Grant the role that covers the objects the sync needs, such as contacts or companies, and review each permission against the data flow map. Do not attach the integration to a personal administrator login. Done when the user signs in on its own, the role and its permissions are written in the change log, and a test attempt to reach a settings area outside the role's scope is refused.

  3. Choose and document the authentication method

    The integration lead decides between OAuth2 and basic authentication before any calls are written. Record the grant type, who owns the credential, how long it stays valid, how it is rotated and where the secret is stored. Confirm the choice against the authentication guidance for your Mautic release, since the team's security review will ask for it. Done when a short decision record names the method and owner, and the secret is absent from source control, tickets and chat logs.

  4. Test read calls in the interactive docs

    The integration engineer opens the self-documenting interactive docs on the staging instance, authorizes with the chosen credential and runs list calls for contacts, then a single contact by identifier. Note the status codes, response fields and pagination behavior, because these become the basis for the field map. Repeat one call with a missing or out-of-scope credential to confirm it is refused. Done when an authenticated read returns a record that matches a known contact in the staging interface, and the refused call is logged as expected.

  5. Map and test create and update calls

    The integration engineer builds a field map from the external system's fields to Mautic contact fields and marks which field serves as the unique identifier. Send one create call with a test record, then send an update to the same record using the same identifier. Watch closely for duplicate creation when the identifier is missing or inconsistent, and fix the mapping before any volume testing. Done when the test record appears once in Mautic with the expected values, and the update changes that same record rather than creating a second one.

  6. Configure credentials and retry settings

    In the external system, the engineer stores the Mautic credential in its secret store, sets the base URL, timeouts, retry count and backoff, and defines what happens after repeated failures. Keep retries bounded so an outage does not flood the instance. Schedule syncs so they do not overlap the cron jobs Mautic uses for segment updates, campaign updates and campaign triggers. Done when a scheduled run matches the manual test results, and a deliberately wrong credential in staging produces a logged failure instead of a silent retry loop.

How to test the integration before it touches live contacts

Test the integration against a staging copy of the Mautic database before any script or sync job runs against live contacts. The copy should be restored from a recent production backup, with the same Mautic release and the same custom fields, segments and campaigns, so that a test result reflects what production will do. Keep the staging instance on its own domain and point any connected CRM or other external system at a sandbox account, so that a test call cannot send email, trigger a campaign or write to a live system. Confirm with your Mautic administrator how the staging copy will be refreshed and who approves a refresh, because a stale copy can hide the field and segment changes that cause the most damage.

Build a set of test contacts with known field values and use them as the fixed input for every test run. Include contacts that share an email address with an existing record, contacts whose names or company fields differ only in case or spacing, and contacts with an existing doNotContact value or preference set on a channel. For each run, record the before and after state of every test contact and compare it with the expected result in writing. Check duplicate handling in particular: confirm which record the API returns and updates when two contacts match, and whether the integration creates a new contact or merges into an existing one. Consent and preference fields are the most important check. Verify that an update which omits those fields leaves them unchanged, and that an update which sets them is only sent by a process your compliance owner has approved.

Plan the rollback path before the first bulk update, not after it. Export the affected contacts, segment memberships and campaign states from the production database or through the API before the run, and store the export where the integration team can restore from it. Agree who can stop a running job, how a partial update is identified, and how the restore is verified. Load tests should use a volume that matches your expected contact count and request pattern, so that rate limits, timeouts and queued work are observed under realistic conditions. The test scope, pass criteria and acceptance threshold belong in your written scope, and the supplied research does not give timing or volume figures for these runs. Ask DeployOpen or your internal team to confirm the expected volume and the test duration with your Mautic environment before the window is booked.

How Mautic contact fields map to the other system

This table compares each Mautic contact concept with its likely counterpart in an external system, showing sync direction, source of truth, conflict rule and approver. Read it as a starting design: confirm every field name and type against your own Mautic instance and the API documentation for the release you run before building anything.

Mautic conceptSync directionSource of truthConflict rule and approver
Contact identifierTwo-way, keyed on the external ID stored on the Mautic contactThe system that creates the record first, recorded in the designNever overwrite the ID; the integration owner approves any remapping
Email addressUsually one-way into Mautic from the CRMThe CRM for account email, Mautic for marketing subscription stateLatest verified change wins; marketing lead approves bulk edits
Custom fieldsMapped per field, with direction set individuallyNamed per field in the design, checked against the field list the API returnsField-level rule written in advance; data owner for each field approves changes
Company recordTwo-way or one-way, depending on whether accounts exist in both systemsUsually the CRM account; Mautic holds a company link for segmentationCRM wins on firmographics; sales operations approves duplicate merges
OwnerOne-way from the CRM to MauticThe CRM record ownerCRM assignment always wins; sales manager approves reassignment rules
Segments and tagsOne-way from Mautic to the external system, or read-onlyMautic, because segment membership is computed thereMautic membership overrides; campaign owner approves new tags sent outward
Points and stagesOne-way from Mautic, usually as a derived score or fieldMautic, based on its scoring and stage rulesMautic value overrides; scoring owner approves changes to thresholds
Consent and preferencesOne-way, from the single owner of consent to the other systemOne named system only, agreed with privacy and legal before the buildThe owner's value always wins; privacy lead approves any exception

How to secure the API user, credentials and data flow

Connecting Mautic to a CRM, data warehouse or consent platform widens who and what can read contact data. The controls below work together: a narrow API user limits what a credential can do, managed secrets and rotation limit how long a leaked credential is useful, and transport and logging limit what an attacker or a vendor can see. Confirm each setting against your Mautic version and map it to the consent and data protection review your organization already runs.

Scope a dedicated API user

Create a separate Mautic user for each integration instead of reusing a administrator account. Give it only the permissions the integration needs, such as read access to contacts and no access to system settings, users or plugins. Review the role against the integration's actual calls, and record who approved it in the same way you record other consent and data access decisions.

Authentication docs

Rotate tokens and credentials

Set a written rotation schedule for client secrets, OAuth2 tokens and basic auth passwords, and confirm how your Mautic version lets you revoke or regenerate them without breaking active syncs. Test rotation in a staging instance first, because a rotated credential that a CRM job still holds will fail silently. Ask your data protection team whether the rotation interval should match your own access review cycle.

Keep secrets out of code and version control

Store API credentials in a secrets manager or environment-level configuration, never in committed files such as local.php or integration scripts. Restrict who can read those values at runtime, and scan repositories for accidental commits of client secrets. Confirm which configuration keys your Mautic release reads from the environment before you rely on that pattern.

Enforce HTTPS between systems

Require TLS on every hop that carries contact data, including the Mautic domain, the reverse proxy, webhook receivers and the CRM endpoint. Disable plain HTTP on the Mautic site and confirm that outbound calls from your integration do not fall back to HTTP. Check certificate validation in each client library, since disabled verification is a common cause of exposed traffic.

Restrict source IP addresses

Where your network controls allow it, limit inbound API calls and webhook deliveries to known source addresses, such as the CRM vendor's published ranges or your integration servers. Check whether your Mautic version or web server layer offers this control, because the application may not provide it natively. Document the allowlist, its owner and the process for updating it when an integration provider changes addresses.

Log API calls and limit exported fields

Enable audit logging for API authentication and write operations, and send logs to a system the security team reviews. Map each field an integration reads against your lawful basis and privacy notice, then remove fields such as free-text notes, IP history or unnecessary identifiers from the payload. Confirm with your data protection officer which fields may leave Mautic for each destination.

Common Mautic API v2 failures and how to diagnose them

This table lists the failures teams most often hit when calling the Mautic API v2, with the likely cause, the diagnosis steps on the Mautic host and in logs, and the fix. Read each row as a starting checklist: confirm the symptom first, then work through the diagnosis column before changing configuration. Most of these issues trace back to credentials, proxy headers, identifier matching, upgrades or cron scheduling.

FailureLikely causeDiagnosis on the host and in logsFix
Authentication rejected after a credential changeThe API client secret or user password was rotated, or the OAuth2 token was issued under a different API user or was revoked.Check the web server access log for 401 responses on /api/v2 calls, then confirm the API user is active and has the needed permissions in the Mautic user settings. Compare the client ID in the calling application with the one configured in Mautic.Reissue or update the client credentials in the calling system, request a fresh token, and remove cached tokens from the integration. Confirm the API user has a role that allows contact access.
Requests blocked by a proxy or missing HTTPS headersA reverse proxy or load balancer terminates TLS but does not pass the forwarded protocol and host headers, so Mautic generates http URLs or rejects the request.Inspect the proxy access log and the Mautic application log for redirects or mismatched host errors. Compare the request headers received by Mautic with those sent by the client, and check the trusted proxy and site URL settings.Forward the protocol, host and client address headers at the proxy, set the site URL to the public HTTPS address, and confirm the trusted proxy configuration. Retest from outside the network.
Duplicate contacts created from unmatched identifiersThe calling system sends email addresses with different casing or whitespace, or uses a different unique identifier than the one Mautic matches on, so each call creates a new contact.Query the contact table for duplicate email values and review the API request payloads in the calling system's logs. Check which fields the create or update call uses to find an existing contact.Normalize email values before sending, store the Mautic contact ID in the source system after the first create, and use update calls by that ID. Merge existing duplicates in Mautic before resuming sync.
Rate or timeout errors on bulk callsLarge batches of contact creates or updates run in a single request or at high concurrency, exceeding PHP execution limits, web server timeouts or database locks.Look for 429 or 5xx responses and timeout entries in the web server and PHP error logs, and note the batch size and time of failure. Check database slow query logs for long-running contact writes during the same window.Reduce batch size, add pauses or retries with backoff in the calling system, and run very large imports through Mautic's import tools during a planned window. Confirm the PHP and web server timeout settings suit the batch size.
Field type mismatches after a Mautic upgradeA custom contact field was changed or renamed during an upgrade, or the calling system still sends a value type (such as text for a date or number) that the new field definition rejects.Fetch the field definitions from the API and compare the alias and type with the calling system's mapping. Review the Mautic application log for validation errors from the upgrade window and check the release notes for changed field handling.Update the mapping in the calling system to match the current field alias and type, convert values before sending, and retest in a staging instance upgraded to the same release before production.
Sync drift caused by background cron jobs running out of scheduleSegment updates, campaign triggers or the broadcasts command did not run on time, so contact data and campaign state lag behind what the integration expects.Check the cron job logs and the scheduler on the host for missed or overlapping runs. Confirm the messenger consumer is running when emails are queued, and compare the last-run timestamps with the times the integration reports stale data.Stagger cron jobs as the Mautic cron documentation advises, run the messenger consumer under a process supervisor, and add alerts for jobs that have not run within their expected window. Re-run affected segment or campaign updates after the schedule is restored.

Questions buyers ask before hiring help with Mautic API v2

What makes a Mautic API v2 integration cost more or less?

The cost follows the written scope, and the main drivers are the number of objects synced (contacts, companies, custom fields, campaigns, activity), the direction and frequency of data flow, the authentication design, and the amount of testing and handover. A one-way read integration with a few objects is a very different job from a bidirectional sync that maps custom fields and handles deletes. Ask the partner to break the quote into discovery, build, testing, deployment and support, and to state who is paid for each part. Separate one-time build work from any recurring support or retainer, and ask what happens to the quote if the target system's API turns out to be more restrictive than expected.

How long does a Mautic API v2 integration take to build?

Duration depends on how many systems are involved, how well their data models are documented, and how many decisions must be made by your business owners before engineering can start. The steps that usually take the most time are agreeing field mappings, deciding which system is the source of truth for each field, and testing edge cases such as duplicate contacts and changed email addresses. Ask for a timeline with named milestones and the dependencies on your side, such as access approvals and sign-off dates, rather than a single end date. Confirm which parts are fixed in the written scope and which depend on discovery findings.

What does our team need to provide for the integration?

The integration needs API access to a Mautic instance that you run, credentials for an API user created for this purpose, and a staging instance that mirrors production closely enough to test real flows. You also need named data owners who can confirm field definitions, consent rules and what each connected system is allowed to change, plus a sign-off owner for each stage. Expect to provide sample payloads or exports from the other system and a test plan that covers your highest-risk records. Ask the partner to list these inputs in the quote so gaps show up before the build starts.

Can our own developers build and run this integration without a partner?

Yes, if your team has experience with Symfony-based PHP applications, REST APIs, OAuth2 or basic authentication, and the target system's API. The harder parts for most internal teams are not the first request but the operational details: retry behavior, rate limits, idempotent writes, logging, and keeping the integration working through Mautic upgrades. Assess whether the same people will own the integration after launch, because handover gaps are a common cause of failure. A partner is most useful when you need a fixed scope, an independent review of the design, or capacity that your team cannot release for the build.

Should we use the Mautic API v2 endpoint or the original REST API?

Choose based on the endpoints you need and the tooling your developers will use. The v2 endpoint is built on API Platform and offers self-documenting interactive docs and standardized endpoints, which helps teams explore the API and plan integrations. The original REST API remains the reference for many existing integrations and examples. Before deciding, check in your own instance which resources and operations you need, confirm that your target integration works with the endpoints you choose, and ask the partner to document why each choice was made. Verify current endpoint coverage against the Mautic documentation for your release line, since coverage can differ between versions.

How do Mautic upgrades affect the integration?

Upgrades can change API behavior, endpoint availability, field handling and authentication details, so every integration needs regression tests that run against each candidate release before production. Mautic uses monthly patch releases, minor releases every three months and major releases every two years, and each release line has its own support end date, so plan upgrades against those dates. Ask the partner who maintains the integration after launch, how test coverage is kept current, and how the staging instance is refreshed. Include upgrade testing in the quote, and confirm whether it is part of a support retainer or a separate piece of work.

What security questions should we settle before the integration goes live?

Settle the API user design, the authentication method and how credentials are stored before anything is built. Confirm which role the API user has, which objects it can read or write, and how access is reviewed. Decide how the integration handles personal data and consent status, since changes to contact records can affect marketing permissions. Ask the partner how secrets are stored, how requests are logged without exposing personal data, and how the integration behaves when the other system is unavailable. Request these decisions in writing as part of the design deliverable.

How DeployOpen scopes and supports a Mautic API v2 integration

DeployOpen plans, builds, tests and hands over Mautic API v2 integrations inside your own infrastructure, against a written scope agreed before work starts. We treat the API as one part of a wider Mautic deployment, so authentication, environment and operations are designed together.

How we scope

  • Map which Mautic objects your other systems must read or write through the API v2 endpoints
  • Confirm the Mautic version and release line your instance runs before choosing endpoints
  • Agree the authentication method, API user roles and the systems that will call Mautic
  • Record the test environment, data volumes and acceptance criteria in the written scope

How we build

  • Build client code against the interactive API documentation served by your own Mautic instance
  • Configure API credentials and access so each integration uses its own least-privilege identity
  • Test create, update and read flows against a staging Mautic copy before any production calls
  • Document error handling, rate and pagination behavior, and retry rules for each endpoint used

How we hand over

  • Deliver the integration code, configuration notes and a map of endpoints and objects in use
  • Provide a test report covering the agreed scenarios, with findings and fixes tracked to closure
  • Hand over credential rotation steps and a runbook for diagnosing failed API calls
  • Train your team on how to extend the integration when Mautic releases change the API

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover
  • Review the integration when you move to a new Mautic release line on the stated cadence
  • Retest the integration after upgrades, plugin changes or changes to your other systems
  • Confirm retainer scope, response expectations and exclusions in writing before work begins

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.