> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tktchurch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Events

> Returns a paginated list of church events with filtering options

## Query Parameters

<ParamField query="type" type="string">
  Filter events by type. Options:

  * `service`: Church service
  * `meeting`: Meeting
  * `concert`: Concert
  * `workshop`: Workshop
  * `conference`: Conference
  * `social`: Social event
  * `other`: Other event type
</ParamField>

<ParamField query="status" type="string">
  Filter events by status. Options:

  * `scheduled`: Default status for upcoming events
  * `cancelled`: Cancelled events
  * `postponed`: Postponed events
  * `rescheduled`: Rescheduled events
</ParamField>

<ParamField query="tag" type="string">
  Filter events by tag
</ParamField>

<ParamField query="start" type="string">
  Filter events starting from this date (ISO 8601 format)
</ParamField>

<ParamField query="end" type="string">
  Filter events ending before this date (ISO 8601 format)
</ParamField>

## Response

<ResponseField name="data" type="array">
  Array of event objects

  <Expandable title="Event Object">
    <ResponseField name="id" type="string">
      Unique identifier for the event (UUID)
    </ResponseField>

    <ResponseField name="title" type="string">
      Event title
    </ResponseField>

    <ResponseField name="description" type="string">
      Event description
    </ResponseField>

    <ResponseField name="startDate" type="string">
      Event start date and time (ISO 8601)
    </ResponseField>

    <ResponseField name="endDate" type="string">
      Event end date and time (ISO 8601)
    </ResponseField>

    <ResponseField name="timezone" type="string">
      Event timezone
    </ResponseField>

    <ResponseField name="location" type="object">
      Event location details

      <Expandable title="Location Object">
        <ResponseField name="name" type="string">
          Location name
        </ResponseField>

        <ResponseField name="address" type="string">
          Street address
        </ResponseField>

        <ResponseField name="city" type="string">
          City
        </ResponseField>

        <ResponseField name="state" type="string">
          State/Province
        </ResponseField>

        <ResponseField name="country" type="string">
          Country
        </ResponseField>

        <ResponseField name="postalCode" type="string">
          Postal code
        </ResponseField>

        <ResponseField name="coordinates" type="object">
          <ResponseField name="latitude" type="number">
            Location latitude
          </ResponseField>

          <ResponseField name="longitude" type="number">
            Location longitude
          </ResponseField>
        </ResponseField>

        <ResponseField name="virtualMeetingUrl" type="string">
          URL for virtual meetings (if applicable)
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="type" type="string">
      Event type (service, meeting, concert, workshop, conference, social, other)
    </ResponseField>

    <ResponseField name="status" type="string">
      Event status (scheduled, cancelled, postponed, rescheduled)
    </ResponseField>

    <ResponseField name="recurrence" type="object">
      Event recurrence details (if recurring)

      <Expandable title="Recurrence Object">
        <ResponseField name="frequency" type="string">
          Recurrence frequency (daily, weekly, monthly, yearly)
        </ResponseField>

        <ResponseField name="interval" type="integer">
          Interval between occurrences
        </ResponseField>

        <ResponseField name="until" type="string">
          End date for recurrence (ISO 8601)
        </ResponseField>

        <ResponseField name="count" type="integer">
          Number of occurrences
        </ResponseField>

        <ResponseField name="byDay" type="array">
          Days of week (SU, MO, TU, WE, TH, FR, SA)
        </ResponseField>

        <ResponseField name="byMonth" type="array">
          Months (1-12)
        </ResponseField>

        <ResponseField name="byMonthDay" type="array">
          Days of month
        </ResponseField>

        <ResponseField name="excludeDates" type="array">
          Excluded dates (ISO 8601)
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="reminders" type="array">
      Event reminders

      <Expandable title="Reminder Object">
        <ResponseField name="type" type="string">
          Reminder type (email, notification, sms)
        </ResponseField>

        <ResponseField name="minutes" type="integer">
          Minutes before event
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="attachments" type="array">
      Event attachments

      <Expandable title="Attachment Object">
        <ResponseField name="name" type="string">
          Attachment name
        </ResponseField>

        <ResponseField name="url" type="string">
          Attachment URL
        </ResponseField>

        <ResponseField name="type" type="string">
          File type
        </ResponseField>

        <ResponseField name="size" type="integer">
          File size in bytes
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="calendarLinks" type="object">
      Calendar integration links

      <Expandable title="Calendar Links">
        <ResponseField name="google" type="string">
          Google Calendar link
        </ResponseField>

        <ResponseField name="apple" type="string">
          Apple Calendar link
        </ResponseField>

        <ResponseField name="outlook" type="string">
          Outlook Calendar link
        </ResponseField>

        <ResponseField name="yahoo" type="string">
          Yahoo Calendar link
        </ResponseField>

        <ResponseField name="ics" type="string">
          ICS file link
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="tags" type="array">
      Event tags
    </ResponseField>

    <ResponseField name="maxCapacity" type="integer">
      Maximum number of attendees (if applicable)
    </ResponseField>

    <ResponseField name="requiresGeolocation" type="boolean">
      Whether geolocation is required for attendance
    </ResponseField>

    <ResponseField name="geofenceRadius" type="number">
      Geofence radius in meters (if applicable)
    </ResponseField>

    <ResponseField name="createdByUserId" type="string">
      ID of user who created the event
    </ResponseField>

    <ResponseField name="updatedByUserId" type="string">
      ID of user who last updated the event
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      Creation timestamp (ISO 8601)
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      Last update timestamp (ISO 8601)
    </ResponseField>

    <ResponseField name="thumbnail" type="object">
      Event thumbnail image

      <Expandable title="Thumbnail Object">
        <ResponseField name="id" type="string">
          Thumbnail file ID
        </ResponseField>

        <ResponseField name="url" type="string">
          Thumbnail URL
        </ResponseField>

        <ResponseField name="provider" type="string">
          Storage provider
        </ResponseField>

        <ResponseField name="key" type="string">
          Storage key
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="metadata" type="object">
  <Expandable title="Metadata">
    <ResponseField name="page" type="integer">
      Current page number
    </ResponseField>

    <ResponseField name="per" type="integer">
      Items per page
    </ResponseField>

    <ResponseField name="total" type="integer">
      Total number of items
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.tktchurch.com/v1/events?type=service&status=scheduled&start=2024-01-01T00:00:00Z" \
    -H "Accept: application/json"
  ```

  ```javascript JavaScript theme={null}
  const listEvents = async (params = {}) => {
    const queryString = new URLSearchParams(params).toString();
    const response = await fetch(
      `https://api.tktchurch.com/v1/events?${queryString}`,
      {
        method: 'GET',
        headers: {
          'Accept': 'application/json'
        }
      }
    );

    if (!response.ok) {
      throw new Error('Failed to fetch events');
    }

    return response.json();
  };

  // Usage
  try {
    const events = await listEvents({
      type: 'service',
      status: 'scheduled',
      start: '2024-01-01T00:00:00Z'
    });
    console.log(events);
  } catch (error) {
    console.error('Error:', error);
  }
  ```

  ```swift Swift theme={null}
  struct EventsResponse: Codable {
      let data: [Event]
      let metadata: Metadata
  }

  func listEvents(
      type: String? = nil,
      status: String? = nil,
      start: Date? = nil
  ) async throws -> EventsResponse {
      var components = URLComponents(string: "https://api.tktchurch.com/v1/events")!
      var queryItems: [URLQueryItem] = []
      
      if let type = type {
          queryItems.append(URLQueryItem(name: "type", value: type))
      }
      if let status = status {
          queryItems.append(URLQueryItem(name: "status", value: status))
      }
      if let start = start {
          let formatter = ISO8601DateFormatter()
          queryItems.append(URLQueryItem(name: "start", value: formatter.string(from: start)))
      }
      
      components.queryItems = queryItems
      
      let request = URLRequest(url: components.url!)
      let (data, _) = try await URLSession.shared.data(for: request)
      return try JSONDecoder().decode(EventsResponse.self, from: data)
  }

  // Usage
  do {
      let events = try await listEvents(
          type: "service",
          status: "scheduled",
          start: Date()
      )
      print("Events:", events)
  } catch {
      print("Error:", error)
  }
  ```

  ```kotlin Kotlin theme={null}
  suspend fun listEvents(
      type: String? = null,
      status: String? = null,
      start: String? = null
  ): EventsResponse {
      val client = OkHttpClient()
      
      val urlBuilder = HttpUrl.Builder()
          .scheme("https")
          .host("api.tktchurch.com")
          .addPathSegment("v1")
          .addPathSegment("events")
      
      type?.let { urlBuilder.addQueryParameter("type", it) }
      status?.let { urlBuilder.addQueryParameter("status", it) }
      start?.let { urlBuilder.addQueryParameter("start", it) }
      
      val request = Request.Builder()
          .url(urlBuilder.build())
          .get()
          .build()
      
      client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) {
              throw IOException("Unexpected response ${response.code}")
          }
          
          return Json.decodeFromString(response.body?.string() ?: "")
      }
  }

  // Usage
  try {
      val events = listEvents(
          type = "service",
          status = "scheduled",
          start = "2024-01-01T00:00:00Z"
      )
      println("Events: $events")
  } catch (e: Exception) {
      println("Error: ${e.message}")
  }
  ```

  ```typescript React Native theme={null}
  import axios from 'axios';

  interface EventsResponse {
    data: Event[];
    metadata: {
      page: number;
      per: number;
      total: number;
    };
  }

  const listEvents = async (params: {
    type?: string;
    status?: string;
    start?: string;
  }): Promise<EventsResponse> => {
    try {
      const response = await axios.get(
        'https://api.tktchurch.com/v1/events',
        { params }
      );
      return response.data;
    } catch (error) {
      if (axios.isAxiosError(error)) {
        throw new Error(error.response?.data?.message || 'Failed to fetch events');
      }
      throw error;
    }
  };

  // Usage
  try {
    const events = await listEvents({
      type: 'service',
      status: 'scheduled',
      start: '2024-01-01T00:00:00Z'
    });
    console.log('Events:', events);
  } catch (error) {
    console.error('Error:', error);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": [
      {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "title": "Sunday Worship Service",
        "description": "Weekly Sunday worship service",
        "startDate": "2024-01-07T10:00:00Z",
        "endDate": "2024-01-07T12:00:00Z",
        "timezone": "America/New_York",
        "location": {
          "name": "Main Sanctuary",
          "address": "123 Church Street",
          "city": "New York",
          "state": "NY",
          "country": "USA",
          "postalCode": "10001",
          "coordinates": {
            "latitude": 40.7128,
            "longitude": -74.0060
          }
        },
        "type": "service",
        "status": "scheduled",
        "recurrence": {
          "frequency": "weekly",
          "interval": 1,
          "byDay": ["SU"]
        },
        "reminders": [
          {
            "type": "email",
            "minutes": 1440
          },
          {
            "type": "notification",
            "minutes": 60
          }
        ],
        "calendarLinks": {
          "google": "https://calendar.google.com/...",
          "apple": "webcal://...",
          "outlook": "https://outlook.office.com/...",
          "yahoo": "https://calendar.yahoo.com/...",
          "ics": "https://api.tktchurch.com/v1/events/123/calendar.ics"
        },
        "tags": ["worship", "sunday-service"],
        "maxCapacity": 500,
        "requiresGeolocation": true,
        "geofenceRadius": 100,
        "createdByUserId": "456e7890-f12g-34h5-i678-912345678901",
        "updatedByUserId": "456e7890-f12g-34h5-i678-912345678901",
        "createdAt": "2024-01-01T00:00:00Z",
        "updatedAt": "2024-01-01T00:00:00Z",
        "thumbnail": {
          "id": "789e0123-j45k-67l8-m901-234567890123",
          "url": "https://storage.tktchurch.com/thumbnails/event-123.jpg",
          "provider": "s3",
          "key": "thumbnails/event-123.jpg"
        }
      }
    ],
    "metadata": {
      "page": 1,
      "per": 10,
      "total": 50
    }
  }
  ```
</ResponseExample>
