---
title: "OptimizeMentor Webhooks"
url: https://docs.optimizepress.com/en/articles/223-optimizementor-webhooks
collection: "OptimizeMentor Integrations & API"
updated: 2026-06-20
language: en
---

# OptimizeMentor Webhooks

## **Getting started**

OptimizeMentor webhooks are used to preform basic actions on your OptimizeMentor content and members. It uses the WordPress REST API as a base.

The base URL for the can be found under **OptimizeMentor / Settings / API Settings**. So all endpoints need to have this URL set as the base.

Under the same settings page you can find your **API Key** which will be used for authorizing your requests.

## **Authentication**

You can authenticate your request by passing the **API Key** as a header parameter. The header parameter needs to be called: **X-OPM-API-KEY**. So the request looks something like this:

```javascript
curl -H "X-OPM-API-KEY: YOUR-API-KEY" <http://YOUR-BASE-URL/memberships>
```

Another way to authenticate your requests it to simply send the API key via a query string, like this:

```javascript
curl <http://YOUR-BASE-URL/memberships?opm_api_key=YOUR-API-KEY>
```

### **GET /memberships**

Returns a list of your memberships. Example of returned data in JSON format:

```javascript
`{
    "status": 200,
    "data": [
        {
            "id": 1,
            "title": "Gold",
            "priority": 1,
            "override_redirects": false,
            "login_redirect_id": 8121,
            "after_login_redirect_id": 8117,
            "after_register_redirect_id": "8119",
            "protected_redirect_id": 8125,
            "drip_redirect_id": "8123",
            "access_duration": "lifetime",
            "expires_in_type": "years",
            "expires_in_value": 1,
            "expires_at": null,
            "created_at": "2022-06-15 08:05:36",
            "updated_at": "2022-06-15 08:05:36"
        },
        {
            "id": 2,
            "title": "Silver",
            "priority": 2,
            "override_redirects": false,
            "login_redirect_id": 8121,
            "after_login_redirect_id": 8117,
            "after_register_redirect_id": "8119",
            "protected_redirect_id": 8125,
            "drip_redirect_id": "8123",
            "access_duration": "lifetime",
            "expires_in_type": "years",
            "expires_in_value": 1,
            "expires_at": null,
            "created_at": "2022-06-15 10:11:09",
            "updated_at": "2022-06-15 10:11:09"
        }
    ]
}`
```

### **GET /members**

Get all your members. The results are limited to max 20 results.

Available incoming parameters are:

<table style="min-width: 25px;"><colgroup><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p>NameTypeDefaultRequired</p></td></tr><tr><td colspan="1" rowspan="1"><p>per_page</p></td><td colspan="1" rowspan="1"><p>int</p></td><td colspan="1" rowspan="1"><p>20</p></td><td colspan="1" rowspan="1"><p>No</p></td></tr><tr><td colspan="1" rowspan="1"><p>page</p></td><td colspan="1" rowspan="1"><p>int</p></td><td colspan="1" rowspan="1"><p>1</p></td><td colspan="1" rowspan="1"><p>No</p></td></tr></tbody></table>

Example of returned data in JSON format:

```javascript
{
    "status": 200,
    "data": {
        "total_pages": 1,
        "total_items": 19,
        "current_page": 1,
        "per_page": 20,
        "items": [
            {
                "id": 109,
                "email": "admin@admin.com",
                "username": "admin",
                "first_name": "Admin",
                "last_name": "Administrator",
                "full_name": "Admin Administrator",
                "display_name": "Admin Administrator",
                "url": "",
                "registered_at": "2022-06-15 12:13:42",
                "last_login": "2022-06-15 12:14:26",
                "previous_login": "2022-06-15 12:13:56"
            },
            {
                "id": 1,
                "email": "user@user.com",
                "username": "user",
                "first_name": "User",
                "last_name": "The User",
                "full_name": "User The User",
                "display_name": "User The User",
                "url": "",
                "registered_at": "2022-02-18 21:53:52",
                "last_login": "2022-06-20 07:50:38",
                "previous_login": "2022-06-17 07:57:00"
            }
        ]
    }
}
```

### **POST /members**

Create a new member for your site.

Available incoming parameters are:

