Cost centers

Bulk update cost centers

Updates a list of cost centers in a single request. You can archive or unarchive them and/or set their cost object type (type) when that feature is enabled for your organization. Returns the number of cost centers updated. When cost object types are enabled, provide at least one of archive or a non-null type. When the feature is not enabled, archive remains required.

patch/cost_centers/bulk_update

Request

  • Base URL
    https://api.perk.com
  • URL
    https://api.perk.com/cost_centers/bulk_update
  • Auth
    none declared. Required headers: Authorization

Headers

Authorizationstring required

Your Perk API key

Request body

archiveboolean

Set to 'true' to archive the cost centers, or 'false' to unarchive them. Omit to leave archive state unchanged. Required when cost object types are not enabled for your organization.

id_listinteger[] required

The IDs of the cost centers to update

typestring nullable

Cost object type name to set on all cost centers in id_list. Available only when cost object types are enabled for your organization on request. Non-empty string (max 256 characters). If a type with that name already exists (case-insensitive), it is assigned; otherwise it is created. Omit or null leaves types unchanged. When the feature is enabled, provide at least one of archive or a non-null type. If any listed cost center is Yokoy-sourced and type is set, the request fails with 400 (all-or-nothing).

Example request

{
  "archive": true,
  "id_list": [
    1,
    2,
    3
  ],
  "type": "Department"
}

Response

Returns '200 OK' and the number of cost centers updated.

updated_countinteger

The number of cost centers successfully updated

Example response

{
  "updated_count": 3
}

Changes

No recorded changes to this operation across all 1 revision of this API.