API Integration Guide

This API allows third-party developers to sync members to a specific portal within The Lifestyle Card system. It supports adding, updating, and removing members, and uses simple REST principles secured with a Bearer token.

API Developer Notes

  • Users are created automatically if no existing user matches the submitted email.
  • Passwords for new users are auto-generated and dispatched via a TLC welcome email.
  • expiry_date is required and must use YYYY-MM-DD format.
  • API responses include a per-record success flag and error details when applicable.
  • Rate limiting enforced: maximum 1,000 requests per hour per portal.
  • Client IPs are logged for all API interactions to monitor abuse and support auditing.
  • Deleting users via API (bulk-delete) removes their portal membership only; the user account remains intact.
  • If a user with the submitted email already exists, their first_name, last_name, and expiry_date will be updated.

API Authentication

To access the TLC Membership API, every request must include a valid API key and be associated with a specific Portal ID. Each organisation is issued a unique API key and a designated Portal ID, both of which are required for all API operations. These credentials are provided by The Lifestyle Card (TLC) team during onboarding.

API Key Formats Supported (Include one)

				
					Authorization: Bearer YOUR_API_KEY_HERE

				
			
				
					X-API-KEY: YOUR_API_KEY_HERE
				
			

Specific Portal ID

				
					https://thelifesstylecard.co.uk/wp-json/tlc-membership/v1/portal/1234/members

				
			

API Endpoints

Add or Update Members (Bulk add or update members)

Endpoint: POST /wp-json/tlc-membership/v1/portal/{portal_id}/members

				
					[
  {
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@example.com",
    "expiry_date": "2025-12-31"
  },
  {
    "first_name": "Jane",
    "last_name": "Smith",
    "email": "jane@example.com",
    "expiry_date": "2025-11-15"
  }
]

				
			

Remove Members (Remove members from TLC)

Endpoint: DELETE /wp-json/tlc-membership/v1/portal/{portal_id}/members/bulk-delete

				
					{
  "user_ids": [123, 456]
}

				
			

Get Members (Returns a paginated list of portal members)

Endpoint: GET /wp-json/tlc-membership/v1/portal/{portal_id}/members?page=1&limit=20

Example cURL Requests

Add or Update Members cURL Request

				
					curl -X POST https://yoursite.com/wp-json/tlc-membership/v1/portal/123/members \
-H "Authorization: Bearer YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '[{"first_name":"Alice","last_name":"Brown","email":"alice@example.com","expiry_date":"2025-12-01"}]'

				
			

Delete Members cURL Request

				
					curl -X DELETE https://yoursite.com/wp-json/tlc-membership/v1/portal/123/members/bulk-delete \
  -H "Authorization: Bearer YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"user_ids": [1234, 5678]}'

				
			

Get Members cURL Request

				
					curl -X GET "https://yoursite.com/wp-json/tlc-membership/v1/portal/74497/members?page=1&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY_HERE"

				
			

Example Responses

Success Response

				
					[
  {
    "success": true,
    "message": "Member added/updated successfully",
    "user_id": 789,
    "email": "alice@example.com"
  }
]

				
			

Error Responses

				
					{
  "code": "unauthorized",
  "message": "Missing API key",
  "data": {
    "status": 403
  }
}

				
			
				
					{
  "code": "invalid_request",
  "message": "Invalid request payload",
  "data": {
    "status": 400
  }
}

				
			
				
					[
  {
    "success": false,
    "error": "Invalid email address",
    "email": "bademail"
  },
  {
    "success": false,
    "error": "Expiry date must be in Y-m-d format",
    "email": "jane@example.com"
  }
]

				
			
				
					{
  "code": "rest_no_route",
  "message": "No route was found matching the URL and request method",
  "data": {
    "status": 404
  }
}

				
			
				
					{
  "code": "invalid_request",
  "message": "Invalid user IDs",
  "data": {
    "status": 400
  }
}

				
			
				
					{
  "code": "rate_limit_exceeded",
  "message": "API rate limit exceeded. Please wait and try again later.",
  "data": {
    "status": 429
  }
}
				
			

Search

Select A Search Option Below

Search Local Discounts

Search National Offers