---
agentTools:
  projectIndex: https://docs.link.getmoneytree.com/llms.txt
---

# カテゴリー

カテゴリーを編集

> 📘 必要なOAuthスコープ: `transactions_write`

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "title": "カテゴリー",
    "version": "1.0.0",
    "description": "",
    "contact": {
      "name": "Moneytree Link Support",
      "email": "link-support@moneytree.jp"
    }
  },
  "servers": [
    {
      "url": "https://jp-api-staging.getmoneytree.com",
      "description": "日本の検証環境"
    },
    {
      "url": "https://jp-api.getmoneytree.com",
      "description": "日本の本番環境"
    }
  ],
  "tags": [
    {
      "name": "カテゴリー",
      "description": "カテゴリー"
    }
  ],
  "paths": {
    "/link/categories/${category_id}.json": {
      "parameters": [
        {
          "name": "category_id",
          "in": "path",
          "required": true,
          "description": "カテゴリーのID",
          "schema": {
            "type": "integer",
            "format": "int64"
          },
          "example": 1048
        }
      ],
      "put": {
        "tags": [
          "カテゴリー"
        ],
        "security": [
          {
            "oauth2": [
              "transactions_write"
            ]
          }
        ],
        "operationId": "put-link-category",
        "summary": "カテゴリー",
        "description": "カテゴリーを編集\n\n> 📘 必要なOAuthスコープ: `transactions_write`\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "parent_id"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "カテゴリー名。\n"
                  },
                  "parent_id": {
                    "type": "integer",
                    "format": "int64",
                    "description": "親カテゴリーのID。\n"
                  }
                }
              },
              "examples": {
                "Update the name of a category": {
                  "value": {
                    "name": "Updated category name",
                    "parent_id": 1
                  }
                },
                "Update the name of a category and change its parent category": {
                  "value": {
                    "name": "Updated category name",
                    "parent_id": 2
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Category",
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "format": "int64",
                          "description": "カテゴリーのユニークなID"
                        },
                        "entity_key": {
                          "type": "string",
                          "nullable": true,
                          "description": "`is_system == true`の場合、ユニークなIDになります。\n`is_system == false`のもの（個別カテゴリー）は、idとこの値の組み合わせは、ゲストユーザー毎に異なります。\nまた、検証環境・本番環境でidとこの値の組み合わせが異なることがあるため、ご注意ください。\n"
                        },
                        "category_type": {
                          "type": "string",
                          "description": "カテゴリーの種類。\n入力可能な値は`expense`（支出）, `income`（収入）。\n上記以外、特殊カテゴリで振替と返済、投資（及びその子カテゴリ）は`null`で返されます。\n"
                        },
                        "name": {
                          "type": "string",
                          "description": "カテゴリー名。共通カテゴリー（`is_system == true`）の名前は英語と日本語でご利用頂けます。"
                        },
                        "parent_id": {
                          "type": "integer",
                          "format": "int64",
                          "nullable": true,
                          "description": "親カテゴリーのID。親カテゴリーが存在しない場合は`null`となります。"
                        },
                        "is_system": {
                          "type": "boolean",
                          "description": "`true`の場合、このカテゴリーは全てのゲストが使える共通のカテゴリーです。\n`false`なら、このゲストが追加したカテゴリーになります（ほかのゲストに見られない、見せてはいけないカテゴリー）。\n"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "マネーツリーに登録された時刻。",
                          "example": "2023-06-01T01:03:00+09:00"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "最終更新時刻（マネーツリーやユーザーによる変更等により更新されます）",
                          "example": "2023-06-01T03:15:00+09:00"
                        }
                      },
                      "required": [
                        "created_at",
                        "updated_at"
                      ]
                    }
                  ]
                },
                "examples": {
                  "200": {
                    "value": {
                      "id": 52,
                      "entity_key": "holiday_leisure",
                      "category_type": "expense",
                      "name": "レジャー",
                      "parent_id": null,
                      "is_system": false,
                      "created_at": "2013-01-12T19:08:31+09:00",
                      "updated_at": "2013-06-08T15:47:20+09:00"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "APIに対して行われたリクエストが無効である場合に返されます。\nこれは通常、送信されたデータが検証を通過しなかったことが原因です。\n"
          },
          "401": {
            "description": "有効なアクセストークンを持っていない場合に返されます。"
          },
          "403": {
            "description": "持っているアクセストークンが有効であるものの、本APIで必要とされるスコープが付与されていない時に返却されます。"
          },
          "404": {
            "description": "要求されたエンティティが見つからない場合に返されます。"
          },
          "429": {
            "description": "アプリケーションが多くのリクエストを送信し、レート制限を受けている場合に返されます。\n[APIレート制限は何か、どのように対処するのか？](https://docs.link.getmoneytree.com/docs/faq-rate-limiting)もご覧ください。\n"
          },
          "500": {
            "description": "原因不明の内部サーバーエラーが発生した場合に返されます。"
          },
          "503": {
            "description": "Moneytreeサービスがメンテナンス中の場合に返されます。"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "MT LINK APIは、OAuth 2.0のスコープ機能（アクセスが可能な範囲を制限機能）により、利用者のデータへのアクセスを制限しております。\n",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "/oauth/authorize",
            "tokenUrl": "/oauth/token",
            "scopes": {
              "guest_read": "Moneytreeアカウントの基本情報（メールアドレス、言語、地域）の閲覧",
              "accounts_read": "Moneytreeに登録している銀行口座、クレジットカード、デビットカード、電子マネーの名称、口座の種別、残高の閲覧",
              "transactions_read": "Moneytreeに登録している銀行口座、クレジットカード、デビットカード、電子マネーの明細の閲覧",
              "transactions_write": "Moneytreeに登録している銀行口座、クレジットカード、デビットカード、電子マネーの明細のカテゴリやメモの編集",
              "request_refresh": "Moneytreeに登録している金融サービスの資産情報の取得",
              "investment_accounts_read": "Moneytreeに登録している投資用口座（投資信託、株式、確定拠出年金）の名称、口座の種別、残高の閲覧",
              "investment_transactions_read": "Moneytreeに登録している保有銘柄の明細の閲覧",
              "points_read": "Moneytreeに登録しているポイントの名称、残高、明細の閲覧",
              "life_insurance_read": "Moneytreeに登録している生命保険の契約内容の閲覧"
            }
          },
          "clientCredentials": {
            "tokenUrl": "/oauth/token",
            "scopes": {
              "guest_read": "Moneytreeアカウントの基本情報（メールアドレス、言語、地域）の閲覧",
              "accounts_read": "Moneytreeに登録している銀行口座、クレジットカード、デビットカード、電子マネーの名称、口座の種別、残高の閲覧",
              "transactions_read": "Moneytreeに登録している銀行口座、クレジットカード、デビットカード、電子マネーの明細の閲覧",
              "transactions_write": "Moneytreeに登録している銀行口座、クレジットカード、デビットカード、電子マネーの明細のカテゴリやメモの編集",
              "request_refresh": "Moneytreeに登録している金融サービスの資産情報の取得",
              "investment_accounts_read": "Moneytreeに登録している投資用口座（投資信託、株式、確定拠出年金）の名称、口座の種別、残高の閲覧",
              "investment_transactions_read": "Moneytreeに登録している保有銘柄の明細の閲覧",
              "points_read": "Moneytreeに登録しているポイントの名称、残高、明細の閲覧",
              "life_insurance_read": "Moneytreeに登録している生命保険の契約内容の閲覧"
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 106,
      "1": 152,
      "2": 222,
      "3": 177,
      "4": 149,
      "5": 242,
      "6": 192,
      "7": 24,
      "8": 245,
      "9": 247,
      "10": 161,
      "11": 50
    }
  }
}
```