# Swaggerをはじめる

APIキーの設定

API Swaggerを使い始める前に、まずNMKR StudioでAuthentication TokenまたはAPIキーを作成する必要があります。使用するネットワークに応じて、[testnet](https://studio.preprod.nmkr.io/login/)アカウントか[mainnet](https://studio.nmkr.io/login/)アカウントのどちらかで[API Keyを作成](https://docs.nmkr.io/nmkr-studio/account/api-keys)する必要があります。

#### グローバルページ認証

試す前の最初のアクションは、グローバルページの認証パネルにAPIキーを追加することです。これを行わないと、Swagger UIの使用時に必ず401エラーが発生します。

これを行うには、ページの右上に移動し、\[Authorize]ボタンを選択します。するとポップアップが表示されるので、前述の[APIキーを](https://docs.nmkr.io/nmkr-studio/account/api-keys#manage-your-api-keys)コピーして貼り付けます。

<figure><img src="/files/yoqcKw1tuDeCKUokvFA7" alt=""><figcaption></figcaption></figure>

#### ワークフロー例 - お試しください！

**1) エンドポイントの選択**

エンドポイントをクリックすると詳細が表示され、エンドポイントをテストできます。

<figure><img src="/files/cSgysF0VcbKCwW21muUn" alt=""><figcaption></figcaption></figure>

**2) パネルを起動する**

「Try it out 」をクリックしてパネルを起動します。

<figure><img src="/files/ik2cYKh0tTWiK0ROG6T3" alt=""><figcaption></figcaption></figure>

**3) 要求された詳細を追加する**

認証が要求された場合は、[グローバル認証として](https://docs.nmkr.io/nmkr-studio-api/api-swagger/get-started-with-the-swagger#global-page-authentication)指定したものと同じであることを確認し、「Execute」をクリックしてください。

<figure><img src="/files/fTybOVPmstJwnQ1t7l7A" alt=""><figcaption></figcaption></figure>

**4) 回答**

NMKR Studio API は、a) Curl と b) リクエスト URL で応答します。

<figure><img src="/files/dIdqwuObNdHyzldMCKU6" alt=""><figcaption></figcaption></figure>

また、いくつかのコードで応答します。[Swaggerの応答とエラーコードを](https://docs.nmkr.io/nmkr-studio-api/api-swagger/swagger-responses-and-error-codes)読んで、その意味を理解してください。

以下は、コールが無効であることを示す応答です。

A) invalid; 理由: 「Wallet address already exists（ウォレットアドレスはすでに存在します）」。

<figure><img src="/files/fO7SZtNLdujPU4PEdrbQ" alt=""><figcaption></figcaption></figure>

B) 有効であり、実行されました。

<figure><img src="/files/DTRZKBakRCocvwzR9A6J" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
ペイロードにメタデータをアップロードする場合は、メタデータをエスケープする必要があることに留意してください。

[オンラインJSONエスケープ/Unescapeツールhttps://www.freeformatter.com/json-escape.html#before-output](https://www.freeformatter.com/json-escape.html#before-output)
{% endhint %}


---

# 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://docs.nmkr.io/jp/nmkr-studio-api/api-swagger/swaggerwohajimeru.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.
