# Live API

**Kollus Live Console API v1**

* 라이브러리, 채널, 컨텐츠 조회,관리, 삭제 등의 API 제공
* <https://kollus-live.readme.io/reference>
* 유의 사항
  * 데이터 검색시 Timezone 기준은 UTC임
  * API의 사용은 최대 분당 60회, 초당 1회를 넘지 않도록 함
  * 조회 API의 경우 캐싱 설정에 의해서 즉시 갱신이 안될수 있음
  * 컨텐츠의 조회의 경우 자체적으로 컨텐츠 관리 DB를 구축하여 콜백을 이용한 데이터 획득을 권장함
  * 인증 방법 : OAuth2 를 이용하여 인증하는것을 추천 하나, OAuth2를 구현하기 여의치 않을경우 Personal Access Token 을 획득하여 사용
  * Personal Access Token의 만료 기간은 발급 이후 1년을 만료로 하며, 서비스 운영을 위해 갱신 조치 해야함
  * Personal Access Token은 최초 발급이후 추가적으로 조회추가 불가능

**Kollus API OAuth2 사용 방법**

1. OAuth 관련 메뉴 위치
   1. &#x20;<https://live-kr.kollus.com> 로그인
   2. 설정->기본정보->서비스계정으로이동
   3. OAuth Clients, Personal Access Tokens 메뉴가 있습니다.
2. Scope\
   Live에서 사용하는 Scope(범위)은 다음과 같습니다.
   1. live:control: 라이브 콘솔 컨트롤
   2. live:statistics: 라이브 통계
3. OAuth Clients를 통한 Authorization Access Token 발행
   1. Create New Client 버튼을 통해서 새로운 Client 생성합니다.
   2. 사용할 이름과 API Callback URL을 설정합니다.
   3. Client ID, Secret, API Callback URL(REDIRECT URI)를 사용하여 Access Token을 발급받습 니다.
   4. Access Token 발급 요청 예

<figure><img src="/files/2up36lGiHDSvUChFkZT8" alt=""><figcaption></figcaption></figure>

1. Authorization Code 발행
   1. 아래의 URL을 브라우저를 통해서 실행합니다. 로그인 과정을 거쳐서 사용자 인증을 받게 됩니다. 사용할 Scope를 구분자 “ “로 하여 지정합니다. SCOPES 예: live:control live:statistics
   2. GET <https://live-kr.kollus.com/oauth/authorize?>\
      response\_type=code\&client\_id={CLIENT\_ID}\&redirect\_uri={REDIRECT\_URI}& scope={SCOPES}\
      Scope에 대한 권한 위임 동의 Authorization 확인 페이지로 입장합니다.
   3. Authorize 버튼을 클릭합니다.
2. Code 응답
   1. Code의 탈취를 막기 위해서 REDIRECT\_URI로 응답이 옵니다. 파라미터로 전달받은 CODE를 사용합니다.
3. Access Token 발행

   1. REDIRECT\_URI에서 token을 요청하는 함수를 작성합니다.

   ```
   {REDIRECT_URI}?code={CODE}

   POST https://live-kr.kollus.com/oauth/token
   Content-Type: application/x-www-form-urlencoded

   grant_type=authorization_code&code={CODE}&client_id={CLIENT_ID}&client_secret={CLIEN
   T_SECRET}&redirect_uri={REDIRECT_URI}

   const params = {
          ‘grant_type’ => ‘authorization_code’,
          ‘client_id’ => ‘{CLIENT_ID}’,
          ‘client_secret’ => ‘{CLIENT_SECRET}’,
          ‘redirect_uri’ => ‘{REDIRECT_URI}’,
          ‘code’ => ‘{CODE}’

   };
   axios.post(‘https://live-kr.kollus.com/oauth/token’, params })
   .then((response) => {});
   token_type = response.data.token_type; //토큰 타입
   expires_in = response.data.expires_in; //유효 기간 만료 기간은 1년, 1년내에 refresh 통해 재발급
   access_token = response.data.access_token; //접근 토큰
   refresh_token = response.data.refresh_token; //재발급시 필요 토큰
   //예시
   {
       "token_type": "Bearer",
       "expires_in": 31622400,
       "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni..."
       “refresh_token”: “def50200f41d7d9cc98c3e19d1da51ec8225e5ebef...”
   }
   ```
4. Refresh Token으로 Access Token 발행
   1. OAuth 관련 메뉴 위치
      1. &#x20;<https://live-kr.kollus.com> 로그인
      2. 설정->기본정보->서비스계정으로이동
      3. OAuth Clients, Personal Access Tokens 메뉴가 있습니다.
   2. Scope\
      Live에서 사용하는 Scope(범위)은 다음과 같습니다.
      1. live:control: 라이브 콘솔 컨트롤
      2. live:statistics: 라이브 통계
   3. OAuth Clients를 통한 Authorization Access Token 발행
      1. Create New Client 버튼을 통해서 새로운 Client 생성합니다.
      2. 사용할 이름과 API Callback URL을 설정합니다.
      3. Client ID, Secret, API Callback URL(REDIRECT URI)를 사용하여 Access Token을 발급받습 니다.
      4. Access Token 발급 요청 예

