Title: How to use API
Last modified: May 18, 2019

---

# How to use API

 *  Resolved [ookris](https://wordpress.org/support/users/ookris/)
 * (@ookris)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/how-to-use-api/)
 * I followed the description at [https://kb.mailpoet.com/article/195-add-subscribers-through-your-own-form-or-plugin](https://kb.mailpoet.com/article/195-add-subscribers-through-your-own-form-or-plugin)
   but unfortunately adding subscribers does not work.
    My code looks like this
 *     ```
       <?php 
   
       subscriber_data = array(
          'email' => $_GET['email'],
          'first_name' => $_GET['first_name'],
          'last_name' => $_GET['last_name']
       );
   
       $lists = 3;
   
       try {
          $subscriber = \MailPoet\API\API::MP('v1')->addSubscriber($subscriber_data, $lists, $options);
       } catch(Exception $exception) {
          // return $exception->getMessage();
       }
   
       echo print_r($subscriber_data, TRUE);
   
       ?>
       ```
   
 * The script is called like this
 * `https://bolecair.info/wp-content/uploads/mailpoet/add_sub.php?email=xxx@yyy.
   zz&first_name=Name&last_name=LName`
 * What is wrong?
    -  This topic was modified 6 years, 12 months ago by [ookris](https://wordpress.org/support/users/ookris/).
    -  This topic was modified 6 years, 12 months ago by [ookris](https://wordpress.org/support/users/ookris/).

Viewing 1 replies (of 1 total)

 *  Plugin Author [MailPoet](https://wordpress.org/support/users/mailpoet/)
 * (@mailpoet)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/how-to-use-api/#post-11608111)
 * [@ookris](https://wordpress.org/support/users/ookris/) sorry for the very late
   response.
 * We’re hoping that you manage to resolve this yourself since.
 * Note that we’re improving our API currently. You can find updated documentation
   here:
 * [https://github.com/mailpoet/mailpoet/tree/master/doc](https://github.com/mailpoet/mailpoet/tree/master/doc)
 * Cheers!

Viewing 1 replies (of 1 total)

The topic ‘How to use API’ is closed to new replies.

 * ![](https://ps.w.org/mailpoet/assets/icon-256x256.png?rev=3284564)
 * [MailPoet - Newsletters, Email Marketing, and Automation](https://wordpress.org/plugins/mailpoet/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailpoet/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailpoet/)
 * [Active Topics](https://wordpress.org/support/plugin/mailpoet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailpoet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailpoet/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * 1 reply
 * 2 participants
 * Last reply from: [MailPoet](https://wordpress.org/support/users/mailpoet/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/how-to-use-api/#post-11608111)
 * Status: resolved