Admin API - Member endpoints


I’m using the hosted version of Ghost, so it’s on the the latest version, but I’m treating it as a headless CMS. I generate a static frontend with Next.js to display all of our content and posts. This has worked great but using this strategy does have its drawbacks. For one, it disables unsubscribing from newsletters via the email link. (It also breaks the user account management functionality but that is a larger issue.) The unsubscribe link that is generated includes the hosted version of my URL along with the user uuid and newsletter uuid.

I think that I’ll be able to intercept the request in my Next.js app, but is it possible to get a member by uuid since I don’t have access to the id? If that is possible, my hope was to update that specific user to remove the supplied newsletter uuid from the newsletters parameter.

I don’t see a specific way to do this in the API docs but was wondering if others had found a workaround.

Looking at the unsubscribe controller, it looks like it’s just a redirect to the home page, where I assume portal takes over:

Thanks for the source link! Because we’re using our Ghost instance as a headless CMS we’ve made the normal Ghost site private, so unfortunately we lose out on a lot of that base functionality. I think it would be a very steep uphill battle trying to get parts of the normal site to work accordingly which was why I was hoping to accomplish it via the API.

How are you handling memberships (auth/subscription management/etc) on your headless site? If you’re using portal, supporting the unsubscribe URL should be pretty painless.

Unfortunately, we’re not. :grimacing:

Users are able to sign up via a custom form which sends a request to /members/api/send-magic-link/. The rest of the portal/membership functionality is inaccessible or unsupported. We do want to get that working but know that implementing that will be a bigger lift.


In that case, I think this is the Portal logic to handle newsletter subscription (if you want to extract it to your headless app):

URL Building logic:

1 Like

Ohh, awesome thank you for the suggestions. Let me give this a shot and I’ll respond whether or not it’s successful!

1 Like