The SmartMembers API lets code outside WordPress read members and access groups, check who may open a post, and grant, revoke or pause access. It speaks JSON over HTTPS and signs in with an API key.
Pro: The API needs SmartMembers Pro and a key from Create an API key.
Address and sign-in
https://aiweekly.example/wp-json/cl-smartmembers/api/v1
Authorization: Bearer smk_…
A View only key may call the GET routes. Changes need View and make changes. Responses are never cached (Cache-Control: no-store).
Routes
| Method and path | Key | What it does |
|---|---|---|
GET /me | View | The site, the key's name and its access. |
GET /access-groups | View | Every group: id, name, status, members (people with live access). |
GET /access-groups/{id} | View | One group. |
GET /members | View | Everyone holding a grant here, live or ended, 20 per page. |
GET /members/{id} | View | One member and all their grants. |
GET /access-check?user=&post= | View | Whether that user may open that post, and why. Never the post itself. |
POST /grants | Change | Give access. |
POST /grants/{id}/revoke | Change | End access. |
PATCH /grants/{id} | Change | Move the end date, or pause and resume. |
Read members
GET /members takes access_group, status (active, trial, paused, expired, cancelled), email, search (email or name), page and per_page (up to 100). The totals are in the X-WP-Total and X-WP-TotalPages headers.
{
"id": 61, "email": "rosa.iqbal@example.com", "first_name": "Rosa", "last_name": "Iqbal",
"registered_at": "2026-11-08 10:26:08", "blocked": false,
"grants": [{
"id": 37, "user_id": 61, "access_group_id": 15, "status": "active",
"source": "manual", "source_object": "admin", "source_id": "sample-data",
"started_at": "2026-10-09 10:26:08", "expires_at": null, "paused_at": null
}]
}
/access-check answers like {"allowed": false, "reason": "no_group"}.
Grant access
curl -X POST https://aiweekly.example/wp-json/cl-smartmembers/api/v1/grants \
-H "Authorization: Bearer smk_…" -H "Content-Type: application/json" \
-d '{"email": "priya.nair@example.com", "first_name": "Priya", "last_name": "Nair",
"access_group": 15, "expires_at": "2026-12-31T23:59:59Z",
"source_object": "order", "source_id": "shop-1042"}'
- Identify the person by
user_idoremail. An unknown email creates a member account. They get the new-account email if Email settings send it. access_groupis required.expires_atandstarted_atare optional.- The answer is the grant, with
201. Sending the samesource_objectandsource_idagain while that grant is live returns it with200, so a retry never doubles access.
Revoke, pause or change the end date
POST /grants/37/revoke {"reason": "refunded"}
PATCH /grants/37 {"expires_at": "2027-06-30T23:59:59Z"}
PATCH /grants/37 {"expires_at": null}
PATCH /grants/37 {"status": "paused"}
PATCH /grants/37 {"status": "active"}
Revoking an ended grant returns it unchanged. expires_at: null means access never ends. An ended grant's date cannot change; grant again instead.
Dates
Send ISO 8601 with a time and zone, such as 2026-12-31T23:59:59Z. A bare date is refused. Answers use YYYY-MM-DD HH:MM:SS: expires_at in UTC, started_at in the site's time zone.
Errors
Errors are JSON: {"code": "…", "message": "…", "data": {"status": 403}}.
| Status | Code | Meaning |
|---|---|---|
| 400 | rest_invalid_param, cl_smartmembers_api_invalid_date, cl_smartmembers_api_no_user | A field is missing or wrong; data.params says which. |
| 401 | cl_smartmembers_api_unauthorized, incorrect_password | No key, or a wrong one. |
| 401 | cl_smartmembers_api_expired | The key has passed its expiry date. |
| 403 | cl_smartmembers_api_view_only | The key is View only. |
| 403 | cl_smartmembers_api_locked | A key used outside this API. |
| 403 | cl_smartmembers_api_owner | The key's owner is no longer an administrator. |
| 404 | …_no_group, …_member_not_found, …_post_not_found, …_grant_not_found | No such ID. |
| 409 | cl_smartmembers_api_… | The grant was refused, with the reason. |
Related articles
- Create an API key
- Fix a stripped Authorization header
- Access API: grant, revoke and read — the same jobs from PHP inside WordPress.
- Check a webhook signature