# 지하철 특정 호선 역 간 거리 및 소요 시간 조회

{% hint style="info" %}
캐릭터 인코딩은 UTF-8 을 기본으로 합니다.
{% endhint %}

{% hint style="info" %}
secret key는 ‘서비스콘솔’ – ‘Sub Account’ 생성 시 키를 발급 받을 수 있습니다.
{% endhint %}

<table data-header-hidden data-full-width="true"><thead><tr><th></th><th width="363"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>상세기능 번호</strong></td><td>1</td><td><strong>상세기능 유형</strong></td><td>조회 (자료)</td></tr><tr><td><strong>상세기능명(국문)</strong></td><td>서울교통공사 지하철정보</td><td></td><td></td></tr><tr><td><strong>상세기능 설명</strong></td><td>특정호선-역간거리 및 소요시간 정보를 반환한다.</td><td></td><td></td></tr><tr><td><strong>Call Back URL</strong></td><td>https://i48ojxo10p.apigw.ntruss.com/public-station/v1/dstnc/line-{line_num}</td><td><strong>line_num</strong></td><td>1~8</td></tr><tr><td><strong>평균 응답 시간</strong></td><td>500 ms</td><td><strong>초당 최대 트랙잭션</strong></td><td>30 tps</td></tr></tbody></table>

## Path variable

{% hint style="warning" %}
Path variable(각 URI 내 중괄호({}) 로 묶인 경로 변수)는 아래 내용을 참고하여 호출 시 누락되지 않도록 해주세요.
{% endhint %}

<table><thead><tr><th width="241">name</th><th>desc</th><th>value</th></tr></thead><tbody><tr><td>line_num</td><td>지하철 호선 번호</td><td>1~8</td></tr></tbody></table>

## 지하철 특정 호선 역 간 거리 및 소요 시간 조회 API

<mark style="color:blue;">`GET`</mark> `https://4vh6qtie3c.apigw.ntruss.com/public-station/v1/dstnc/line-{line_num}`

#### Headers

| Name                                            | Type   | Description          |
| ----------------------------------------------- | ------ | -------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | **사용자ID;secret key** |

{% tabs %}
{% tab title="200: OK 응답 반환 완료" %}

{% endtab %}
{% endtabs %}

## Response Body

<table><thead><tr><th width="119.33333333333331">No</th><th width="242">출력명</th><th>출력설명</th></tr></thead><tbody><tr><td>공통</td><td>list_total_count</td><td>총 데이터 건수 (정상조회 시 출력됨)</td></tr><tr><td>공통</td><td>RESULT.CODE</td><td>요청결과 코드 (하단 메세지설명 참고)</td></tr><tr><td>공통</td><td>RESULT.MESSAGE</td><td>요청결과 메시지 (하단 메세지설명 참고)</td></tr><tr><td>1</td><td>LINE</td><td>호선</td></tr><tr><td>2</td><td>STATN_NM</td><td>역명</td></tr><tr><td>3</td><td>MNT</td><td>시간(분)</td></tr><tr><td>4</td><td>DSTNC</td><td>거리(km)</td></tr><tr><td>5</td><td>ACMTL</td><td>누계(km)</td></tr></tbody></table>

## 요청 및 응답 예시

{% tabs %}
{% tab title="URI" %}
<https://i48ojxo10p.apigw.ntruss.com/public-station/v1/dstnc/line-1>
{% endtab %}

{% tab title="Response" %}

```json
{
  "StationDstncReqreTimeHm": {
      "list_total_count": 2,
      "row": [
          {
              "ACMTL": 1.1,
              "MNT": "2:00",
              "LINE": "1호선",
              "STATN_NM": "서울역",
              "DSTNC": 1.1
          },
          {
              "ACMTL": 2.1,
              "MNT": "2:00",
              "LINE": "1호선",
              "STATN_NM": "시청",
              "DSTNC": 1
          }
      ],
      "RESULT": {
           "MESSAGE": "정상 처리되었습니다",
           "CODE": "INFO-000"
      }
  }
}
```

{% endtab %}
{% endtabs %}

## CODE 명세

<table><thead><tr><th width="159">CODE</th><th>MESSAGE</th></tr></thead><tbody><tr><td>INFO-000</td><td>정상 처리되었습니다</td></tr><tr><td>ERROR-300</td><td>필수 값이 누락되어 있습니다.<br>요청인자를 참고 하십시오.</td></tr><tr><td>INFO-100</td><td>인증키가 유효하지 않습니다.<br>인증키가 없는 경우, 열린 데이터 광장 홈페이지에서 인증키를 신청하십시오.</td></tr><tr><td>ERROR-301</td><td>파일타입 값이 누락 혹은 유효하지 않습니다.<br>요청인자 중 TYPE을 확인하십시오.</td></tr><tr><td>ERROR-310</td><td>해당하는 서비스를 찾을 수 없습니다.<br>요청인자 중 SERVICE를 확인하십시오.</td></tr><tr><td>ERROR-331</td><td>요청시작위치 값을 확인하십시오.<br>요청인자 중 START_INDEX를 확인하십시오.</td></tr><tr><td>ERROR-332</td><td>요청종료위치 값을 확인하십시오.<br>요청인자 중 END_INDEX를 확인하십시오.</td></tr><tr><td>ERROR-333</td><td>요청위치 값의 타입이 유효하지 않습니다.<br>요청위치 값은 정수를 입력하세요.</td></tr><tr><td>ERROR-334</td><td>요청종료위치 보다 요청시작위치가 더 큽니다.<br>요청시작조회건수는 정수를 입력하세요.</td></tr><tr><td>ERROR-335</td><td>샘플데이터(샘플키:sample) 는 한번에 최대 5건을 넘을 수 없습니다.<br>요청시작위치와 요청종료위치 값은 1 ~ 5 사이만 가능합니다.</td></tr><tr><td>ERROR-336</td><td>데이터요청은 한번에 최대 1000건을 넘을 수 없습니다.<br>요청종료위치에서 요청시작위치를 뺀 값이 1000을 넘지 않도록 수정하세요.</td></tr><tr><td>ERROR-500</td><td>서버 오류입니다.<br>지속적으로 발생시 열린 데이터 광장으로 문의(Q&#x26;A) 바랍니다.</td></tr><tr><td>ERROR-600</td><td>데이터베이스 연결 오류입니다.<br>지속적으로 발생시 열린 데이터 광장으로 문의(Q&#x26;A) 바랍니다.</td></tr><tr><td>ERROR-601</td><td>SQL 문장 오류 입니다.<br>지속적으로 발생시 열린 데이터 광장으로 문의(Q&#x26;A) 바랍니다.</td></tr><tr><td>INFO-200</td><td>해당하는 데이터가 없습니다.</td></tr></tbody></table>


---

# 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://developer.apiplex.net/ko/marketplace/public-api-market/subway-line-dist.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.
