VTEX B2B GraphQL icon

VTEX B2B GraphQL

Interact with VTEX B2B Organizations GraphQL API

Actions15

Cost Center → Update

AI-generated

Summary

Update a cost center using a GraphQL mutation

Inputs

  • costCenterId (required) — The ID of the cost center to update
  • customQuery — Custom GraphQL mutation to execute; leave empty to use the default template
  • variables — JSON object of variables to pass to the mutation

Output shape

a single record representing the updated cost center (the GraphQL response data)

The operation sends a mutation; the returned data is whatever the mutation returns (typically the updated cost center fields). Errors are raised if the mutation fails.

Examples

Example 1: Update the name of a cost center

costCenterId: "CC123", customQuery: "mutation { updateCostCenter(id: $id, input: { name: $name }) { id name } }", variables: {"id":"CC123","name":"New Marketing"}

Example 2: Change the address type of a cost center

costCenterId: "CC123", customQuery: "mutation { updateCostCenter(id: $id, input: { addressIds: [$addressId] }) { id } }", variables: {"id":"CC123","addressId":"addr456"}

Example 3: Update without a custom query (use default template)

costCenterId: "CC123", variables: {}

Discussion