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

> 認証を設定し、マークダウンコンテンツから最初のBox Noteを作成します。

# Box Notes APIの使い方

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

このガイドでは、Box Notes APIを使用して、マークダウンから最初のBox Noteを作成する手順を解説します。この手順が完了すると、1回のAPIコールによって`.boxnote`ファイルがBoxアカウント内に作成されます。

## 前提条件

始める前に、以下のものが準備されていることを確認してください。

* ファイルのアップロード権限を持つBoxアカウント。
* Box開発者コンソールで構成された<Link href="/guides/applications/platform-apps/create">Platformアプリケーション</Link>。
* 認証用の有効なアクセストークン (OAuth 2.0またはJWT)。
* メモが作成されるBox内のターゲットフォルダのID。

<Note>
  Box Notes APIでは、APIバージョン`2026.0`が必要です。すべてのリクエストには、`box-version: 2026.0`ヘッダーを含める必要があります。
</Note>

## 手順1: アクセストークンを生成する

APIコールを認証するには、アクセストークンが必要です。

テスト用に開発者トークンを作成するには:

1. \[**開発者コンソール**] > \[**Platformアプリ**] に移動します。
2. アプリの横の**オプションメニュー**ボタン (\[**…**]) をクリックします。
3. \[**開発者トークンを生成**] を選択します。トークンが自動的にクリップボードにコピーされます。

<Warning>
  開発者トークンは1時間で期限切れとなります。実稼働環境の場合、<Link href="/guides/authentication/oauth2">OAuth 2.0</Link>または<Link href="/guides/authentication/jwt">JWT認証</Link>を実装してください。
</Warning>

## 手順2: ターゲットフォルダを特定する

新しいメモが作成されるフォルダのIDが必要です。フォルダIDを確認するには、以下の操作を行います。

* Boxウェブアプリでそのフォルダを開きます。URL (`https://app.box.com/folder/123456789`) の末尾の数値がフォルダIDです。
* あるいは、<Link href="/reference/get-folders-id">フォルダの取得</Link>APIエンドポイントを使用します。

<Tip>
  フォルダIDとして`0`を使用すると、ルートフォルダ (すべてのファイル) にメモを作成できます。
</Tip>

## 手順3: 最初のBox Noteを作成する

マークダウンコンテンツを指定した`POST`リクエストを`/2.0/notes/convert`エンドポイントに送信します。APIはマークダウンをBox Noteに変換し、指定されたフォルダにアップロードします。

<CodeGroup>
  ```sh cURL theme={null}
  curl -L 'https://api.box.com/2.0/notes/convert' \
       -H 'box-version: 2026.0' \
       -H 'Authorization: Bearer <ACCESS_TOKEN>' \
       -H 'Content-Type: application/json' \
       -d '{
         "content": "# Welcome\n\nThis is my first **Box Note** created using the API.",
         "content_format": "markdown",
         "parent": {
           "id": "123456789"
         },
         "name": "My First Note"
       }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.box.com/2.0/notes/convert"
  headers = {
      "box-version": "2026.0",
      "Authorization": "Bearer <ACCESS_TOKEN>",
      "Content-Type": "application/json",
  }
  payload = {
      "content": "# Welcome\n\nThis is my first **Box Note** created using the API.",
      "content_format": "markdown",
      "parent": {"id": "123456789"},
      "name": "My First Note",
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.status_code, response.json())
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.box.com/2.0/notes/convert", {
    method: "POST",
    headers: {
      "box-version": "2026.0",
      Authorization: "Bearer <ACCESS_TOKEN>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      content:
        "# Welcome\n\nThis is my first **Box Note** created using the API.",
      content_format: "markdown",
      parent: { id: "123456789" },
      name: "My First Note",
    }),
  });

  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

リクエストが成功すると、新しいファイルの情報を含む`201 Created`が返されます。

```json theme={null}
{
  "type": "file",
  "id": "1234567890"
}
```

## 手順4: メモが作成されたことを確認する

返された`id`を使用して、BoxファイルAPIからファイルのメタデータをすべて取得します。

```sh theme={null}
curl -L 'https://api.box.com/2.0/files/1234567890' \
     -H 'Authorization: Bearer <ACCESS_TOKEN>'
```

また、Boxウェブアプリを開いてターゲットフォルダに移動し、`.boxnote`ファイルがあることを確認できます。

## 次の手順

これで最初のBox Noteが作成できました。以下のガイドもご確認ください。

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("Convert Markdown to Box Note"), href: "/guides/box-notes/convert-markdown", badge: "GUIDE" },
{ label: translate("Use cases"), href: "/guides/box-notes/use-cases", badge: "GUIDE" },
{ label: translate("API versioning"), href: "/guides/api-calls/api-versioning-strategy", badge: "GUIDE" }
]}
/>
