> ## 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.

# Update Event

> Update an existing event

<Note>
  This endpoint requires authentication and the `updateEvent` permission.
</Note>

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier (UUID) of the event to update
</ParamField>

## Request Body

<ParamField body="title" type="string" required>
  Event title
</ParamField>

<ParamField body="description" type="string" required>
  Event description
</ParamField>

<ParamField body="startDate" type="string" required>
  Event start date and time in ISO 8601 format
</ParamField>

<ParamField body="endDate" type="string" required>
  Event end date and time in ISO 8601 format
</ParamField>

<ParamField body="timezone" type="string" required>
  Event timezone (e.g., "America/New\_York")
</ParamField>

<ParamField body="location" type="object" required>
  Event location details

  <Expandable title="Location Object">
    <ParamField body="name" type="string" required>
      Location name
    </ParamField>

    <ParamField body="address" type="string" required>
      Street address
    </ParamField>

    <ParamField body="city" type="string" required>
      City
    </ParamField>

    <ParamField body="state" type="string" required>
      State/Province
    </ParamField>

    <ParamField body="country" type="string" required>
      Country
    </ParamField>

    <ParamField body="postalCode" type="string" required>
      Postal code
    </ParamField>

    <ParamField body="coordinates" type="object" required>
      <ParamField body="latitude" type="number" required>
        Location latitude
      </ParamField>

      <ParamField body="longitude" type="number" required>
        Location longitude
      </ParamField>
    </ParamField>

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

<ParamField body="type" type="string" required>
  Event type. One of:

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

<ParamField body="status" type="string">
  Event status. One of:

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

<ParamField body="recurrence" type="object">
  Event recurrence details

  <Expandable title="Recurrence Object">
    <ParamField body="frequency" type="string" required>
      Recurrence frequency. One of: `daily`, `weekly`, `monthly`, `yearly`
    </ParamField>

    <ParamField body="interval" type="integer" required>
      Interval between occurrences
    </ParamField>

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

    <ParamField body="count" type="integer">
      Number of occurrences
    </ParamField>

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

    <ParamField body="byMonth" type="array">
      Months (1-12)
    </ParamField>

    <ParamField body="byMonthDay" type="array">
      Days of month
    </ParamField>

    <ParamField body="excludeDates" type="array">
      Excluded dates (ISO 8601)
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="reminders" type="array">
  Event reminders

  <Expandable title="Reminder Object">
    <ParamField body="type" type="string" required>
      Reminder type. One of: `email`, `notification`, `sms`
    </ParamField>

    <ParamField body="minutes" type="integer" required>
      Minutes before event
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="attachments" type="array">
  Event attachments

  <Expandable title="Attachment Object">
    <ParamField body="name" type="string" required>
      Attachment name
    </ParamField>

    <ParamField body="url" type="string" required>
      Attachment URL
    </ParamField>

    <ParamField body="type" type="string" required>
      File type
    </ParamField>

    <ParamField body="size" type="integer">
      File size in bytes
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="tags" type="array">
  Array of event tags
</ParamField>

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

<ParamField body="requiresGeolocation" type="boolean">
  Whether geolocation is required for attendance
</ParamField>

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

<ParamField body="thumbnailId" type="string">
  UUID of the uploaded thumbnail file
</ParamField>

## Response

Returns the updated event object. See [Get Event Details](/api-reference/endpoint/events/get-event-details) for the response format.

## Error Responses

<ResponseField name="error" type="object">
  Error details when the request fails

  <Expandable title="Error Object">
    <ResponseField name="status" type="integer">
      HTTP status code
    </ResponseField>

    <ResponseField name="reason" type="string">
      Error message explaining why the request failed
    </ResponseField>
  </Expandable>
</ResponseField>

