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

# 빠른 시작

> ID 또는 생성자를 기준으로 Space 상세 정보를 조회합니다

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

이 가이드는 Spaces 조회 엔드포인트를 사용해 Space 정보를 조회하는 방법을 설명합니다.

<Note>
  **사전 준비 사항**

  시작하기 전에 다음이 필요합니다.

  * 승인이 완료된 App이 연결된 [개발자 계정](https://developer.x.com/en/portal/petition/essential/basic-info)
  * App의 Bearer 토큰
</Note>

***

<div id="get-a-space-by-id">
  ## ID로 Space 조회하기
</div>

특정 Space의 상세 정보를 조회합니다:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/spaces/1DXxyRYNejbKM?\
  space.fields=title,host_ids,participant_count,scheduled_start,state,created_at" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # ID로 Space 조회하기
  response = client.spaces.get(
      "1DXxyRYNejbKM",
      space_fields=["title", "host_ids", "participant_count", "scheduled_start", "state", "created_at"]
  )

  print(f"Space: {response.data.title}")
  print(f"State: {response.data.state}")
  print(f"Participants: {response.data.participant_count}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // ID로 Space 조회하기
  const response = await client.spaces.get("1DXxyRYNejbKM", {
    spaceFields: ["title", "host_ids", "participant_count", "scheduled_start", "state", "created_at"],
  });

  console.log(`Space: ${response.data?.title}`);
  console.log(`State: ${response.data?.state}`);
  console.log(`Participants: ${response.data?.participant_count}`);
  ```
</CodeGroup>

<div id="response">
  ### 응답
</div>

```json theme={null}
{
  "data": {
    "id": "1DXxyRYNejbKM",
    "state": "live",
    "title": "Discussing AI and the Future",
    "host_ids": ["2244994945"],
    "participant_count": 245,
    "created_at": "2024-01-15T09:00:00.000Z"
  }
}
```

***

<div id="get-multiple-spaces">
  ## 여러 Space 조회하기
</div>

여러 Space를 한 번에 조회하려면:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/spaces?\
  ids=1DXxyRYNejbKM,1YqJDqWYNQDGW&\
  space.fields=title,state,participant_count" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # 여러 Space 조회하기
  response = client.spaces.get_spaces(
      ids=["1DXxyRYNejbKM", "1YqJDqWYNQDGW"],
      space_fields=["title", "state", "participant_count"]
  )

  for space in response.data:
      print(f"{space.title} - {space.state}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // 여러 Space 조회하기
  const response = await client.spaces.getSpaces({
    ids: ["1DXxyRYNejbKM", "1YqJDqWYNQDGW"],
    spaceFields: ["title", "state", "participant_count"],
  });

  response.data?.forEach((space) => {
    console.log(`${space.title} - ${space.state}`);
  });
  ```
</CodeGroup>

***

<div id="get-spaces-by-creator">
  ## 생성자 기준으로 Spaces 조회
</div>

특정 사용자가 호스팅한 Spaces를 조회합니다:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/spaces/by/creator_ids?\
  user_ids=2244994945,783214&\
  space.fields=title,state,scheduled_start" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # 생성자 기준으로 Spaces 조회
  response = client.spaces.get_by_creator_ids(
      user_ids=["2244994945", "783214"],
      space_fields=["title", "state", "scheduled_start"]
  )

  for space in response.data:
      print(f"{space.title} - {space.state}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // 생성자 기준으로 Spaces 조회
  const response = await client.spaces.getByCreatorIds({
    userIds: ["2244994945", "783214"],
    spaceFields: ["title", "state", "scheduled_start"],
  });

  response.data?.forEach((space) => {
    console.log(`${space.title} - ${space.state}`);
  });
  ```
</CodeGroup>

***

<div id="include-host-information">
  ## 호스트 정보 포함하기
</div>

호스트 사용자 데이터를 확장해 포함합니다:

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl "https://api.x.com/2/spaces/1DXxyRYNejbKM?\
  space.fields=title,host_ids,state&\
  expansions=host_ids&\
  user.fields=username,verified" \
    -H "Authorization: Bearer $BEARER_TOKEN"
  ```

  ```python Python SDK theme={null}
  from xdk import Client

  client = Client(bearer_token="YOUR_BEARER_TOKEN")

  # 호스트 정보가 포함된 Space 가져오기
  response = client.spaces.get(
      "1DXxyRYNejbKM",
      space_fields=["title", "host_ids", "state"],
      expansions=["host_ids"],
      user_fields=["username", "verified"]
  )

  print(f"Space: {response.data.title}")
  # 호스트 정보는 response.includes.users에 있습니다
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client } from "@xdevplatform/xdk";

  const client = new Client({ bearerToken: "YOUR_BEARER_TOKEN" });

  // 호스트 정보가 포함된 Space 가져오기
  const response = await client.spaces.get("1DXxyRYNejbKM", {
    spaceFields: ["title", "host_ids", "state"],
    expansions: ["host_ids"],
    userFields: ["username", "verified"],
  });

  console.log(`Space: ${response.data?.title}`);
  // 호스트 정보는 response.includes?.users에 있습니다
  ```
</CodeGroup>

<div id="response-with-expansion">
  ### 확장 필드가 포함된 응답
</div>

```json theme={null}
{
  "data": {
    "id": "1DXxyRYNejbKM",
    "state": "live",
    "title": "Discussing AI and the Future",
    "host_ids": ["2244994945"]
  },
  "includes": {
    "users": [
      {
        "id": "2244994945",
        "username": "XDevelopers",
        "verified": true
      }
    ]
  }
}
```

***

<div id="space-states">
  ## Space 상태
</div>

| State       | Description |
| :---------- | :---------- |
| `live`      | 현재 진행 중     |
| `scheduled` | 예약됨         |
| `ended`     | 종료됨         |

***

<div id="available-fields">
  ## 사용 가능한 필드
</div>

| Field               | Description         |
| :------------------ | :------------------ |
| `title`             | Space의 제목           |
| `host_ids`          | 호스트 사용자 ID          |
| `speaker_ids`       | 스피커 사용자 ID          |
| `participant_count` | 현재 참여자 수            |
| `scheduled_start`   | 예정된 시작 시간           |
| `started_at`        | 실제 시작 시간            |
| `ended_at`          | 종료 시간               |
| `is_ticketed`       | 티켓이 제공되는 Space인지 여부 |
| `state`             | 현재 상태               |

***

<div id="next-steps">
  ## 다음 단계
</div>

<CardGroup cols={2}>
  <Card title="Spaces 검색" icon="magnifying-glass" href="/ko/x-api/spaces/search/quickstart">
    키워드로 Spaces 찾기
  </Card>

  <Card title="API 참조 문서" icon="code" href="/ko/x-api/spaces/space-lookup-by-space-id">
    전체 엔드포인트 문서 보기
  </Card>
</CardGroup>
