Cost centers

Set users to a cost center

Replaces all users assigned to the cost center with the provided list. Any users not in the list are removed from the cost center

put/cost_centers/{id}/users

Request

  • Base URL
    https://api.perk.com
  • URL
    https://api.perk.com/cost_centers/{id}/users
  • Auth
    none declared. Required headers: Authorization

Path parameters

idstring required

The unique ID of the cost center

Headers

Authorizationstring required

Your Perk API key

Request body

user_idsinteger[]

The IDs of the users to assign to the cost center

Example request

{
  "user_ids": [
    42,
    43,
    44
  ]
}

Response

Returns '200 OK' and the updated cost center resource with the new user list

idstring

The unique ID of the cost center

namestring

The name of the cost center

typestring nullable

Cost object type name, or null if unset. Available only when cost object types are enabled for your organization on request. Omitted from the response when the feature is not enabled.

archivedboolean

Indicates whether the cost center is archived

approver_idinteger

The ID of the approver user, or 'null' if not set

approverobject

Approver user details, or 'null' if not set

delegate_idinteger

The ID of the delegate user, or 'null' if not set

delegateobject

Delegate user details, or 'null' if not set

delegate_expirystring

The expiry date for the delegate in YYYY-MM-DD format, or 'null' if not set

all_companiesboolean

If 'true', the cost center applies to all companies in the account

companiesinteger[]

The IDs of companies assigned to this cost center

count_usersinteger

The number of users assigned to this cost center

erp_codestring

Identifier used to associate this cost center with a corresponding record in an external ERP system

owner_idsinteger[]

IDs of additional travel approvers

Example response

{
  "id": "1",
  "name": "Marketing",
  "type": "Department",
  "all_companies": true,
  "companies": [
    1,
    2
  ],
  "users": [
    {
      "id": 42,
      "first_name": "Alex",
      "last_name": "Chen",
      "email": "alex.chen@company.com"
    }
  ],
  "count_users": 3,
  "erp_code": "CC-4210",
  "owner_ids": [
    789,
    790
  ],
  "owners": [
    {
      "id": 789,
      "first_name": "Sam",
      "last_name": "Patel",
      "email": "sam.patel@company.com"
    }
  ]
}

Changes

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