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

# Get Livestream

> Get details of a specific livestream

### Path Parameters

<ParamField path="id" type="string" required>
  The UUID of the livestream to retrieve
</ParamField>

### Response

<ResponseField name="id" type="string">
  Livestream's unique identifier (UUID)
</ResponseField>

<ResponseField name="title" type="string">
  Title of the livestream
</ResponseField>

<ResponseField name="description" type="string">
  Description of the livestream
</ResponseField>

<ResponseField name="youtubeUrl" type="string" required={false}>
  YouTube URL for the livestream
</ResponseField>

<ResponseField name="customStreamUrl" type="string" required={false}>
  Custom streaming URL
</ResponseField>

<ResponseField name="status" type="string">
  Current status of the livestream. One of:

  * `scheduled`: Upcoming livestream
  * `live`: Currently streaming
  * `ended`: Completed livestream
  * `cancelled`: Cancelled livestream
</ResponseField>

<ResponseField name="scheduledStartTime" type="string" required={false}>
  Scheduled start time in ISO 8601 format
</ResponseField>

<ResponseField name="actualStartTime" type="string" required={false}>
  Actual start time in ISO 8601 format
</ResponseField>

<ResponseField name="endTime" type="string" required={false}>
  End time in ISO 8601 format
</ResponseField>

<ResponseField name="tags" type="array">
  Array of tags associated with the livestream
</ResponseField>

<ResponseField name="thumbnailUrl" type="string" required={false}>
  URL of the livestream thumbnail
</ResponseField>

<ResponseField name="thumbnail" type="object" required={false}>
  Thumbnail file information

  <Expandable title="Thumbnail Object">
    <ResponseField name="id" type="string">
      File's unique identifier (UUID)
    </ResponseField>

    <ResponseField name="url" type="string">
      URL to access the file
    </ResponseField>

    <ResponseField name="provider" type="string">
      Storage provider (s3 or local)
    </ResponseField>

    <ResponseField name="key" type="string">
      Storage key/path of the file
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="createdByUserId" type="string">
  UUID of the user who created the livestream
</ResponseField>

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

<ResponseField name="createdAt" type="string">
  Creation timestamp in ISO 8601 format
</ResponseField>

<ResponseField name="updatedAt" type="string">
  Last update timestamp in ISO 8601 format
