コストセンターを更新する
エンドポイント
PUT https://api.verifik.co/v2/cost-centers/{id}
コストセンターを 1 件更新します。変えるフィールドだけを送ります。すでに記録されたリクエストは、当時のコストセンターのままです。
ヘッダー
| 名前 | 値 |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
パスパラメータ
id
型: string
必須: はい
コストセンターの id です。
ボディパラメータ
name
型: string
必須: いいえ
表示名。120 文字まで。
code
型: string
必須: いいえ
新しいヘッダー値。文字、数字、.、-、_。60 文字まで。アカウントごとに一意。
country
型: string
必須: いいえ
ISO-2 の国コード。
active
型: boolean
必須: いいえ
true で再び有効にします。false で新しいリクエストに割り当てないようにします。
リクエスト例
- cURL
- Node.js
- Python
curl -X PUT "https://api.verifik.co/v2/cost-centers/6acfbdda92451bac5d0a7ebe" \
-H "Authorization: Bearer $VERIFIK_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"スペイン運用","active":true}'
const axios = require("axios");
const config = {
method: "put",
url: "https://api.verifik.co/v2/cost-centers/6acfbdda92451bac5d0a7ebe",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
data: {
name: "スペイン運用",
active: true
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
import os
import requests
response = requests.put(
"https://api.verifik.co/v2/cost-centers/6acfbdda92451bac5d0a7ebe",
headers={
"Authorization": f"Bearer {os.environ['VERIFIK_TOKEN']}",
"Content-Type": "application/json",
},
json={"name": "スペイン運用", "active": True},
)
print(response.json())
レスポンス例
- 200 OK
{
"data": {
"_id": "6acfbdda92451bac5d0a7ebe",
"client": "69c2b824295cd7d276e478ad",
"name": "スペイン運用",
"code": "SPAIN-OPS",
"country": "ES",
"active": true,
"createdAt": "2026-10-14T17:37:30.469Z",
"updatedAt": "2026-10-14T18:02:11.120Z"
}
}
data は更新後のコストセンターオブジェクトです。
エラーレスポンス
不明な id:
{
"message": "cost_center_not_found",
"code": "NotFound"
}
アカウントの別のセンターがすでに使っている code:
{
"message": "cost_center_code_taken",
"code": "Conflict"
}