> This page is for Onboarding.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://paylocity.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://paylocity.ferndocs.com/_mcp/server.

# Get Cost Centers/Labor Levels

GET https://api.paylocity.com/apiHub/time/v1/companies/{companyId}/costCenters

**Summary Description**

The GET Time and Labor Cost Center List by Company ID endpoint retrieves a comprehensive list of cost centers from the Paylocity Time and Labor system with each call. A cost center is a specific department, division, or function within an organization that incurs costs but does not directly generate revenue. This API is essential for financial reporting, budgeting, and performance management. By accessing the costCenters endpoint, you can access an up-to-date and accurate list of these entities, providing granular insight into where an organization's expenses are originating. This data is critical for budget tracking, expense allocation, and operational efficiency analysis, helping businesses make informed financial decisions.

**Use Cases**

- Automated Financial Reporting: Integrate the API into business intelligence (BI) tools or financial dashboards to automatically generate reports on departmental spending, helping to identify and analyze cost trends over time without manual data entry.
- Budget Management & Forecasting: Use the cost center data to create and manage budgets for different departments. By pulling the list of cost centers, a financial application can match them to expense data, enabling more accurate forecasting and budget variance analysis.
- Payroll & Expense Allocation: Connect the API to a payroll system to correctly allocate employee hours and labor costs to the specific cost centers they worked for. This ensures accurate billing, job costing, and departmental expense tracking.
- ERP & HCM Integration: Seamlessly integrate the Paylocity data with other Enterprise Resource Planning (ERP) or Human Capital Management (HCM) systems. This allows for a unified view of an organization's financial and personnel data, improving data consistency and streamlining operations.
- Auditing & Compliance: Retrieve a list of all cost centers for internal and external audits. The API provides a single source of truth for cost center data, ensuring compliance with accounting standards and regulations by providing a clear trail of expenses.

Reference: https://paylocity.ferndocs.com/onboarding/api-reference/latest/paylocity-ap-is/company-level-information-time-and-labor/get-cost-centers-labor-levels

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `companyId` (string, required)

### Query parameters

- `limit` (integer, optional) — The number of records to return. The default is 25. The maximum is 1000.
- `offset` (integer, optional) — The number of records to offset the results by. For instance, a value of 0 will begin the results at the first record, but a value of 100 will start with the 101st record.
- `includeTotalCount` (boolean, optional) — If true, adds X-Pcty-Total-Count header with the total count of results for the query.

### Headers

- `testMode` (boolean, optional) — If true all responses are mocked and generated randomly.
- `Accept` (string, optional)

## Response

### 200

Successful response

- `costCenters` (list of map from string to any, required)
- `totalCount` (integer, optional)

## Examples

**Response**

```json
{
  "costCenters": [
    {}
  ],
  "totalCount": 1
}
```

**SDK Code**

```python
import requests

url = "https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters"

querystring = {"limit":"25","offset":"0","includeTotalCount":"true"}

headers = {
    "testMode": "true",
    "Accept": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true';
const options = {
  method: 'GET',
  headers: {testMode: 'true', Accept: 'application/json', Authorization: 'Bearer <token>'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("testMode", "true")
	req.Header.Add("Accept", "application/json")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["testMode"] = 'true'
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true")
  .header("testMode", "true")
  .header("Accept", "application/json")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true', [
  'headers' => [
    'Accept' => 'application/json',
    'Authorization' => 'Bearer <token>',
    'testMode' => 'true',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true");
var request = new RestRequest(Method.GET);
request.AddHeader("testMode", "true");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "testMode": "true",
  "Accept": "application/json",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.paylocity.com/apiHub/time/v1/companies/companyId/costCenters?limit=25&offset=0&includeTotalCount=true")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```