Support » Plugin: Newsletter » Lists parameter is ignored in an API call

  • Resolved magicgol



    I’m using The Newsletter Plugin with Newsletter API Extension, but I’m unable to perform some calls.

    curl -X POST \
      https://...../wp-json/newsletter/v1/subscribe \
      -H 'cache-control: no-cache' \
      -H 'content-type: application/json' \
      -d '{
        "email": "",
        "api_key": "(my_api_key)",
        "lists": [2]

    Performing a call like this, the subscriber is created but not added to the list #2.
    The API Key is correctly added in the admin section, I double checked.

    Am I doing something wrong? Any suggestion?

    Thanks for your support.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Roberto Fietta


    Hi, did you check if lists are set as private?

    Hello Roberto,

    Thank you for your fast and kind reply.
    The list #2 is set as “Disabled / Private Use”, under “Visibility” column.

    Do I need to change this setting?

    Best regards,

    Plugin Author Stefano Lissa


    The subscribe endpoint works exactly as a regular subscription from a form, so every list referenced must be public (otherwise one can forge a call entering that list).


    Hello @satollo,

    Thank you for your reply.

    We tried by setting the list to every option different than “Disabled / Private use” (so we tried with “Only on profile page”, “Hidden”, “Even on sub form”) but our API call — reported on my first post — didn’t work.

    Are we missing something?
    Do we necessarily need to create a subscription form?

    Plugin Author Stefano Lissa


    But are you subscribing an existing user or a new one?

    Plugin Author Stefano Lissa


    Hi, the api_key, anyway, should not be added to the subscribe call.

    @satollo Thank you.

    We’re trying to subscribe new user(s). We also tried without api_key parameter as you suggested but it didn’t work.

    Plugin Author Stefano Lissa


    I’ll have a session today to check the specific problem.


    Good morning Stefano,

    Thank you.
    Please let us know.

    Plugin Author Stefano Lissa


    I’ve just tested and it works. Check if you have the version 2.0.2 of the api addon, version 6.4.0 Newsletter and ensure the list number 2 in your example is marked as public.
    Be sure to make every test with a new email address or delete the test email address every time.

    Could you test it again?

    Thank you, Stefano.

    Hello @satollo,

    After several tests, we noticed that we were using a wrong Content-Type in the request. After setting it to “application/json”, it worked.

    Closing this ticket. Thank you once more to you and your team for the support!

    Best regards,
    Fabio B.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.