<Note>
  Common error cases:

  * 400 Bad Request: Invalid request body or validation errors
  * 401 Unauthorized: Missing or invalid access token
  * 403 Forbidden: Insufficient permissions
  * 404 Not Found: Event not found
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.tktchurch.com/v1/events/123e4567-e89b-12d3-a456-426614174000" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{
      "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",
      "recurrence": {
        "frequency": "weekly",
        "interval": 1,
        "byDay": ["SU"]
      },
      "reminders": [
        {
          "type": "email",
          "minutes": 1440
        },
        {
          "type": "notification",
          "minutes": 60
        }
      ],
      "tags": ["worship", "sunday-service"],
      "maxCapacity": 500,
      "requiresGeolocation": true,
      "geofenceRadius": 100
    }'
  ```

  ```javascript JavaScript theme={null}
  const updateEvent = async (accessToken, eventId, eventData) => {
    const response = await fetch(
      `https://api.tktchurch.com/v1/events/${eventId}`,
      {
        method: 'PUT',
        headers: {
          'Authorization': `Bearer ${accessToken}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(eventData)
      }
    );

    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.error.reason);
    }

    return response.json();
  };

  // Usage
  try {
    const event = await updateEvent(
      accessToken,
      '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',
        recurrence: {
          frequency: 'weekly',
          interval: 1,
          byDay: ['SU']
        },
        reminders: [
          {
            type: 'email',
            minutes: 1440
          },
          {
            type: 'notification',
            minutes: 60
          }
        ],
        tags: ['worship', 'sunday-service'],
        maxCapacity: 500,
        requiresGeolocation: true,
        geofenceRadius: 100
      }
    );
    console.log('Updated event:', event);
  } catch (error) {
    console.error('Error:', error);
  }
  ```

  ```swift Swift theme={null}
  struct UpdateEventRequest: Codable {
      let title: String
      let description: String
      let startDate: Date
      let endDate: Date
      let timezone: String
      let location: Location
      let type: String
      let recurrence: Recurrence?
      let reminders: [Reminder]
      let tags: [String]
      let maxCapacity: Int?
      let requiresGeolocation: Bool
      let geofenceRadius: Double?
  }

  func updateEvent(accessToken: String, eventId: UUID, event: UpdateEventRequest) async throws -> Event {
      var urlRequest = URLRequest(url: URL(string: "https://api.tktchurch.com/v1/events/\(eventId)")!)
      urlRequest.httpMethod = "PUT"
      urlRequest.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")
      urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
      
      urlRequest.httpBody = try JSONEncoder().encode(event)
      
      let (data, response) = try await URLSession.shared.data(for: urlRequest)
      guard let httpResponse = response as? HTTPURLResponse else {
          throw URLError(.badServerResponse)
      }
      
      if httpResponse.statusCode != 200 {
          let error = try JSONDecoder().decode(ErrorResponse.self, from: data)
          throw error
      }
      
      return try JSONDecoder().decode(Event.self, from: data)
  }

  // Usage
  do {
      let event = try await updateEvent(
          accessToken: accessToken,
          eventId: UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000")!,
          event: UpdateEventRequest(
              title: "Sunday Worship Service",
              description: "Weekly Sunday worship service",
              startDate: Date(),
              endDate: Date().addingTimeInterval(7200),
              timezone: "America/New_York",
              location: Location(
                  name: "Main Sanctuary",
                  address: "123 Church Street",
                  city: "New York",
                  state: "NY",
                  country: "USA",
                  postalCode: "10001",
                  coordinates: Coordinates(
                      latitude: 40.7128,
                      longitude: -74.0060
                  )
              ),
              type: "service",
              recurrence: Recurrence(
                  frequency: "weekly",
                  interval: 1,
                  byDay: ["SU"]
              ),
              reminders: [
                  Reminder(type: "email", minutes: 1440),
                  Reminder(type: "notification", minutes: 60)
              ],
              tags: ["worship", "sunday-service"],
              maxCapacity: 500,
              requiresGeolocation: true,
              geofenceRadius: 100
          )
      )
      print("Updated event:", event)
  } catch {
      print("Error:", error)
  }
  ```

  ```kotlin Kotlin theme={null}
  data class UpdateEventRequest(
      val title: String,
      val description: String,
      val startDate: Date,
      val endDate: Date,
      val timezone: String,
      val location: Location,
      val type: String,
      val recurrence: Recurrence?,
      val reminders: List<Reminder>,
      val tags: List<String>,
      val maxCapacity: Int?,
      val requiresGeolocation: Boolean,
      val geofenceRadius: Double?
  )

  suspend fun updateEvent(accessToken: String, eventId: String, event: UpdateEventRequest): Event {
      val client = OkHttpClient()
      
      val requestBody = Json.encodeToString(event)
      
      val request = Request.Builder()
          .url("https://api.tktchurch.com/v1/events/$eventId")
          .put(RequestBody.create(MediaType.parse("application/json"), requestBody))
          .header("Authorization", "Bearer $accessToken")
          .build()
      
      client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) {
              val error = response.body?.string()?.fromJson<ErrorResponse>()
              throw Exception(error?.reason ?: "Failed to update event")
          }
          
          return response.body?.string()?.fromJson<Event>()
              ?: throw Exception("Empty response")
      }
  }

  // Usage
  try {
      val event = updateEvent(
          accessToken = accessToken,
          eventId = "123e4567-e89b-12d3-a456-426614174000",
          event = UpdateEventRequest(
              title = "Sunday Worship Service",
              description = "Weekly Sunday worship service",
              startDate = Date(),
              endDate = Date().apply { time += 7200000 },
              timezone = "America/New_York",
              location = Location(
                  name = "Main Sanctuary",
                  address = "123 Church Street",
                  city = "New York",
                  state = "NY",
                  country = "USA",
                  postalCode = "10001",
                  coordinates = Coordinates(
                      latitude = 40.7128,
                      longitude = -74.0060
                  )
              ),
              type = "service",
              recurrence = Recurrence(
                  frequency = "weekly",
                  interval = 1,
                  byDay = listOf("SU")
              ),
              reminders = listOf(
                  Reminder(type = "email", minutes = 1440),
                  Reminder(type = "notification", minutes = 60)
              ),
              tags = listOf("worship", "sunday-service"),
              maxCapacity = 500,
              requiresGeolocation = true,
              geofenceRadius = 100.0
          )
      )
      println("Updated event: $event")
  } catch (e: Exception) {
      println("Error: ${e.message}")
  }
  ```

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

  interface UpdateEventRequest {
    title: string;
    description: string;
    startDate: string;
    endDate: string;
    timezone: string;
    location: {
      name: string;
      address: string;
      city: string;
      state: string;
      country: string;
      postalCode: string;
      coordinates: {
        latitude: number;
        longitude: number;
      };
      virtualMeetingUrl?: string;
    };
    type: 'service' | 'meeting' | 'concert' | 'workshop' | 'conference' | 'social' | 'other';
    recurrence?: {
      frequency: 'daily' | 'weekly' | 'monthly' | 'yearly';
      interval: number;
      until?: string;
      count?: number;
      byDay?: string[];
      byMonth?: number[];
      byMonthDay?: number[];
      excludeDates?: string[];
    };
    reminders: Array<{
      type: 'email' | 'notification' | 'sms';
      minutes: number;
    }>;
    tags: string[];
    maxCapacity?: number;
    requiresGeolocation: boolean;
    geofenceRadius?: number;
    thumbnailId?: string;
  }

  const updateEvent = async (
    accessToken: string,
    eventId: string,
    event: UpdateEventRequest
  ): Promise<Event> => {
    try {
      const response = await axios.put(
        `https://api.tktchurch.com/v1/events/${eventId}`,
        event,
        {
          headers: {
            'Authorization': `Bearer ${accessToken}`,
            'Content-Type': 'application/json'
          },
        }
      );
      return response.data;
    } catch (error) {
      if (axios.isAxiosError(error)) {
        throw new Error(error.response?.data?.error?.reason || 'Failed to update event');
      }
      throw error;
    }
  };

  // Usage
  try {
    const event = await updateEvent(
      accessToken,
      '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',
        recurrence: {
          frequency: 'weekly',
          interval: 1,
          byDay: ['SU']
        },
        reminders: [
          {
            type: 'email',
            minutes: 1440
          },
          {
            type: 'notification',
            minutes: 60
          }
        ],
        tags: ['worship', 'sunday-service'],
        maxCapacity: 500,
        requiresGeolocation: true,
        geofenceRadius: 100
      }
    );
    console.log('Updated event:', event);
  } catch (error) {
    console.error('Error:', error);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "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"
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "status": 400,
      "reason": "Invalid ISO8601 format for startDate"
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "error": {
      "status": 401,
      "reason": "Invalid or expired access token"
    }
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "error": {
      "status": 403,
      "reason": "Missing required permission: updateEvent"
    }
  }
  ```

  ```json 404 Not Found theme={null}
  {
    "error": {
      "status": 404,
      "reason": "Event not found"
    }
  }
  ```
</ResponseExample>
