---
title: "Count contacts by their latest Lead Perfection call result code"
description: "Returns how many of the workspace's contacts have each code as their current latest LP call result, the same value the rules Preview evaluates (contacts whose last sync found no call are not counted). Feeds the \"Contacts with code\" column on the call result rules table. Owners and admins only."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Integrations

`GET /api/integrations/leadperfection/result-rules/code-counts`

Returns how many of the workspace's contacts have each code as their current latest LP call result, the same value the rules Preview evaluates (contacts whose last sync found no call are not counted). Feeds the "Contacts with code" column on the call result rules table. Owners and admins only.

## Authentication

- `BearerAuth`, http, header `Authorization`, format `JWT`

## Header parameters

- `x-workspace-id` (`get/api/integrations/leadperfection/result-rules/code-counts.header.x-workspace-id`; string, required)

## Code samples

### cURL

```bash
curl --request GET \
  --url https://api.channelautomation.com/api/integrations/leadperfection/result-rules/code-counts \
  --header 'Authorization: Bearer <token>' \
  --header 'x-workspace-id: string'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/integrations/leadperfection/result-rules/code-counts';
const options = {
  method: 'GET',
  headers: {'x-workspace-id': 'string', Authorization: 'Bearer <token>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/integrations/leadperfection/result-rules/code-counts"

headers = {
    "x-workspace-id": "string",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Counts keyed by upper-case code, e.g. {"success":true,"by_code":{"AP":12,"NA":340}}. Codes no contact has are absent.

### 403

Not an admin, or the workspace does not match the signed-in workspace.


Source: https://developer.channelautomations.com/api/get-api-integrations-leadperfection-result-rules-code-counts/index.md
