I’m working on a project where I’m creating 2300 comped users with different expiration times via the Ghost Admin API. The goal is to send email notifications to these users to alert them about their expiration.
I’ve discussed this issue with Cathy Sarisky in this thread, but we haven’t been able to pinpoint the cause of the problem.
Here’s the payload that works correctly to create the comped users under a specific tier with the desired expiration time:
// POST http://127.0.0.1:2368/ghost/api/admin/members/
const member_payload = {
email: 'Jamie@example.com',
name: 'Jamie Example',
note: 'Comped user expiration test from API',
subscribed: true,
labels: [{ name: "comped script", slug: "comped-script" }],
tiers: [
{
id: tier_id,
expiry_at: '2025-03-11T00:00:00.000Z',
},
],
status: "comped"
};
This payload works as expected on my staging instance Ghost ver. 5.95.0, which uses an SQLite database and is running in production mode. The issue arises after creating the comped users with the correct expiry_at timestamp. The comped users expire in approximately 15 hours (exact time is unclear) rather than at the set expiration date.
After this period, the member_products table in SQLITE initially contains the correct expiration timestamps, but after 15 hours, the table gets emptied, and the user is automatically converted to FREE.
Another challenge I’ve encountered is that I cannot test this behavior locally by changing the system time to simulate the future. Changing the OS time seems to have no impact on the comped users created via the API or manually. This leaves me with the inefficient process of waiting approx. 15 hours between each test attempt on the server.
Has anyone encountered a similar issue with bulk creation of comped users? Any advice on how to test the expiration behavior or insights into why this might be happening?