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

# GetLeadsFromCampaign

POST https://api//api/public/campaign/GetLeadsFromCampaign
Content-Type: application/json

## Gets the leads that are in a campaign.

This request corresponds to the "Lead Analytics" screen in the UI.  
**Remark:** It shows only the "Pending" leads that are about to start executing actions in the campaign. There might be more "Pending" leads from the specified lead list, that the system will insert later for execution.

### Body Parameters

- **campaignId** _(integer)_: The ID of the campaign.
    
- **offset** _(integer)_: The number of records to skip (for pagination).
    
- **limit** _(integer)_: The maximum number of records to return.
    
- **timeFrom** _(string, ISO 8601)_: The start of the time range for filtering.
    
- **timeTo** _(string, ISO 8601)_: The end of the time range for filtering.
    
- **timeFilter** _(string)_: Defines the time filter for fetching leads. Possible values:
    
    - `CreationTime`: Filters leads by their creation time.
        
    - `Everywhere`: No specific time filtering is applied. _(Default behavior if omitted)_
        
    - `LastActionTakenTime`: Filters leads that executed an action within the given time range
        
    - `FailedTime`: Filters leads that executed an action within the given time range
        
    - `LastActionTakenOrFailedTime`: Filters leads that executed an action OR failed within the given time range
        

## Response:

##### **LeadCampaignStatus**

- Pending
    
- InSequence
    
- Finished
    
- Paused
    
- Failed
    

##### **LeadConnectionStatus**

- None
    
- ConnectionSent
    
- ConnectionAccepted
    

##### **LeadMessageStatus**

- None
    
- MessageSent
    
- MessageReply
    

##### **LeadStatusMessage (string)**

Usually null, but if the lead is in Failed status, this shows the reason why the lead failed.

Reference: https://docs.heyreach.io/hey-reach-api/campaigns/get-leads-from-campaign

## Request

### Headers

- `X-API-KEY` (string, optional)

### Body (application/json)

This endpoint expects a string.

- `string`

## Response

### 200

OK

- `totalCount` (integer, required)
- `items` (list of object, required)
  - `id` (integer, required)
  - `linkedInUserProfileId` (string, required)
  - `linkedInUserProfile` (object, required)
    - `linkedin_id` (string, required)
    - `profileUrl` (string, required)
    - `firstName` (string, required)
    - `lastName` (string, required)
    - `headline` (string, required)
    - `imageUrl` (string, required)
    - `location` (string, required)
    - `companyName` (string, required)
    - `position` (string, required)
    - `connections` (integer, required)
    - `followers` (integer, required)
    - `companyUrl` (any, optional, nullable)
    - `about` (any, optional, nullable)
    - `emailAddress` (any, optional, nullable)
  - `lastActionTime` (datetime, required)
  - `creationTime` (datetime, required)
  - `leadCampaignStatus` (string, required)
  - `leadConnectionStatus` (string, required)
  - `leadMessageStatus` (string, required)
  - `linkedInSenderId` (integer, required)
  - `linkedInSenderFullName` (string, required)
  - `failedTime` (any, optional, nullable)
  - `errorCode` (any, optional, nullable)
  - `leadCampaignStatusMessage` (any, optional, nullable)

## Examples

**Request**

```json
"{\r\n  \"campaignId\": 1805\r\n  ,\"offset\": 0\r\n  ,\"limit\": 100\r\n  ,\"timeFrom\": \"2024-10-06T17:34:00+02:00\"\r\n  ,\"timeTo\": \"2024-10-07T17:36:00+02:00\"\r\n  ,\"timeFilter\": \"CreationTime\"\r\n  //,\"timeFilter\": \"Everywhere\"   \r\n  //,\"timeFilter\": \"LastActionTakenTime\"   \r\n  //,\"timeFilter\": \"FailedTime\"   \r\n  //,\"timeFilter\": \"LastActionTakenOrFailedTime\"     \r\n\r\n}"
```

**Response**