</ResponseField>

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

  * 404 Not Found: Livestream not found
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.tktchurch.com/v1/livestreams/123e4567-e89b-12d3-a456-426614174000"
  ```

  ```javascript JavaScript theme={null}
  const getLivestream = async (id) => {
    const response = await fetch(
      `https://api.tktchurch.com/v1/livestreams/${id}`
    );

    if (!response.ok) {
      const error = await response.json();
      throw new Error(error.reason || 'Failed to get livestream');
    }

    return response.json();
  };

  // Usage
  try {
    const livestream = await getLivestream('123e4567-e89b-12d3-a456-426614174000');
    console.log('Livestream:', livestream);
  } catch (error) {
    console.error('Error:', error.message);
  }
  ```

  ```swift Swift theme={null}
  struct Livestream: Codable {
      let id: UUID
      let title: String
      let description: String
      let youtubeUrl: String?
      let customStreamUrl: String?
      let status: String
      let scheduledStartTime: Date?
      let actualStartTime: Date?
      let endTime: Date?
      let tags: [String]
      let thumbnailUrl: String?
      let thumbnail: ThumbnailInfo?
      let createdByUserId: UUID
      let updatedByUserId: UUID
      let createdAt: Date?
      let updatedAt: Date?
      
      struct ThumbnailInfo: Codable {
          let id: UUID?
          let url: String
          let provider: String
          let key: String
      }
  }

  func getLivestream(id: UUID) async throws -> Livestream {
      let url = URL(string: "https://api.tktchurch.com/v1/livestreams/\(id)")!
      let (data, response) = try await URLSession.shared.data(from: url)
      
      guard let httpResponse = response as? HTTPURLResponse else {
          throw URLError(.badServerResponse)
      }
      
      if httpResponse.statusCode == 404 {
          throw URLError(.resourceNotFound)
      }
      
      if httpResponse.statusCode != 200 {
          throw URLError(.badServerResponse)
      }
      
      return try JSONDecoder().decode(Livestream.self, from: data)
  }

  // Usage
  do {
      let livestream = try await getLivestream(
          id: UUID(uuidString: "123e4567-e89b-12d3-a456-426614174000")!
      )
      print("Livestream:", livestream)
  } catch {
      print("Error:", error)
  }
  ```

  ```kotlin Kotlin theme={null}
  data class Livestream(
      val id: UUID,
      val title: String,
      val description: String,
      val youtubeUrl: String?,
      val customStreamUrl: String?,
      val status: String,
      val scheduledStartTime: String?,
      val actualStartTime: String?,
      val endTime: String?,
      val tags: List<String>,
      val thumbnailUrl: String?,
      val thumbnail: ThumbnailInfo?,
      val createdByUserId: UUID,
      val updatedByUserId: UUID,
      val createdAt: String?,
      val updatedAt: String?
  ) {
      data class ThumbnailInfo(
          val id: UUID?,
          val url: String,
          val provider: String,
          val key: String
      )
  }

  suspend fun getLivestream(id: UUID): Livestream {
      val request = Request.Builder()
          .url("https://api.tktchurch.com/v1/livestreams/$id")
          .get()
          .build()

      return withContext(Dispatchers.IO) {
          client.newCall(request).execute().use { response ->
              if (!response.isSuccessful) {
                  throw when (response.code) {
                      404 -> NoSuchElementException("Livestream not found")
                      else -> IOException("Unexpected response ${response.code}")
                  }
              }
              
              val body = response.body?.string() ?: throw IOException("Empty response")
              Json.decodeFromString<Livestream>(body)
          }
      }
  }

  // Usage
  try {
      val livestream = getLivestream(UUID.fromString("123e4567-e89b-12d3-a456-426614174000"))
      println("Livestream: $livestream")
  } catch (e: Exception) {
      println("Error: ${e.message}")
  }
  ```

  ```typescript React Native theme={null}
  interface Thumbnail {
    id?: string;
    url: string;
    provider: 's3' | 'local';
    key: string;
  }

  interface Livestream {
    id: string;
    title: string;
    description: string;
    youtubeUrl?: string;
    customStreamUrl?: string;
    status: 'scheduled' | 'live' | 'ended' | 'cancelled';
    scheduledStartTime?: string;
    actualStartTime?: string;
    endTime?: string;
    tags: string[];
    thumbnailUrl?: string;
    thumbnail?: Thumbnail;
    createdByUserId: string;
    updatedByUserId: string;
    createdAt?: string;
    updatedAt?: string;
  }

  const getLivestream = async (id: string): Promise<Livestream> => {
    try {
      const response = await axios.get<Livestream>(
        `https://api.tktchurch.com/v1/livestreams/${id}`
      );
      return response.data;
    } catch (error) {
      if (axios.isAxiosError(error)) {
        if (error.response?.status === 404) {
          throw new Error('Livestream not found');
        }
        throw new Error(error.response?.data?.reason || 'Failed to get livestream');
      }
      throw error;
    }
  };

  // Usage
  try {
    const livestream = await getLivestream('123e4567-e89b-12d3-a456-426614174000');
    console.log('Livestream:', livestream);
  } catch (error) {
    console.error('Error:', error.message);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "title": "Sunday Service",
    "description": "Join us for our weekly Sunday service",
    "youtubeUrl": "https://youtube.com/watch?v=abc123",
    "customStreamUrl": null,
    "status": "live",
    "scheduledStartTime": "2024-01-21T10:00:00Z",
    "actualStartTime": "2024-01-21T10:02:00Z",
    "endTime": null,
    "tags": ["sunday-service", "worship"],
    "thumbnailUrl": "https://example.com/thumbnail.jpg",
    "thumbnail": {
      "id": "123e4567-e89b-12d3-a456-426614174001",
      "url": "https://storage.example.com/thumbnails/abc123.jpg",
      "provider": "s3",
      "key": "thumbnails/abc123.jpg"
    },
    "createdByUserId": "123e4567-e89b-12d3-a456-426614174002",
    "updatedByUserId": "123e4567-e89b-12d3-a456-426614174002",
    "createdAt": "2024-01-20T15:00:00Z",
    "updatedAt": "2024-01-21T10:02:00Z"
  }
  ```

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