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

# Guard API 빠른 시작

> 5분 안에 첫 요청을 보호하세요: API 키를 만들고, 엔드포인트를 호출하고, action을 읽습니다.

Guard API를 사용하면 직접 만든 애플리케이션에 Starfort 가드레일을 내장할 수 있습니다 — 모델로 들어가는 **입력** 경로에서 호출하여(프롬프트를 마스킹하거나 차단) 그리고 나가는 **출력** 경로에서 호출하여(응답을 검사) 사용할 수 있습니다.

## 1. API 키 발급

API 키는 **API 프로젝트** 내의 **Guardian**에 속합니다. 콘솔에서 Guardian을 열고 → **API Keys** → **Add API Key**를 선택한 뒤 키를 복사하세요(키는 한 번만 표시되며 `sf_`로 시작합니다). [API 키 관리](/ko/v1.2/admin/api-keys)를 참고하세요.

엔드포인트와 바로 사용할 수 있는 예제는 Guardian의 **How to use** 탭에 있습니다.

## 2. 요청 보내기

```bash theme={null}
curl -X POST "https://bastion-guardian-api.starfort.io/v1/guard/api" \
  -H "Content-Type: application/json" \
  -H "X-Starfort-Guard-Api-Key: sf_your_key_here" \
  -d '{
    "messages": [
      { "role": "user", "content": "What time does the library open on weekends?" }
    ],
    "processType": "input"
  }'
```

`processType`는 **Guardian이 선언하는** 레이블입니다(일반적으로 들어오는 요청에는 `input`, 나가는 모델 응답에는 `output`을 사용). Guardian이 지원하는 값이어야 합니다 — [요청 형식](/ko/v1.2/api/request-format)을 참고하세요.

## 3. action 읽기

무해한 요청은 그대로 통과합니다:

```json theme={null}
{ "action": "PASS", "input_results": [] }
```

PII가 포함된 내용을 보내면 Guardian이 이를 마스킹합니다(PII 정책이 할당된 경우):

```json theme={null}
{
  "action": "MASK",
  "input_results": [{
    "index": 0, "type": "text", "action": "MASK",
    "processed_content": "My number is [PHONE_NUMBER_1].",
    "results": [ /* … */ ]
  }]
}
```

애플리케이션은 최상위 **`action`** 값에 따라 동작해야 합니다: `MASK`인 경우 `processed_content`를 전달하고, `BLOCK`인 경우 요청을 거부합니다. Topic 정책은 **`CHECK`**(검토가 필요한 논쟁적 주제로 표시됨)를 반환할 수도 있습니다 — API 호출자는 `CHECK`를 그대로 수신합니다. [Actions](/ko/v1.2/concepts/actions-pass-mask-block)를 참고하세요.

Guardian이 **분석할 수 없는** 요청은 HTTP 오류를 반환하며, 탐지 결과가 빈 `PASS`를 반환하지 않습니다 — 따라서 오류가 "아무것도 탐지되지 않음"으로 오인되는 일이 결코 없습니다. [오류 및 상태](/ko/v1.2/api/errors)를 참고하세요.

<Steps>
  <Step title="키 생성">콘솔에서 Guardian → API Keys 메뉴 아래에서 생성합니다.</Step>
  <Step title="엔드포인트 호출">`X-Starfort-Guard-Api-Key` 헤더와 함께 `POST /v1/guard/api`를 호출합니다.</Step>
  <Step title="action 처리">PASS → 계속 · MASK → `processed_content` 사용 · BLOCK → 중단.</Step>
</Steps>

## 다음 단계

<CardGroup cols={2}>
  <Card title="인증" icon="key" href="/ko/v1.2/api/authentication" />

  <Card title="요청 형식" icon="arrow-right-to-bracket" href="/ko/v1.2/api/request-format" />

  <Card title="응답 형식" icon="arrow-right-from-bracket" href="/ko/v1.2/api/response-format" />

  <Card title="오류 및 상태" icon="triangle-exclamation" href="/ko/v1.2/api/errors" />
</CardGroup>
