This document provides information on how to use our API endpoints for managing clients. These endpoints allow you to add and remove clients using your API key.

We also offer some Zapier endpoints that are currently private.

NOTE! In order to use the information in this documentation, or our Zapier endpoints, you will need to contact us first! Please do so here: 

[email protected]

Getting Started

Before you can use these endpoints, you'll need your API credentials:

  1. API Username: This is your username on our platform.
  2. API Key: This is a unique key associated with your account.

You can find both of these on the Credentials page in the menu of our web interface.

Here's a direct link to the Credentials page

Always keep your API key secret and secure. Note that this is only available in the web interface, and only for ETM Professional users.

Authentication

For all API requests, you need to include your API username and API key as parameters. You can include these in either the query string or the request body.

Example:

https://www.eatthismuch.com/api/test-api-key-auth/?api_username=your_etm_username&api_key=your_api_key

Endpoints

1. Test API Key Authentication

This endpoint allows you to test if your API key is working correctly.

  • URL: https://www.eatthismuch.com/api/test-api-key-auth/
  • Method: GET or POST
  • Parameters:
    • api_username: Your ETM username
    • api_key: Your API key

Example Response:

{
    "status": "success",
    "message": "Authentication successful",
    "user": "your_username"
}

2. Add Multiple Clients

This endpoint allows you to add multiple clients at once. Most of the parameters are optional and reflect the options you see in the web interface when adding a client.

  • URL: https://www.eatthismuch.com/api/add-clients/
  • Method: GET or POST
  • Parameters:
    • api_username: Your ETM username
    • api_key: Your API key
    • emails: List of email addresses for the clients you want to add
    • send_invites (optional): Set to "true" to send invitation emails (default is false)
    • copy_settings_from (optional): User ID to copy settings from
    • has_login_access (optional): Set to "true" to give the client login access (default is true)
    • force_signup (optional): Set to "true" to force signup even if the email exists (default is same as has_login_access)
    • enable_weekly_planner (optional): Set to "true" to enable the weekly planner for the client (default is same as has_login_access)
    • welcome_email (optional): Set to "true" to send a welcome email (default is false)
    • user_features (optional): List of features to enable for the user

Example Response:

{
    "created_users": ["[email protected]", "[email protected]"],
    "existing_users": ["[email protected]"],
    "invalid_emails": ["invalidemail"]
}

3. Add Single Client

This endpoint allows you to add a single client. Most of the parameters are optional and reflect the options you see in the web interface when adding a client.

  • URL: https://www.eatthismuch.com/api/add-single-client/
  • Method: GET or POST
  • Parameters:
    • api_username: Your ETM username
    • api_key: Your API key
    • email: Email address of the client you want to add
    • first_name (optional): First name of the client
    • last_name (optional): Last name of the client
    • send_invite (optional): Set to "true" to send an invitation email (default is true)
    • copy_settings_from (optional): User ID to copy settings from
    • has_login_access (optional): Set to "true" to give the client login access (default is true)
    • force_signup (optional): Set to "true" to force signup even if the email exists (default is same as has_login_access)
    • enable_weekly_planner (optional): Set to "true" to enable the weekly planner for the client (default is same as has_login_access)
    • welcome_email (optional): Set to "true" to send a welcome email (default is true)
    • user_features (optional): List of features to enable for the user

Example Response:

{
    "created_user": "[email protected]",
    "existing_user": null,
    "invalid_email": null
}

4. Remove Multiple Clients

This endpoint allows you to remove multiple clients at once.

  • URL: https://www.eatthismuch.com/api/remove-clients/
  • Method: GET or POST
  • Parameters:
    • api_username: Your ETM username
    • api_key: Your API key
    • emails: List of email addresses for the clients you want to remove

Example Response:

{
    "removed_users": ["[email protected]", "[email protected]"],
    "not_found_users": ["[email protected]"]
}

5. Remove Single Client

This endpoint allows you to remove a single client.

  • URL: https://www.eatthismuch.com/api/remove-single-client/
  • Method: GET or POST
  • Parameters:
    • api_username: Your ETM username
    • api_key: Your API key
    • email: Email address of the client you want to remove

Example Response:

{
    "removed_user": "[email protected]",
    "not_found_user": null
}

Error Handling

If there's an error with your request, you'll receive a JSON response with an "error" key explaining the issue. For example:

{
    "error": "You must have a Pro account to do this."
}

Common errors include authentication failures, invalid parameters, or insufficient permissions.

Rate Limiting

To ensure fair usage, these endpoints have rate limits. If you exceed the rate limit, you'll receive a 429 (Too Many Requests) response. Please wait and try again later if this happens.

Need Help?

If you encounter any issues or have questions about using these API endpoints, please don't hesitate to contact our support team. We're here to help!