> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/sdk/domains-api/user/user.createanonymouskeyauthcode.md).

# User.createAnonymousKeyAuthCode

### 기능 설명

익명 사용자 키를 받기 위한 일회용 인증 코드를 발급해요. 미니앱에서 이 API로 코드를 받은 뒤, 파트너사 서버에서 코드를 교환해 `hash`를 받으세요. 코드는 한 번만 쓸 수 있고, `expiresIn`초가 지나면 만료돼요. 코드를 교환해 받은 `hash`는 `User.getAnonymousKey`가 반환하는 `hash`와 같은 값이에요.

앱인토스 SDK 3.6.0 이상에서 사용할 수 있어요.

### 타입

**Params**

없음

**Response**

```ts
type CreateAnonymousKeyAuthCodeResponse = {
  /** 파트너사 서버의 교환 API에 전달할 일회용 코드예요. */
  code: string;
  /** 만료까지 남은 시간(초)이에요. */
  expiresIn: number;
};
```

### 예시 코드

```ts
import { User } from "@apps-in-toss/web-framework";

async function issueAnonymousKey() {
  try {
    const { code, expiresIn } = await User.createAnonymousKeyAuthCode();
    // code를 파트너사 서버로 전달해 hash로 교환해요
    console.log("코드 유효 시간(초):", expiresIn);
  } catch (error) {
    console.error(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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers-apps-in-toss.toss.im/documentation/sdk/domains-api/user/user.createanonymouskeyauthcode.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
