# Event API Addon

> Embed MEC shortcodes and single events on external websites with scripts or JSON, and manage allowed domains from the API hub.

Source: https://webnus.net/dox/modern-events-calendar/event-api-addon/
Last updated: 2026-11-16

The **Event API Addon** is a powerful utility designed for Modern Events Calendar that allows you to seamlessly display your events on external web applications and platforms. By generating scripts or JSON files, you can synchronize event data across multiple domains without manual re-entry.

<div class="wd-addon-info" data-addon="mec-event-api"></div>

## Initial Setup & Requirements {#Initial\_Setup\_Requirements}

### Installation {#Installation}

Before you begin, ensure you have the following requirements met:

**Activation:** Navigate to your WordPress plugins menu and ensure both **MEC** and the **Event API Addon** are active.

**MEC Lite or Pro:** Unlike some addons, the Event API works with both versions of Modern Events Calendar.

**MEC version:** Event API 1.5.0 requires Modern Events Calendar 7.38.0 or later. On older versions the addon does not load.

<aside class="wd-read-also"><span>Read Also:</span> <a href="/dox/modern-events-calendar/installation/">How to install MEC and Addons?</a></aside>

## Using the Event API {#Using\_the\_Event\_API}

You can generate an API for either a specific group of events (via shortcodes) or for an individual event page.

### Event API for Shortcodes {#Event\_API\_for\_Shortcodes}

To display a specific calendar view on another website:

1.  Navigate to **MEC > Shortcodes**.
2.  Locate your desired shortcode and click **Create API**.

[Image: MEC events list with the Create API link highlighted under an event]

### Event API for Single Events {#Event\_API\_for\_Single\_Events}

To display a single event’s details on another website:

1.  Navigate to **MEC > All Events**.
2.  Find your chosen event and click **Create API**.

[Image: MEC events list with an arrow pointing to the Create API link under an event]

## Managing the API Hub {#Managing\_the\_API\_Hub}

Once you click “Create API,” you will be directed to the management interface. This page is divided into two main sections:

[Image: MEC Event API Create API screen with site access domains, JavaScript embed code and API URL]

### Domain Management (Left Side) {#Domain\_Management\_Left\_Side}

-   **Domain Authorization:** Enter the specific domain(s) where you want the event to be displayed. You can also set the API to work on **All Domains**.
-   **Removing Access:** To revoke access, click the **Trash Icon** next to the domain and confirm. This immediately disables the API for that domain.
-   **Finalize:** Always click the **Generate Button** once your domain settings are configured.

### Data Extraction (Right Side) {#Data\_Extraction\_Right\_Side}

The right side provides the tools needed for your destination website:

-   **Script Field:** Contains a script you can copy to your clipboard. Use this to embed the content directly into another site’s HTML.
-   **JSON Field:** Provides event data in JSON format, ideal for developers who want to pull raw data into a custom web application. For calendars, a second field gives the JSON URL for the calendar’s events. The event JSON and the calendar events JSON endpoints accept an optional `occurrence_limit` parameter that controls how many occurrences are returned per event. Requests from a domain that is not authorized for the event or calendar are refused with an “Access denied.” error. The default is 500, the maximum is 2000, and `-1` means the maximum.

You can see samples of the used API below:

[Image: WordPress page on another website with the MEC Event API embed code pasted in a block]

* * *

[Image: Event displayed on another website through the MEC Event API with date, time and category]

**Pro Tip:** Ensure your host provider has **iframes** enabled on your website, as the script requires this functionality to display content properly.

## Global Settings & Customization {#Global\_Settings\_Customization}

You can find global configuration options by navigating to **MEC Settings > Settings > Event API**.

-   **Source Integration:** Use **Show header and footer if referred from iframe** to include your source website’s header and footer in the destination website’s output.
-   **Event Limits:** Control the number of events displayed in the shortcode output to maintain layout consistency. This limit applies to the shortcode output; the number of occurrences in JSON output is controlled by `occurrence_limit` instead (default 500), not by this setting.

[Image: MEC Event API settings with show header and footer option and limit]

## Use Cases (When This Addon is Useful) {#Use\_Cases\_When\_This\_Addon\_is\_Useful}

-   **Cross-Platform Syndication:** Perfect for organizations that manage one main event calendar but need to display specific schedules on partner websites or subdomains.
-   **Mobile App Integration:** Ideal for developers using the **JSON format** to feed real-time event data into a native mobile application.
-   **Centralized Management:** Useful for agencies managing multiple client sites who want to update an event once in a central hub and have it reflect everywhere instantly.

## Situations This Addon May Not Be Ideal {#Situations\_This\_Addon\_May\_Not\_Be\_Ideal}

