API Documentation

Complete reference for SECT.FIT Exercise API
← Back to App

Endpoints Overview

The SECT.FIT Exercise API provides RESTful endpoints to access a comprehensive database of exercises. All responses are in JSON format.

Get All Exercises

GET /api/exercises
Retrieve all exercises with pagination support.
Query Parameters:
page integer Page number (default: 1)
limit integer Items per page (default: 12, max: 100)
Example Request
GET /api/exercises?page=2&limit=24
Response (200 OK)
{
  "success": true,
  "data": [...],
  "pagination": {
    "currentPage": 2,
    "totalPages": 63,
    "totalItems": 1500,
    "itemsPerPage": 24
  }
}

Search Exercises

GET /api/exercises/search
Search exercises by name using text query.
Query Parameters:
q string required Search term to match against exercise names
Example Request
GET /api/exercises/search?q=bench%20press
Response (200 OK)
{
  "success": true,
  "count": 13,
  "data": [
    {
      "exerciseId": "ex_123",
      "name": "barbell bench press",
      "gifUrl": "https://...",
      "targetMuscles": ["pectorals"],
      "bodyParts": ["chest"],
      "equipments": ["barbell"],
      ...
    }
  ]
}

Filter Exercises

GET /api/exercises/filter
Filter exercises by body parts, equipment, and/or search term. Combine multiple filters for advanced queries.
Query Parameters:
bodyParts string | array Filter by body part(s): chest, back, shoulders, legs, etc.
equipments string | array Filter by equipment: dumbbell, barbell, cable, body weight, etc.
targetMuscles string | array Filter by target muscles: pectorals, deltoids, quadriceps, etc.
q string Additional text search filter
page integer Page number (default: 1)
limit integer Items per page (default: 12)
Example Request
GET /api/exercises/filter?bodyParts=chest,back&equipments=dumbbell&q=press
Response (200 OK)
{
  "success": true,
  "totalItems": 45,
  "data": [...],
  "pagination": { ... }
}

Get Exercise by ID

GET /api/exercises/:id
Retrieve a specific exercise by its unique ID.
URL Parameters:
id string required The unique exercise ID
Example Request
GET /api/exercises/0001
Response (200 OK)
{
  "success": true,
  "data": {
    "exerciseId": "0001",
    "name": "3/4 sit-up",
    "gifUrl": "https://...",
    "targetMuscles": ["abs"],
    "bodyParts": ["waist"],
    "equipments": ["body weight"],
    "secondaryMuscles": ["hip flexors"],
    "instruction_1": "Lie on your back...",
    ...
  }
}

Clear Cache

POST /api/exercises/cache/clear
Clear the server-side cache. Useful after data updates.
Example Request
POST /api/exercises/cache/clear
Response (200 OK)
{
  "success": true,
  "message": "Cache cleared successfully"
}

Multi-Value Parameters

The API supports multiple ways to pass array values for flexible integration:

1. Comma-Separated Values (CSV)
?bodyParts=chest,back,legs
2. Repeated Parameters
?bodyParts=chest&bodyParts=back&bodyParts=legs
3. JSON Array String
?bodyParts=["chest","back","legs"]
FlutterFlow Compatibility
The API automatically handles and ignores FlutterFlow closure placeholders (e.g., "closure 'minified:lgi'"). This ensures seamless integration with FlutterFlow applications.

Response Format

All successful responses follow this structure:

{
  "success": true,
  "data": [...],           // Array of exercises or single exercise object
  "count": 150,            // Total matching items (search only)
  "totalItems": 1500,      // Total items in database (filter only)
  "pagination": {          // Pagination info (when applicable)
    "currentPage": 1,
    "totalPages": 63,
    "totalItems": 1500,
    "itemsPerPage": 24
  }
}

Exercise Object Structure

{
  "exerciseId": "0001",
  "name": "3/4 sit-up",
  "gifUrl": "https://example.com/image.gif",
  "targetMuscles": ["abs"],
  "bodyParts": ["waist"],
  "equipments": ["body weight"],
  "secondaryMuscles": ["hip flexors", "obliques"],
  "instruction_1": "Lie on your back with knees bent...",
  "instruction_2": "Cross your arms over your chest...",
  ...
  "instruction_8": "Repeat for desired reps"
}

Error Responses

Error responses include a descriptive message:

{
  "success": false,
  "message": "Exercise not found"
}
Common HTTP Status Codes:
200 OK - Request successful
400 Bad Request - Invalid parameters
404 Not Found - Resource doesn't exist
500 Internal Server Error - Server issue

Rate Limiting & Caching

The API implements caching to improve performance. Cache TTL is 5 minutes (300 seconds). Frequently requested data is served from cache for faster response times.