<figure><img src="/files/M4A8Re9dpafYAQxDfS6J" alt=""><figcaption></figcaption></figure>

1. Authorization Code 발행
   1. 아래의 URL을 브라우저를 통해서 실행합니다. 로그인 과정을 거쳐서 사용자 인증을 받게 됩니다. 사용할 Scope를 구분자 “ “로 하여 지정합니다. SCOPES 예: live:control live:statistics
   2. GET <https://live-kr.kollus.com/oauth/authorize?>\
      response\_type=code\&client\_id={CLIENT\_ID}\&redirect\_uri={REDIRECT\_URI}& scope={SCOPES}\
      Scope에 대한 권한 위임 동의 Authorization 확인 페이지로 입장합니다.
   3. Authorize 버튼을 클릭합니다.
2. Code 응답
   1. Code의 탈취를 막기 위해서 REDIRECT\_URI로 응답이 옵니다. 파라미터로 전달받은 CODE를 사용합니다.
3. Access Token 발행

   1. REDIRECT\_URI에서 token을 요청하는 함수를 작성합니다.

   ```
   {REDIRECT_URI}?code={CODE}

   POST https://live-kr.kollus.com/oauth/token
   Content-Type: application/x-www-form-urlencoded

   grant_type=authorization_code&code={CODE}&client_id={CLIENT_ID}&client_secret={CLIEN
   T_SECRET}&redirect_uri={REDIRECT_URI}

   const params = {
          ‘grant_type’ => ‘authorization_code’,
          ‘client_id’ => ‘{CLIENT_ID}’,
          ‘client_secret’ => ‘{CLIENT_SECRET}’,
          ‘redirect_uri’ => ‘{REDIRECT_URI}’,
          ‘code’ => ‘{CODE}’

   };
   axios.post(‘https://live-kr.kollus.com/oauth/token’, params })
   .then((response) => {});
   token_type = response.data.token_type; //토큰 타입
   expires_in = response.data.expires_in; //유효 기간 만료 기간은 1년, 1년내에 refresh 통해 재발급
   access_token = response.data.access_token; //접근 토큰
   refresh_token = response.data.refresh_token; //재발급시 필요 토큰
   //예시
   {
       "token_type": "Bearer",
       "expires_in": 31622400,
       "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni..."
       “refresh_token”: “def50200f41d7d9cc98c3e19d1da51ec8225e5ebef...”
   }
   ```
4. Refresh Token으로 Access Token 발행

   1. Access 토큰의 유효 기간 종료시 Refresh Token으로 Access Token을 재발행합니다.

   ```
   POST https://live-kr.kollus.com/oauth/token
   Content-Type: application/x-www-form-urlencoded

   grant_type=refresh_code&refresh_token={REFRESH_TOKEN}&client_id={CLIENT_ID}&client_s
   ecret={CLIENT_SECRET}&scope={SCOPES}

   const params = {
          ‘grant_type’ => ‘refresh_token’,
          ‘refresh_token’ => ‘{REFRESH_TOKEN}’,
          ‘client_id’ => ‘{CLIENT_ID}’,
          ‘client_secret’ => ‘{CLIENT_SECRET}’,
          ‘scope’ => ‘{SCOPES}’

   };
   axios.post(‘https://live-kr.kollus.com/oauth/token’, params })
   .then((response) => {});
   token_type = response.data.token_type;
   expires_in = response.data.expires_in;
   access_token = response.data.access_token;
   refresh_token = response.data.refresh_token;
   ```
5. Personal Access Tokens
   1. Scope(\`live:control\`, \`live: statistics\`)를 명시하여 토큰을 생성합니다.
   2. Personal Access Token 메뉴에서만 토큰이 생성되며, 생성 완료 화면에서 생성된 토큰 을 별도 저장하도록 합니다.
   3. 토큰은 재발급되지 않으므로 분실시에는 다시 생성하도록 합니다.
6. API 리스트

   1. <https://kollus-live.readme.io/reference>
   2. Redirect URI를 \`<https://live-kr.kollus.com/api/oauth2-callback\\`> 로 설정한 경우 API 리 스트 URI에서 인증을 받은 후 API 항목들에 대해서 테스트하실 수 있습니다.
   3. API사용예제

   ```
   GET https://live-kr.kollus.com/api/v1/live/service-accounts/test/channels
   Accept: application/json
   Content-Type: application/json
   Authorization: {TOKEN_TYPE} {TOKEN}

   const apiUri = ‘https://live-kr.kollus.com/api/v1/live/test/channels’;
   const headers = {

          ‘Content-type’: ‘application/json’,
          Authorization: ‘Bearer ‘ + token,

   };
   axios.get(apiUri, headers).then((response) => {});
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://catenoid-support.gitbook.io/developer-welcome-kit/live/live-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
