Connect API Documentation

Welcome to the Connect API documentation. This API enables you to manage user subscriptions, bundle configurations, and integrate with our services programmatically.

Quick Start

  1. Obtain your source identifier from Team Living2-0
  2. Get the bundle name you want to use
  3. Make your first API call to /api/v2/subscribeuser

Available Endpoints

Endpoint Method Description
/api/v2/subscribeuser POST Subscribe User
/api/v1/unsubscribeuser POST Unsubscribe User
/api/v2/getuser GET Get User
/api/v2/getuserdata GET Get User Data

Authentication

Source-Based Validation

The Connect API uses source-based validation for authentication. Each API request requires a valid source parameter that has been pre-registered in the system.

Important

Your source identifier must be registered before making API calls. Contact your administrator to obtain a valid source.

Required Headers

All API requests must include the following header:

Content-Type: application/json

Production vs Sandbox Mode

The API supports two modes controlled by the production parameter:

Mode Parameter Description
Production production=yes Live mode - all third-party integrations are processed
Sandbox production=no Testing mode - third-party integrations are skipped

Security Best Practices

  • Always use HTTPS for API requests
  • Never expose your source identifier in client-side code
  • Use a backend proxy for browser-based applications
  • Store subscription IDs (subId) securely

Base URL

All API endpoints are relative to the following base URL:

https://connectapi.living2-0.com/index.php/wp-json/

For example, to call the Subscribe User endpoint:

https://connectapi.living2-0.com/index.php/wp-json/api/v2/subscribeuser

API Versioning

The API uses URL-based versioning. Current versions available:

  • /api/v1/ - Version 1 endpoints
  • /api/v2/ - Version 2 endpoints (recommended)

Subscribe User

POST https://connectapi.living2-0.com/index.php/wp-json/api/v2/subscribeuser

Subscribe a new user to a bundle with full profile information. This endpoint creates a new subscription, generates activation codes/links for all bundle products, and optionally integrates with third-party services.

Parameters

Name Type Required Description
first_name string Required User's first name
last_name string Required User's last name
email string Required Valid email address. This will be used as the primary identifier.
phone string Required Phone number including area code
dob string Required Date of birth in YYYY-MM-DD format
gender string (Male, Female) Required User's gender
bundle string Required Bundle name to subscribe the user to. Must be a valid bundle configured in the system.
source string Required Source identifier. Must be pre-registered in the system. Contact your administrator to obtain a source.
address1 string Required Primary street address
city string Required City name (maximum 50 characters)
state string Required State abbreviation (2 characters, e.g., NY, CA, TX)
middle_name string Optional User's middle name
address2 string Optional Secondary address line (apartment, suite, etc.)
zip string Optional ZIP/Postal code
production string (yes, no) Optional Production mode flag. Use "no" for sandbox/testing mode where third-party integrations are skipped.
Default: yes
ma string (yes, no) Optional Add user to Mautic marketing automation system
Default: no
dashboard string (yes, no) Optional Create user dashboard entry for the subscription
Default: yes
from string (keyfp, living2) Optional Integration source type for special processing
additional_program string Optional Additional program short name to include
tags array Optional Array of tags for Mautic categorization (requires ma=yes)
callroll string (yes, no) Optional Trigger Rolling Strong integration
Default: no
affiliate string Optional Affiliate tracking identifier
insurance array Optional Array of insurance coverage data for family members

Code Examples

Loading...
Loading...
Loading...
Loading...

Responses

200 Success User successfully subscribed to the bundle
{
    "bundle": "your_bundle_name",
    "subId": "81c022836b8f037e018df381efe496b9",
    "email": "john.doe@example.com",
    "first_name": "John",
    "middle_name": "",
    "last_name": "Doe",
    "source": "your_source_name",
    "lang": "en",
    "status": "success",
    "products": [
        {
            "name": "Product Name",
            "dashboard_name": "Product Display Name",
            "url": "https://product-url.com/access",
            "smallIcon": "https://cdn.example.com/icon.png",
            "accessibleOn": [
                "web",
                "mobile"
            ]
        }
    ]
}
200 Error Validation or processing error
{
    "errors": [
        "email is required",
        "Bundle is invalid"
    ]
}

Notes

  • The subId returned is an MD5 hash that uniquely identifies this subscription. Store it securely as it is required for subsequent API calls.
  • Products array contains all activated products for the bundle with their access URLs.
  • Use production=no for testing to avoid triggering third-party service integrations.
  • The same email can be subscribed to multiple different bundles.

Unsubscribe User

POST https://connectapi.living2-0.com/index.php/wp-json/api/v1/unsubscribeuser

Remove a user's subscription from a bundle. This endpoint deactivates all associated product access and removes the subscription record.

Parameters

Name Type Required Description
subid string Required Subscription ID returned from the subscribe endpoint. This is the MD5 hash that identifies the subscription.
email string Required Email address associated with the subscription. Must match the email used during subscription.
bundle string Required Bundle name to unsubscribe from. Must be a valid bundle the user is currently subscribed to.
production string (yes, no) Optional Production mode flag. Use "no" for sandbox/testing.
Default: yes
ma string (yes, no) Optional Update Mautic marketing automation tags
Default: no
tags array Optional Array of Mautic tags to add/update (requires ma=yes)