<table style="min-width: 25px;"><colgroup><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p>NameTypeDefaultRequired</p></td></tr><tr><td colspan="1" rowspan="1"><p>email</p></td><td colspan="1" rowspan="1"><p>string</p></td><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>Yes</p></td></tr><tr><td colspan="1" rowspan="1"><p>first_name</p></td><td colspan="1" rowspan="1"><p>string</p></td><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>No</p></td></tr><tr><td colspan="1" rowspan="1"><p>last_name</p></td><td colspan="1" rowspan="1"><p>string</p></td><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>No</p></td></tr><tr><td colspan="1" rowspan="1"><p>notify</p></td><td colspan="1" rowspan="1"><p>bool</p></td><td colspan="1" rowspan="1"><p>false</p></td><td colspan="1" rowspan="1"><p>No</p></td></tr><tr><td colspan="1" rowspan="1"><p>memberships</p></td><td colspan="1" rowspan="1"><p>array/string</p></td><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>No</p></td></tr></tbody></table>

Example response:

```javascript
{
    "status": 200,
    "data": {
        "id": 128,
        "email": "user@email.com",
        "username": "user@email.com",
        "first_name": "John",
        "last_name": "Smith",
        "full_name": "John",
        "display_name": "Smith",
        "registered_at": "2022-06-23 10:10:52",
        "last_login": null,
        "previous_login": null
    }
}
```

If a member with the same email address exists, then the response looks like this:

```javascript
{
    "code": 409,
    "message": "Error occurred when creating a new member: Member already exists.",
    "data": {
        "status": 409
    }
}
```

### **POST /members/{member\_id}/add-membership**

Attach an existing membership to a member. You need to pass the ID of the user into the URL, and pass the membership ID through the POST parameters.

Available incoming parameters are:

<table style="min-width: 25px;"><colgroup><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p>NameTypeDefaultRequired</p></td></tr><tr><td colspan="1" rowspan="1"><p>membership_id</p></td><td colspan="1" rowspan="1"><p>int</p></td><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>Yes</p></td></tr></tbody></table>

Example response:

```javascript
{
    "status": 200,
    "data": {
        "member": {
            "id": 128,
            "email": "user@email.com",
            "username": "user@email.com",
            "first_name": "John",
            "last_name": "Smith",
            "full_name": "John",
            "display_name": "Smith",
            "registered_at": "2022-06-23 10:10:52",
            "last_login": null,
            "previous_login": null
            "memberships": [
                {
                    "id": 2,
                    "title": "Silver",
                    "priority": 2,
                    "override_redirects": false,
                    "access_duration": "lifetime",
                    "expires_in_type": "years",
                    "expires_in_value": 1,
                    "expires_at": null,
                    "created_at": "2022-06-15 10:11:09",
                    "updated_at": "2022-06-15 10:11:09"
                }
            ]
        }
    }
}
```

### **POST /members/{member\_id}/remove-membership**

Remove an existing membership from a member. You need to pass the ID of the user into the URL, and pass the membership ID through the POST parameters.

Available incoming parameters are:

<table style="min-width: 25px;"><colgroup><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p>NameTypeDefaultRequired</p></td></tr><tr><td colspan="1" rowspan="1"><p>membership_id</p></td><td colspan="1" rowspan="1"><p>int</p></td><td colspan="1" rowspan="1"><p><br></p></td><td colspan="1" rowspan="1"><p>Yes</p></td></tr></tbody></table>

Available incoming parameters are:

Example response:

```javascript
{
    "status": 200,
    "message": "Membership removed",
    "data": {
        "message": "Membership removed"
    }
}
```

### **POST /members/{member\_id}/delete**

Delete a member from your site You need to pass the ID of the user into the URL.

Example response:

```javascript
{
    "status": 200,
    "message": "Member deleted.",
    "data": {
        "message": "Member deleted."
    }
}
```

  

# **Webhooks**

This is a simpler way to use the API. This way of invoking the API is best used inside the Rules Engine in OptimizePress Dashboard.

A few examples are below:

### **Create new member**

Create a webhook with a POST request type and enter the following URL:

```javascript
http://YOUR-BASE-URL/members?memberships=1,2,3&opm_api_key=YOUR_API_KEY
```

### **Assign membership to member (by email)**

Create a webhook with a POST request type and enter the following URL:

```javascript
http://YOUR-BASE-URL/members/add-membership?membership_id=3&opm_api_key=YOUR_API_KEY
```

### **Remove membership from member (by email)**

Create a webhook with a POST request type and enter the following URL:

```javascript
http://YOUR-BASE-URL/members/remove-membership?membership_id=3&opm_api_key=YOUR_API_KEY
```
