---
title: "Update Craft Function"
method: POST
path: "/v2beta/craft/function/update"
tags: ["Craft Function"]
---

# Update Craft Function

`POST /v2beta/craft/function/update`

## Request

- Base URL: `https://api.karte.io`
- URL: `https://api.karte.io/v2beta/craft/function/update`
- Auth: HTTP bearer

Craft function更新のリクエストを送信します。

#### Required Scope
APIの実行に必要なScopeです。
```
beta.craft.function.update
```

#### Required Role
管理画面でScopeを追加する際に必要な権限です。
```
Craft > Craft 設定の編集
```

## Headers

- `x-karte-api` string
- `authorization` string
- `content-type` string

## Request body

- object
  - `id` string, required: ファンクションIDです。管理画面のURLに含まれるIDです。
  - `description` string, required: ファンクションの説明
  - `code` string, required: ファンクションのJavascriptコード
  - `variables` object[], required: ファンクションの変数
    - `name` string
    - `description` string
    - `type` 'string' | 'number' | 'boolean'
    - `required` boolean
    - `value` union
      - string
      - number
      - boolean
  - `packages` object, required: ファンクションのモジュール
  - `active` boolean: ファンクションの有効・無効
  - `kickHookV2` boolean: この操作でHook V2のトリガーを発火するかどうか。（[参照](https://developers.karte.io/reference/hook-v2-karte-craft-channel)）
  - `refreshDependencies` boolean: デプロイ時にパッケージ依存関係を更新するかどうか。モジュール（packages）に変更がある場合はこの値に関わらずパッケージ依存関係が自動的に再解決されます。
  - `minReleaseAge` number: パッケージ最小公開日数（日数）。デフォルトは5日。npm公開から指定日数未満のパッケージバージョンをインストール対象から除外します。最近公開されたバージョンを使用する場合は0を指定してください。
  - `skipRecreateIfFailed` boolean: FAILED状態のHTTPファンクションを更新する際、ファンクションを再作成せずに更新するかどうか。 trueの場合、既存のファンクションを削除せずに更新を試みます。HTTPファンクション以外では指定できません。 未指定またはfalseの場合、FAILED時は従来どおり再作成します。 詳細: https://craft.developers.karte.io/craft-functions/edit-craft-funcitons/#デプロイに失敗した場合

## Response `200`

A successful response.

- ClientConfig
  - `id` string, required
  - `name` string, required
  - `codeVersion` string, required: 現在のコードバージョン
  - `active` boolean, required: ファンクションの有効状態
  - `description` string, nullable
  - `created` string, required: ファンクションの作成日時
  - `modified` string, required: ファンクションの更新日時
  - `status` 'SUCCESS' | 'IN_PROGRESS' | 'FAILED', required: ファンクションの最新のデプロイ結果
  - `modified_by` object
    - `account_id` string
    - `username` string

---

[API](https://skmtc.dev/karte/apis/craft.md) - [All operations](https://skmtc.dev/karte/apis/craft/llms.txt) - [OpenAPI document](https://skmtc.dev/karte/apis/craft/revisions/ef1e7fea616a?raw)
