Real-time club status and management system
The Fitness International Auto Attendant APIs provide real-time information about club locations, including open/closed status, hours of operation, and special closures. The API is optimized for auto-attendant phone systems and returns instant status calculations based on timezone-aware logic.
https://inbound-fitness-international.telnyx-worker.dev
All API requests should be made to this base URL. All endpoints return JSON responses.
Understanding the data model helps you make effective API calls. The system uses three main tables:
The most common use case is looking up a club by phone number to determine if it's open and what message to play:
Returns complete club information including real-time open/closed status and the appropriate message for your auto-attendant system.
curl "https://inbound-fitness-international.telnyx-worker.dev/api/phone?phone=3055551234"
{
"success": true,
"data": {
"id": 1,
"phone": "3055551234",
"location_name": "Miami Downtown",
"brand": "LA Fitness",
"region": "FL",
"is_open": false,
"current_status": "Closed",
"status_message": "Thank you for calling LA Fitness located at Miami Downtown. Our hours are 6AM to 10PM and we are currently closed. Please call back during open hours, thank you!",
"hours": {
"monday": { "open": "06:00", "close": "22:00" },
"tuesday": { "open": "06:00", "close": "22:00" },
...
},
"sun_open": "0800",
"sun_close": "2000",
"mon_open": "0600",
"mon_close": "2200",
"tue_open": "0600",
"tue_close": "2200",
"wed_open": "0600",
"wed_close": "2200",
"thu_open": "0600",
"thu_close": "2200",
"fri_open": "0600",
"fri_close": "2200",
"sat_open": "0800",
"sat_close": "2000"
}
}
sun_open, mon_open, etc.): 4-digit format without colon (e.g., "0600" for 6:00 AM)hours.monday.open, etc.): HH:MM format with colon (e.g., "06:00")Purpose: Get club by phone number (primary auto-attendant endpoint)
Parameters:
phone REQUIRED - 10-digit phone numberReturns: Complete club info with real-time status and message
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/phone?phone=3055551234' \
-H 'Accept: application/json'
Purpose: Consolidated search endpoint - search clubs by any field
Search Parameters (at least one required):
id OPTIONAL - Club database IDdept_id OPTIONAL - Department IDclub_id OPTIONAL - Club IDphone OPTIONAL - 10-digit phone numberforwarding_number OPTIONAL - Microsoft Teams forwarding numberlocation_name OPTIONAL - Location name (partial match supported)Returns: Array of clubs matching search criteria
# Search by club_id
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/search?club_id=0001' \
-H 'Accept: application/json'
# Search by location name (partial match)
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/search?location_name=Miami' \
-H 'Accept: application/json'
# Search by forwarding number
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/search?forwarding_number=%2B18005551234' \
-H 'Accept: application/json'
# Multiple criteria (AND logic)
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/search?dept_id=101®ion=FL' \
-H 'Accept: application/json'
Purpose: List all clubs (optionally filtered by region or brand)
Optional Parameters:
region OPTIONAL - Filter by US state or Canadian province (e.g., FL, CA, ON)brand OPTIONAL - Filter by brand name (e.g., "LA Fitness")Returns: Array of all clubs (without real-time status calculation for performance)
# Get all clubs
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/locations' \
-H 'Accept: application/json'
# Get all clubs in Florida
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/locations?region=FL' \
-H 'Accept: application/json'
# Get all LA Fitness clubs
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/locations?brand=LA%20Fitness' \
-H 'Accept: application/json'
# Get all LA Fitness clubs in California
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/locations?region=CA&brand=LA%20Fitness' \
-H 'Accept: application/json'
Purpose: Create a new club
Required Fields:
dept_id, club_id, phone, location_name, address, regionOptional Fields:
brand, status, default_message, forwarding_number, amenities, hours (array of 7 days)curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/club' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg=' \
--data-raw '{
"dept_id": "101",
"club_id": "0025",
"phone": "3055559876",
"location_name": "Miami Beach",
"address": "500 Ocean Drive, Miami Beach, FL 33139",
"region": "FL",
"brand": "LA Fitness",
"status": "active",
"default_message": "default",
"forwarding_number": "+18005551234",
"amenities": "Swimming Pool, Basketball Court, Sauna, Free Weights",
"hours": [
{"day": 0, "open": "08:00", "close": "20:00"},
{"day": 1, "open": "05:00", "close": "23:00"},
{"day": 2, "open": "05:00", "close": "23:00"},
{"day": 3, "open": "05:00", "close": "23:00"},
{"day": 4, "open": "05:00", "close": "23:00"},
{"day": 5, "open": "05:00", "close": "23:00"},
{"day": 6, "open": "08:00", "close": "20:00"}
]
}'
0 = Sunday1 = Monday2 = Tuesday3 = Wednesday4 = Thursday5 = Friday6 = Saturday"06:00" (with colon) or "0600" (without colon)"HH:MM" format in database (e.g., "06:00"){"day": 1, "open": "0600", "close": "2200"} ✅{"day": 1, "open": "06:00", "close": "22:00"} ✅For phone field (club's main number):
"3055551234" (10 digits) ✅"305-555-1234" (with dashes) ✅"(305) 555-1234" (with parentheses) ✅"1-305-555-1234" (11 digits with country code) ✅"3055551234")For forwarding_number field (Microsoft Teams destination):
"+18005551234" (+E.164 format) ✅"18005551234" (E.164 without +) ✅"8005551234" (10 digits, auto-adds +1) ✅"800-555-1234" (with dashes, auto-adds +1) ✅"+442071838750" (international E.164) ✅"442071838750" (international without +) ✅"+18005551234")Purpose: Update an existing club
Identifier: Must provide phone, club_id, or dept_id to identify the club
Updatable Fields: Any club field including hours
# Update by phone
curl -L -X PUT 'https://inbound-fitness-international.telnyx-worker.dev/api/club' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg=' \
--data-raw '{
"phone": "3055559876",
"brand": "Esporta Fitness",
"forwarding_number": "+18005556789"
}'
# Update by dept_id
curl -L -X PUT 'https://inbound-fitness-international.telnyx-worker.dev/api/club' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg=' \
--data-raw '{
"dept_id": "101",
"default_message": "Thank you for calling!",
"amenities": "Swimming Pool, Sauna, Basketball Court"
}'
Purpose: Delete a club
Parameters (at least one required):
phone OPTIONAL - 10-digit phone numberclub_id OPTIONAL - Club IDdept_id OPTIONAL - Department ID# Delete by phone
curl -L -X DELETE 'https://inbound-fitness-international.telnyx-worker.dev/api/club?phone=3055559876' \
-H 'Accept: application/json'
# Delete by dept_id
curl -L -X DELETE 'https://inbound-fitness-international.telnyx-worker.dev/api/club?dept_id=101' \
-H 'Accept: application/json'
Purpose: Get special closures for a specific club
Required Parameters (at least one):
phone REQUIRED* - Club phone number (10 digits)club_id REQUIRED* - Club IDdept_id REQUIRED* - Department ID*At least one club identifier (phone, club_id, or dept_id) is required
Optional Filter Parameters:
closure_type OPTIONAL - Filter by type (emergency, weather, holiday, maintenance, event)closure_date OPTIONAL - Filter by specific date (YYYY-MM-DD)start_date OPTIONAL - Filter by date range start (YYYY-MM-DD)end_date OPTIONAL - Filter by date range end (YYYY-MM-DD)Returns: Array of closures for the specified club (ordered by date descending)
# Get all closures for a club by phone
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closures?phone=3055551234' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg='
# Get emergency closures for a club
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closures?dept_id=123&closure_type=emergency' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg='
# Get closures for a club in date range
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closures?club_id=456&start_date=2025-12-01&end_date=2025-12-31' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg='
# Get holiday closures for December for a club
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closures?phone=3055551234&closure_type=holiday&start_date=2025-12-01&end_date=2025-12-31' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer KbHHX+XEBbAKcya3GayPKFyiNMOsVxIHxqQ4F+gvNDg='
Purpose: Add a special closure (holiday, emergency, etc.)
Required Fields:
phone, club_id, or dept_id - Club identifier (at least one required)closure_date - Format: YYYY-MM-DDclosure_type - One of: emergency, weather, holiday, maintenance, eventOptional Fields:
reason - Description of closureopen_time, close_time - For special hours (leave null for closed all day)closure_allday - Set to true for all-day closure (automatically sets open_time and close_time to null)custom_message - Message to play to callerscurl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closure' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"phone": "3055551234",
"closure_date": "2025-12-25",
"closure_type": "holiday",
"reason": "Christmas Day",
"closure_allday": true,
"custom_message": "Merry Christmas! We are closed today and will reopen December 26th."
}'
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closure' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"phone": "3055551234",
"closure_date": "2025-12-25",
"closure_type": "holiday",
"reason": "Christmas Day",
"custom_message": "Merry Christmas! We are closed today and will reopen December 26th."
}'
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closure' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"phone": "3055551234",
"closure_date": "2025-12-24",
"closure_type": "holiday",
"reason": "Christmas Eve",
"open_time": "08:00",
"close_time": "14:00",
"custom_message": "Happy Holidays! We close early today at 2 PM for Christmas Eve."
}'
Both open_time and close_time accept either format:
"08:00" (with colon) or "0800" (without colon) ✅"14:00" (with colon) or "1400" (without colon) ✅Purpose: Add closures for multiple dates and/or multiple clubs in a single API call
Required Fields:
dates - Array of dates (YYYY-MM-DD format)closure_type - One of: emergency, weather, holiday, maintenance, eventclub_ids (array of club IDs) OR apply_to_all: true (affects all active clubs)Optional Fields:
reason - Description for all closurescustom_message - Message for all closuresopen_time, close_time - For special hours (applies to all dates)closure_allday - Set to true for all-day closures (automatically sets open_time and close_time to null for all dates)curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"dates": ["2025-12-24", "2025-12-25", "2025-12-26"],
"closure_type": "holiday",
"reason": "Christmas Holiday",
"closure_allday": true,
"custom_message": "Happy Holidays! We are closed for Christmas and will reopen on December 27th.",
"apply_to_all": true
}'
curl -L 'https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"club_ids": [1, 2, 5, 8],
"dates": ["2025-09-15"],
"closure_type": "weather",
"reason": "Hurricane Warning",
"custom_message": "Due to severe weather, our clubs are temporarily closed for your safety."
}'
Purpose: Remove a single special closure
Parameters:
id REQUIRED - Closure ID from specialClosures arraycurl -L -X DELETE 'https://inbound-fitness-international.telnyx-worker.dev/api/closure?id=123' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
Purpose: Delete all holiday closures for a specific club
Parameters (at least one required):
phone - Club phone numberclub_id - Club IDdept_id - Department IDUse Cases:
Returns: Count of deleted holiday closures and club information
curl -L -X DELETE 'https://inbound-fitness-international.telnyx-worker.dev/api/closures/holidays?phone=3055551234' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
curl -L -X DELETE 'https://inbound-fitness-international.telnyx-worker.dev/api/closures/holidays?club_id=0001' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
{
"success": true,
"message": "Deleted all holiday closures for club: Miami Downtown",
"club_id": 1,
"club_name": "Miami Downtown",
"deleted_count": 12
}
closure_type = 'holiday' for the specified club. Emergency, weather, maintenance, and event closures are not affected.
The API automatically generates appropriate messages for your auto-attendant system based on the club's status and configuration.
Set default_message = "default" in your club configuration to enable automatic message generation:
"Thank you for calling {brand} located at {location}. Our hours are {open_time} to {close_time} and we are currently closed. Please call back during open hours, thank you!"
| Club Status | Scenario | Returned status_message |
|---|---|---|
| OPEN | Regular hours | Empty string (call transfers immediately) |
| OPEN | Special hours (holiday) | Message before transfer (e.g., "We are open today with special hours until 14:00. Please hold while we connect you.") |
| CLOSED | default_message = "default" | Generated message with club details |
| CLOSED | Custom default_message | Uses your custom message |
| CLOSED | default_message empty/null | Generic fallback message |
status_message is empty (immediate transfer)status_message contains a brief message to inform the caller before transferringWhen you add special closures (holidays, emergencies, etc.), the system automatically prioritizes them to ensure the most important information is communicated first.
Special closures can be configured two ways:
| Configuration | Result | Example |
|---|---|---|
open_time: nullclose_time: null |
Closed all day | Christmas Day closure |
open_time: "10:00"close_time: "14:00" |
Special hours (10am-2pm) | Christmas Eve limited hours |
The bulk closure endpoint allows you to efficiently manage multiple closures across multiple dates and/or multiple clubs in a single API call. This is especially useful for consecutive holidays or company-wide closures.
Close all clubs for Christmas Eve, Christmas Day, and Boxing Day:
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk" \
-H "Content-Type: application/json" \
-d '{
"dates": ["2025-12-24", "2025-12-25", "2025-12-26"],
"closure_type": "holiday",
"reason": "Christmas Holiday",
"custom_message": "Happy Holidays! We are closed for Christmas and will reopen on December 27th.",
"apply_to_all": true
}'
Result: All active clubs will be closed on all three dates with the same message.
Keep clubs open with reduced hours on Christmas Eve:
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk" \
-H "Content-Type: application/json" \
-d '{
"dates": ["2025-12-24"],
"closure_type": "holiday",
"reason": "Christmas Eve",
"open_time": "08:00",
"close_time": "14:00",
"custom_message": "Happy Holidays! We close early today at 2 PM for Christmas Eve.",
"apply_to_all": true
}'
Result: All clubs open 8am-2pm on Christmas Eve with special hours message.
Close only Canadian clubs for Canada Day:
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk" \
-H "Content-Type: application/json" \
-d '{
"club_ids": [45, 67, 89, 102, 156],
"dates": ["2025-07-01"],
"closure_type": "holiday",
"reason": "Canada Day",
"custom_message": "Happy Canada Day! We are closed today and will reopen July 2nd.",
}'
Result: Only specified clubs are closed on July 1st.
For holidays that need different messages on different days, make separate bulk calls:
# Christmas Eve - Special hours
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk" \
-H "Content-Type: application/json" \
-d '{
"dates": ["2025-12-24"],
"closure_type": "holiday",
"reason": "Christmas Eve",
"open_time": "08:00",
"close_time": "14:00",
"custom_message": "Happy Holidays! We close early today at 2 PM.",
"apply_to_all": true
}'
# Christmas & Boxing Day - Fully closed
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk" \
-H "Content-Type: application/json" \
-d '{
"dates": ["2025-12-25", "2025-12-26"],
"closure_type": "holiday",
"reason": "Christmas Holiday",
"custom_message": "Merry Christmas! We are closed and will reopen December 27th.",
"apply_to_all": true
}'
Close clubs for an entire week:
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closures/bulk" \
-H "Content-Type: application/json" \
-d '{
"dates": [
"2025-12-29",
"2025-12-30",
"2025-12-31",
"2026-01-01",
"2026-01-02",
"2026-01-03",
"2026-01-04"
],
"closure_type": "holiday",
"reason": "Year-End Holiday Break",
"custom_message": "Happy Holidays! We are closed for our year-end break and will reopen January 5th.",
"apply_to_all": true
}'
closure_type, reason, and custom_message for all datesopen_time/close_time) apply to all dates in the arrayAPI Response:
{
"is_open": true,
"current_status": "Open",
"status_message": "" // Empty - transfer call immediately
}
Auto-Attendant Action: Transfer call to club location
Club Configuration: default_message = "default"
API Response:
{
"is_open": false,
"current_status": "Closed",
"status_message": "Thank you for calling LA Fitness located at Downtown Miami. Our hours are 06:00 to 22:00 and we are currently closed. Please call back during open hours, thank you!"
}
Auto-Attendant Action: Play generated message, offer voicemail
Situation: Power outage at location
API Response:
{
"is_open": false,
"current_status": "emergency",
"status_message": "EMERGENCY: The club is closed due to a power outage. Please check back for updates.",
"specialClosures": [
{
"closure_type": "emergency",
"reason": "Power Outage",
"custom_message": "EMERGENCY: The club is closed due to a power outage. Please check back for updates."
}
]
}
Auto-Attendant Action: Play emergency message
Situation: Christmas Eve - open 10am-2pm, caller calls at 11am
API Response:
{
"is_open": true,
"current_status": "Open - Special Hours",
"status_message": "We are open today with special hours until 14:00. Please hold while we connect you.",
"specialClosures": [
{
"closure_type": "holiday",
"open_time": "10:00",
"close_time": "14:00",
"custom_message": null
}
]
}
Auto-Attendant Action: Play special hours message, then transfer call
Note: If the closure has a custom_message, that message is used instead of the default template.
Situation: Emergency + Holiday + Maintenance all on same day
API Response:
{
"is_open": false,
"current_status": "emergency", // Emergency wins (highest priority)
"status_message": "EMERGENCY: The club is closed due to a power outage...",
"specialClosures": [
{ "closure_type": "emergency", "reason": "Power Outage" },
{ "closure_type": "holiday", "reason": "Christmas" },
{ "closure_type": "maintenance", "reason": "HVAC Repair" }
]
}
Note: All closures are returned, but only the highest priority (emergency) is used for status determination.
A test club is available for development and testing purposes:
5555555555GET /api/phone?phone=5555555555
You can add test closures to verify priority logic:
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closure" \
-H "Content-Type: application/json" \
-d '{
"phone": "5555555555",
"closure_date": "2025-12-25",
"closure_type": "holiday",
"reason": "Christmas Day",
"custom_message": "Merry Christmas! We are closed today."
}'
curl -X POST "https://inbound-fitness-international.telnyx-worker.dev/api/closure" \
-H "Content-Type: application/json" \
-d '{
"phone": "5555555555",
"closure_date": "2025-12-25",
"closure_type": "emergency",
"reason": "Power Outage",
"custom_message": "EMERGENCY: Club closed due to power outage."
}'
When you query the test club on 12/25, the emergency message will be returned (higher priority than holiday).
To test dynamic message generation, ensure the test club has default_message = "default" and query during closed hours.
# Get club status
curl "https://inbound-fitness-international.telnyx-worker.dev/api/phone?phone=3055551234"
# List all locations
curl "https://inbound-fitness-international.telnyx-worker.dev/api/locations"
# Get club by ID
curl "https://inbound-fitness-international.telnyx-worker.dev/api/club?club_id=0001"
# Filter by region (US state or Canadian province)
curl "https://inbound-fitness-international.telnyx-worker.dev/api/region?region=FL"
curl "https://inbound-fitness-international.telnyx-worker.dev/api/region?region=ON"
Navigate to the Telnyx portal and go to Real-Time Communications > Voice > Programmable Voice > TeXML Applications to locate the "after_hours" profile.
Click the pencil/edit button to access the configuration options for your TeXML profile.
The starter file includes an HTTP request that:
The configuration makes an HTTP request to https://inbound-fitness-international.telnyx-worker.dev/api/phone?phone={{To}} and extracts JSON response fields.
<Response>
<HttpRequest action="https://api.telnyx.com/v2/media/hours_handler.xml">
<Request url="https://inbound-fitness-international.telnyx-worker.dev/api/phone?phone={{To}}" method="GET">
</Request>
<Header>
<Key>Content-Type</Key>
<Value>application/json</Value>
</Header>
<Response>
<Type>JSON</Type>
<StatusCode>200</StatusCode>
<Content>
<Field>
<Name>data.current_status</Name>
<Value>current_status</Value>
</Field>
<Field>
<Name>data.status_message</Name>
<Value>status_message</Value>
</Field>
<Field>
<Name>data.forwarding_number</Name>
<Value>forwarding_number</Value>
</Field>
</Content>
</Response>
</HttpRequest>
</Response>
The hours handler TeXML script (found in TeXML Bins) includes conditional logic:
The voice setting uses Azure.en-US-Ava:DragonHDLatestNeural but can be customized using any supported Telnyx voice from their text-to-speech documentation.
<Response>
{{#if {{current_status}}!=Open}}
<Say voice="Azure.en-US-Ava:DragonHDLatestNeural">{{status_message}}</Say>
{{#else}}
<Dial>{{forwarding_number}}</Dial>
{{/if}}
</Response>
Fitness International Auto Attendant APIs v3.0 - Powered by Cloudflare Workers + D1
Documentation last updated: October 2025