-   **Host Restrictions:** If your hosting provider strictly blocks **iframes**, the standard script method will not function.
-   **Heavy Optimization Sites:** If the destination site uses aggressive speed optimization plugins, they may block the external script links required for the API to load.
-   **Strict GDPR Compliance:** Third-party cookie consent plugins on the source site may sometimes carry over to the destination site, which may require additional technical styling to resolve.

## Troubleshooting for Beginners {#Troubleshooting\_for\_Beginners}

-   **Events Not Loading?** If you use optimization plugins (like WP Rocket or Autoptimize), you must **exclude “external links”** within those plugins so the API script is not ignored.
-   **Script Not Functional?** Double-check that you have clicked the **Generate Button** after adding your domains; otherwise, the API remains inactive.
-   **Addon Not Working After an Update?** Event API 1.5.0 requires Modern Events Calendar 7.38.0 or later. On an older MEC version the addon does not load and an admin notice says that one or more MEC addons require Modern Events Calendar 7.38.0 or later and are temporarily disabled. Update MEC first, then the addon starts working again.
-   **Future Occurrences Missing in the JSON?** Use the `occurrence_limit` parameter (default 500, maximum 2000, `-1` for the maximum) to return more occurrences per event.
-   **Formatting Issues?** If the display looks “broken” on the new site, try toggling the **Header and Footer** options in the Event API settings to see which fits the destination’s CSS better.

## FAQ {#FAQ}

### What is the purpose of the MEC Event API Addon? {#What\_is\_the\_purpose\_of\_the\_MEC\_Event\_API\_Addon}

The MEC Event API Addon enables easy copying of events, exporting scripts, and downloading JSON files. It allows you to retrieve event or single event page data in JavaScript or JSON format and use it in web applications or display it on another WordPress site (even without MEC access) or a simple HTML page using an iframe.

### Is the Event API Addon compatible with both MEC Lite and Pro? {#Is\_the\_Event\_API\_Addon\_compatible\_with\_both\_MEC\_Lite\_and\_Pro}

Yes, you can use the Event API Addon with either MEC Lite or Pro.

### How do I use the Event API Addon to display events on another website? {#How\_do\_I\_use\_the\_Event\_API\_Addon\_to\_display\_events\_on\_another\_website}

The easiest way to use the Event API Addon for shortcodes and single event pages on another website is to copy the JavaScript code, configure the domain option, and paste it into a plain HTML document. The event or shortcode will be displayed via iframe.

### Where can I find the “Create API” option for shortcodes and single events? {#Where\_can\_I\_find\_the\_%E2%80%9CCreate\_API%E2%80%9D\_option\_for\_shortcodes\_and\_single\_events}

For shortcodes, Navigate to the shortcodes page of MEC and click “Create API” on your chosen shortcode. and For single events, Navigate to the All Events page of MEC and click “Create API” on your chosen event.

### What domain configurations are available when creating an API? {#What\_domain\_configurations\_are\_available\_when\_creating\_an\_API}

You can specify particular domains to display events on or set the API to be used for all domains. To manage domain access, enter specific domains or set the API for all domains.

### How do I remove an API from a domain? {#How\_do\_I\_remove\_an\_API\_from\_a\_domain}

To remove an API, click the trash icon next to the domain and confirm. To stop allowing all domains, choose Custom Domains and click Generate.

### What type of data outputs are available from the Event API Addon? {#What\_type\_of\_data\_outputs\_are\_available\_from\_the\_Event\_API\_Addon}

1\. JavaScript code to display any shortcode or single event page via iframe, 2. the entire calendar in JSON format, and 3. only the events in JSON format.

### Where can I configure the Event API settings? {#Where\_can\_I\_configure\_the\_Event\_API\_settings}

After installing the Event API Addon, you can access its settings by going to MEC Settings > Settings > Event API. From there, you can include your source website header and footer in the destination website and limit the number of events in the shortcode output.

### What should I do if the external script links are not loading on my web pages? {#What\_should\_I\_do\_if\_the\_external\_script\_links\_are\_not\_loading\_on\_my\_web\_pages}

If you’re using website loading speed optimization plugins, they might be the reason for the external script links not loading. You need to exclude “external links” in those plugins so they won’t get ignored and can work properly.

### What are the basic requirements to ensure the script is functional? {#What\_are\_the\_basic\_requirements\_to\_ensure\_the\_script\_is\_functional}

To ensure your script is functional, verify that the script is enabled on all domains or a specific domain. Additionally, confirm with your host provider that the ability to create iframes on your website is enabled.

### How can I customize the display of events on the destination website using the Event API Addon? {#How\_can\_I\_customize\_the\_display\_of\_events\_on\_the\_destination\_website\_using\_the\_Event\_API\_Addon}

You can include the source website’s header and footer on the destination website and limit the number of events displayed in the shortcode output.