```json
{
  "totalCount": 152,
  "items": [
    {
      "id": 62658,
      "linkedInUserProfileId": "AC9sANasasasX0Ia-q6DQxyS35UD7a8716G5c8",
      "linkedInUserProfile": {
        "linkedin_id": "58344979",
        "profileUrl": "https://www.linkedin.com/in/johndoe",
        "firstName": "John",
        "lastName": "Doe",
        "headline": "Communications and Marketing Professional",
        "imageUrl": "https://media.licdn.com/dms/image/v2/D4E03AQH0WJHn5rNRpA/profile-displayphoto-shrink_100_100/profile-displayphoto-shrink_100_100/0/1671ss497?e=173ss&",
        "location": "Princetown",
        "companyName": "ACME",
        "position": "",
        "connections": 0,
        "followers": 0
      },
      "lastActionTime": "2024-10-01T03:28:22Z",
      "creationTime": "2024-09-30T21:28:06Z",
      "leadCampaignStatus": "Finished",
      "leadConnectionStatus": "None",
      "leadMessageStatus": "None",
      "linkedInSenderId": 1108,
      "linkedInSenderFullName": "Jane Doe"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api//api/public/campaign/GetLeadsFromCampaign"

payload = "{
  \"campaignId\": 1805
  ,\"offset\": 0
  ,\"limit\": 100
  ,\"timeFrom\": \"2024-10-06T17:34:00+02:00\"
  ,\"timeTo\": \"2024-10-07T17:36:00+02:00\"
  ,\"timeFilter\": \"CreationTime\"
  //,\"timeFilter\": \"Everywhere\"   
  //,\"timeFilter\": \"LastActionTakenTime\"   
  //,\"timeFilter\": \"FailedTime\"   
  //,\"timeFilter\": \"LastActionTakenOrFailedTime\"     

}"
headers = {
    "X-API-KEY": "<string>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api//api/public/campaign/GetLeadsFromCampaign';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<string>', 'Content-Type': 'application/json'},
  body: '"{\r\n  \"campaignId\": 1805\r\n  ,\"offset\": 0\r\n  ,\"limit\": 100\r\n  ,\"timeFrom\": \"2024-10-06T17:34:00+02:00\"\r\n  ,\"timeTo\": \"2024-10-07T17:36:00+02:00\"\r\n  ,\"timeFilter\": \"CreationTime\"\r\n  //,\"timeFilter\": \"Everywhere\"   \r\n  //,\"timeFilter\": \"LastActionTakenTime\"   \r\n  //,\"timeFilter\": \"FailedTime\"   \r\n  //,\"timeFilter\": \"LastActionTakenOrFailedTime\"     \r\n\r\n}"'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api//api/public/campaign/GetLeadsFromCampaign"

	payload := strings.NewReader("\"{\\r\\n  \\\"campaignId\\\": 1805\\r\\n  ,\\\"offset\\\": 0\\r\\n  ,\\\"limit\\\": 100\\r\\n  ,\\\"timeFrom\\\": \\\"2024-10-06T17:34:00+02:00\\\"\\r\\n  ,\\\"timeTo\\\": \\\"2024-10-07T17:36:00+02:00\\\"\\r\\n  ,\\\"timeFilter\\\": \\\"CreationTime\\\"\\r\\n  //,\\\"timeFilter\\\": \\\"Everywhere\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"FailedTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenOrFailedTime\\\"     \\r\\n\\r\\n}\"")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "<string>")
	req.Header.Add("Content-Type", "application/json")

	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//api/public/campaign/GetLeadsFromCampaign")

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

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<string>'
request["Content-Type"] = 'application/json'
request.body = "\"{\\r\\n  \\\"campaignId\\\": 1805\\r\\n  ,\\\"offset\\\": 0\\r\\n  ,\\\"limit\\\": 100\\r\\n  ,\\\"timeFrom\\\": \\\"2024-10-06T17:34:00+02:00\\\"\\r\\n  ,\\\"timeTo\\\": \\\"2024-10-07T17:36:00+02:00\\\"\\r\\n  ,\\\"timeFilter\\\": \\\"CreationTime\\\"\\r\\n  //,\\\"timeFilter\\\": \\\"Everywhere\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"FailedTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenOrFailedTime\\\"     \\r\\n\\r\\n}\""

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.post("https://api//api/public/campaign/GetLeadsFromCampaign")
  .header("X-API-KEY", "<string>")
  .header("Content-Type", "application/json")
  .body("\"{\\r\\n  \\\"campaignId\\\": 1805\\r\\n  ,\\\"offset\\\": 0\\r\\n  ,\\\"limit\\\": 100\\r\\n  ,\\\"timeFrom\\\": \\\"2024-10-06T17:34:00+02:00\\\"\\r\\n  ,\\\"timeTo\\\": \\\"2024-10-07T17:36:00+02:00\\\"\\r\\n  ,\\\"timeFilter\\\": \\\"CreationTime\\\"\\r\\n  //,\\\"timeFilter\\\": \\\"Everywhere\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"FailedTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenOrFailedTime\\\"     \\r\\n\\r\\n}\"")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api//api/public/campaign/GetLeadsFromCampaign', [
  'body' => '"{\\r\\n  \\"campaignId\\": 1805\\r\\n  ,\\"offset\\": 0\\r\\n  ,\\"limit\\": 100\\r\\n  ,\\"timeFrom\\": \\"2024-10-06T17:34:00+02:00\\"\\r\\n  ,\\"timeTo\\": \\"2024-10-07T17:36:00+02:00\\"\\r\\n  ,\\"timeFilter\\": \\"CreationTime\\"\\r\\n  //,\\"timeFilter\\": \\"Everywhere\\"   \\r\\n  //,\\"timeFilter\\": \\"LastActionTakenTime\\"   \\r\\n  //,\\"timeFilter\\": \\"FailedTime\\"   \\r\\n  //,\\"timeFilter\\": \\"LastActionTakenOrFailedTime\\"     \\r\\n\\r\\n}"',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<string>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api//api/public/campaign/GetLeadsFromCampaign");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "<string>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "\"{\\r\\n  \\\"campaignId\\\": 1805\\r\\n  ,\\\"offset\\\": 0\\r\\n  ,\\\"limit\\\": 100\\r\\n  ,\\\"timeFrom\\\": \\\"2024-10-06T17:34:00+02:00\\\"\\r\\n  ,\\\"timeTo\\\": \\\"2024-10-07T17:36:00+02:00\\\"\\r\\n  ,\\\"timeFilter\\\": \\\"CreationTime\\\"\\r\\n  //,\\\"timeFilter\\\": \\\"Everywhere\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"FailedTime\\\"   \\r\\n  //,\\\"timeFilter\\\": \\\"LastActionTakenOrFailedTime\\\"     \\r\\n\\r\\n}\"", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<string>",
  "Content-Type": "application/json"
]
let parameters = "{
  \"campaignId\": 1805
  ,\"offset\": 0
  ,\"limit\": 100
  ,\"timeFrom\": \"2024-10-06T17:34:00+02:00\"
  ,\"timeTo\": \"2024-10-07T17:36:00+02:00\"
  ,\"timeFilter\": \"CreationTime\"
  //,\"timeFilter\": \"Everywhere\"   
  //,\"timeFilter\": \"LastActionTakenTime\"   
  //,\"timeFilter\": \"FailedTime\"   
  //,\"timeFilter\": \"LastActionTakenOrFailedTime\"     

}" as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api//api/public/campaign/GetLeadsFromCampaign")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```