> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/development-guide/hackle-proxy/hackle-proxy-api.md).

# Hackle Proxy API

이 문서는 Hackle Proxy를 호출하기 위한 API를 제공하고 설명합니다.

> 📘 사전 준비 사항
>
> Hackle Proxy 설치 후 사용할 수 있습니다.

## Common Headers

Hackle Proxy서버를 호출하기 위해서는 Header 값에 SDK Key를 필수로 넣어야 합니다. SDK Key가 없거나, 서버 구동 시 등록한 SDK\_KEYS 의 키가 다른 경우 에러가 발생합니다.

```
X-HACKLE-SDK-KEY: {YOUR_SDK_KEY}
```

## API

## 1. Variation

Variation Api는 사용자에게 노출할 Variation을 결정해 줍니다.

```
POST /api/v1/variation
```

### 1.1 Request

```json
{
  "experimentKey" : number,
  "userId" : string
}
```

### 1.2 Response

Response status code : **200**

**Body**

```json
{
  "variation" : string // A, B, C, D, E, F, G, H, I, J
}
```

에러 발생 시, 아래 response code로 api 문제를 확인할 수 있습니다.

* 400 : Bad Request - Request의 내용이 없거나, 형식이 맞지 않을 때 발생합니다.
* 401 : Unauthorized - Header에 SDK\_KEY가 없거나, 맞지 않을 때 발생합니다.
* 500 : Internal Server Error

## 2. Track

Track Api 는 사용자의 이벤트를 추적하기 위해 사용합니다.

```
POST /api/v1/track
```

### 2.1 Request

```json
{
  "eventKey" : string,
  "userId" : string,
  "value" : number // Optional (default=0.0)
}
```

### 2.2 Response

Response status code : **202**\
에러 발생 시, 아래 response code로 api 문제를 확인할 수 있습니다.

* 400 : Bad Request - Request의 내용이 없거나, 형식이 맞지 않을 때 발생합니다.
* 401 : Unauthorized - Header에 SDK\_KEY가 없거나, 맞지 않을 때 발생합니다.
* 500 : Internal Server Error


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.hackle.io/development-guide/hackle-proxy/hackle-proxy-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