Code Examples

Loading...
Loading...
Loading...
Loading...

Responses

200 Success User successfully unsubscribed from the bundle
{
    "subid": "81c022836b8f037e018df381efe496b9",
    "bundle": "your_bundle_name",
    "message": "User unsubscribed successfully",
    "products": [
        {
            "name": "Product Name",
            "status": "deactivated"
        }
    ]
}
200 Error Validation or processing error
{
    "errors": [
        "Subid is invalid",
        "Bundle is invalid",
        "Record not found"
    ]
}

Notes

  • The subscription ID (subId) and email must match an existing subscription.
  • All product access will be immediately revoked upon unsubscription.
  • Use production=no for testing to avoid triggering third-party service integrations.
  • This action cannot be undone - the user will need to re-subscribe to regain access.

Get User

GET https://connectapi.living2-0.com/index.php/wp-json/api/v2/getuser

Retrieve user subscription information including all active products. Use this endpoint to verify a user's subscription status and get their product access URLs.

Parameters

Name Type Required Description
subid string Required Subscription ID returned from the subscribe endpoint
bundle string Required Bundle name to retrieve subscription for
production string (yes, no) Optional Production mode flag
Default: yes

Code Examples

Loading...
Loading...
Loading...
Loading...

Responses

200 Success User subscription data retrieved successfully
{
    "subid": "81c022836b8f037e018df381efe496b9",
    "bundle": "your_bundle_name",
    "email": "john.doe@example.com",
    "status": "success",
    "products": [
        {
            "name": "Product Name",
            "dashboard_name": "Product Display Name",
            "url": "https://product-url.com/access",
            "smallIcon": "https://cdn.example.com/icon.png"
        }
    ]
}
200 Error Validation or lookup error
{
    "errors": [
        "Bundle is invalid",
        "Record not found"
    ]
}

Notes

  • The subId parameter must match the subscription ID returned during subscription.
  • Returns all active products with their current access URLs.
  • Use this endpoint to verify subscription status before granting access.

Get User Data

GET https://connectapi.living2-0.com/index.php/wp-json/api/v2/getuserdata

Retrieve detailed user profile data including personal information and subscription history. This endpoint returns comprehensive user data for administrative purposes.

Parameters

Name Type Required Description
subid string Required Subscription ID returned from the subscribe endpoint

Code Examples

Loading...
Loading...
Loading...
Loading...

Responses

200 Success User data retrieved successfully
{
    "data": {
        "user_information": {
            "name": "John Doe",
            "email": "john.doe@example.com",
            "phone": "555-123-4567"
        },
        "services": {
            "service_name": {
                "url": "https://service-url.com/access",
                "status": "active"
            },
            "another_service": {
                "url": "https://another-service.com/access",
                "status": "active"
            }
        }
    }
}
200 Error Error retrieving user data
{
    "error": "Subscriber not found"
}
200 Error Missing required parameter
{
    "error": "Sub id is required"
}
200 Error Subscriber is disabled
{
    "error": "Subscriber is disabled"
}

Notes

  • Returns complete user profile including name, email, phone, and address.
  • Includes subscription metadata and timestamps.
  • Use this endpoint for user management and support operations.

Error Codes

The API returns errors in a consistent format. All responses return HTTP status 200, with errors indicated in the response body.

Error Response Format

{
    "errors": [
        "Error message 1",
        "Error message 2"
    ]
}

Common Error Messages

Error Type Message Pattern Description
required :name is required The specified field is missing or empty
email :name should be a valid e-mail address The provided email format is invalid
max_length :name should not be more than :param characters long The field value exceeds the maximum allowed length
min_length :name should be at least :param characters long The field value is shorter than minimum required length
date_format :name is invalid. Please use format like 2018-12-14 The date format is invalid. Use YYYY-MM-DD format
enum :name value is invalid The value is not in the list of allowed values
array :name should be array The field should be an array
bundle_invalid Bundle is invalid The specified bundle name does not exist in the system
source_invalid Source is invalid The specified source is not registered in the system
subid_invalid Subid is invalid The subscription ID does not match the provided email
record_not_found Record not found No subscription record exists for the provided parameters
already_subscribed User already subscribed to the bundle The user is already subscribed to the specified bundle
not_subscribed User is not subscribed to the existing bundle The user is not subscribed to the bundle specified for replacement

Handling Errors

Always check for the presence of an errors array in the response:

const response = await fetch(url, options);
const data = await response.json();

if (data.errors && data.errors.length > 0) {
    // Handle errors
    console.error('API Errors:', data.errors);
} else {
    // Process successful response
    console.log('Success:', data);
}

Rate Limits

To ensure fair usage and system stability, the API implements rate limiting.

Current Limits

Rate limits are applied per source identifier. Contact your administrator for specific limits applicable to your integration.

Best Practices

  • Implement exponential backoff for retries
  • Cache responses where appropriate
  • Batch operations when possible
  • Monitor your API usage