> This page is for Web Benefits.

> 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 Employees [Batch]

GET https://api.paylocity.com/coreHr/v1/companies/{companyId}/employees

**Summary Description**

The GET Employee List by Company ID API endpoint provides a list of up to 20 employees per call from the Paylocity system. Designed for the initial population of user systems with Paylocity's employee data, it supports pagination for easy navigation through results. The 'include' parameter enables selective retrieval of payload elements, while the 'Active Only' filter helps obtain only those employees with an 'Active' Employee Status Type. This makes the endpoint highly flexible and capable of delivering tailored listings to meet specific user requirements.

**GET Employee List by Company ID - Use Cases:**

- The 'Get Employee List by Company ID' endpoint empowers API users to fetch a comprehensive list of employees alongside their relevant data. Ideal for initial data loads.

- The recommended best practice to track employee demographic changes is not through regular polling of this endpoint. Instead, utilize our employee webhooks in conjunction with the 'GET Single Employee by Company and Employee ID' endpoint.

Reference: https://paylocity.ferndocs.com/web-benefits/api-reference/latest/paylocity-ap-is/employee-demographic/get-employees-batch

## 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) — Number of employees per page. **Default Value:** 20 **Maximum Value:** 20
- `nextToken` (string, optional) — Next token for the page.
- `include` (string, optional) — Comma separated list of data to be included. **Allowable Values:** info, position, status and payrate.
- `activeOnly` (boolean, optional) — Filter only active emplooyes. **Allowable Values:** true, false

### Headers

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

## Response

### 200

Successful response

## Examples

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.paylocity.com/coreHr/v1/companies/companyId/employees"

querystring = {"limit":"20","nextToken":"<string>","include":"<string>","activeOnly":"true"}

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

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

print(response.json())
```

```javascript
const url = 'https://api.paylocity.com/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=true';
const options = {
  method: 'GET',
  headers: {
    testMode: '<boolean>',
    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/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=true"

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

	req.Header.Add("testMode", "<boolean>")
	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/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=true")

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

request = Net::HTTP::Get.new(url)
request["testMode"] = '<boolean>'
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/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=true")
  .header("testMode", "<boolean>")
  .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/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=true', [
  'headers' => [
    'Accept' => 'application/json',
    'Authorization' => 'Bearer <token>',
    'testMode' => '<boolean>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.paylocity.com/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=true");
var request = new RestRequest(Method.GET);
request.AddHeader("testMode", "<boolean>");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.paylocity.com/coreHr/v1/companies/companyId/employees?limit=20&nextToken=%3Cstring%3E&include=%3Cstring%3E&activeOnly=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()
```