Cost centers

Set access configuration for a cost center

Updates the access configuration (access_type, user_ids, group_ids) for the cost center.

put/cost_centers/{id}/access

Request

  • Base URL
    https://api.perk.com
  • URL
    https://api.perk.com/cost_centers/{id}/access
  • 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

access_type'all' | 'specificUsers' | 'specificUsersOrUserGroups' required

The access type for the cost center. 'all' grants access to all users; 'specificUsers' restricts access to the listed 'user_ids'; 'specificUsersOrUserGroups' restricts access to the listed 'user_ids' and/or 'group_ids'.

group_idsstring[]

The IDs of the user groups granted access to the cost center. Each group must exist within the account and be active. Must be empty when 'all' or 'specificUsers' 'access_type' is used. At least one of 'user_ids' or 'group_ids' is required when 'specificUsersOrUserGroups' is used.

user_idsinteger[]

The IDs of the users granted access to the cost center. Must be positive integers. Must be empty when 'access_type' is 'all'. Required when 'access_type' is 'specificUsers' is used. At least one of 'user_ids' or 'group_ids' is required when 'specificUsersOrUserGroups' is used.

Example request

{
  "access_type": "specificUsersOrUserGroups",
  "group_ids": [
    "11111111-1111-1111-1111-111111111111"
  ],
  "user_ids": [
    123,
    456
  ]
}

Response

Returns '200 OK' and the updated cost center resource with the new access configuration.

access_type'all' | 'specificUsers' | 'specificUsersOrUserGroups'

The current access type for the cost center

approverobject

Approver user details, or 'null' if not set

approver_idinteger

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

archivedboolean

Indicates whether the cost center is archived

count_groupsinteger

The number of user groups granted access to this cost center

count_usersinteger

The number of users assigned to this cost center

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

delegate_idinteger

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

erp_codestring

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

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.

owner_idsinteger[]

IDs of additional travel approvers

Example response

{
  "access_type": "specificUsersOrUserGroups",
  "count_groups": 1,
  "count_users": 1,
  "erp_code": "CC-4210",
  "groups": [
    {
      "id": "11111111-1111-1111-1111-111111111111",
      "name": "Sales Team"
    }
  ],
  "id": "1",
  "name": "Marketing",
  "type": "Department",
  "users": [
    {
      "email": "alex.chen@company.com",
      "first_name": "Alex",
      "id": 123,
      "last_name": "Chen"
    }
  ],
  "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.