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.

A newly created SmartMembers API key, AI Weekly — shop sync, showing the smk_ key and a Test it curl command that calls the /me route
Every new key comes with a Test it command for the first request.

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 pathKeyWhat it does
GET /meViewThe site, the key's name and its access.
GET /access-groupsViewEvery group: id, name, status, members (people with live access).
GET /access-groups/{id}ViewOne group.
GET /membersViewEveryone holding a grant here, live or ended, 20 per page.
GET /members/{id}ViewOne member and all their grants.
GET /access-check?user=&post=ViewWhether that user may open that post, and why. Never the post itself.
POST /grantsChangeGive access.
POST /grants/{id}/revokeChangeEnd access.
PATCH /grants/{id}ChangeMove 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_id or email. An unknown email creates a member account. They get the new-account email if Email settings send it.
  • access_group is required. expires_at and started_at are optional.
  • The answer is the grant, with 201. Sending the same source_object and source_id again while that grant is live returns it with 200, 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}}.

StatusCodeMeaning
400rest_invalid_param, cl_smartmembers_api_invalid_date, cl_smartmembers_api_no_userA field is missing or wrong; data.params says which.
401cl_smartmembers_api_unauthorized, incorrect_passwordNo key, or a wrong one.
401cl_smartmembers_api_expiredThe key has passed its expiry date.
403cl_smartmembers_api_view_onlyThe key is View only.
403cl_smartmembers_api_lockedA key used outside this API.
403cl_smartmembers_api_ownerThe key's owner is no longer an administrator.
404…_no_group, …_member_not_found, …_post_not_found, …_grant_not_foundNo such ID.
409cl_smartmembers_api_…The grant was refused, with the reason.

Related articles