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

# Get batch contacts

GET https://v1.getraya.app/api/batch/{id}/contacts

Retrieves a paginated list of contacts in a batch, each with their complete call history (all calls as an array). Customer ID is automatically determined from the API key.

Reference: https://docs.getraya.app/api-reference/batches/get-batch-contacts

## Authentication

- `X-API-Key` header (required) — API key for authentication. Example: raya_ABCD1234567890abcdef

## Request

### Path parameters

- `id` (integer, required) — The batch ID

### Query parameters

- `offset` (integer, optional, default: 0) — Number of records to skip (default: 0)
- `limit` (integer, optional, default: 100) — Maximum number of records to return (default: 100, max: 1000)

## Response

### 200

Batch contacts retrieved successfully

- `contacts` (list of BatchContactsResponseContactsItems, optional)
- `total` (integer, optional)
- `offset` (integer, optional)
- `limit` (integer, optional)

## Errors

### 404 Not Found Error

Batch not found or unauthorized

- `error` (string, optional)
- `message` (string, optional)

## Types

### BatchContactsResponseContactsItems

- `contact_id` (integer, optional)
- `name` (string, optional)
- `phone` (integer, optional)
- `batch_id` (integer, optional)
- `status` (string, optional, nullable)
- `attempts` (integer, optional)
- `agent_args` (map from string to any, optional)
- `calls` (list of BatchContactsResponseContactsItemsCallsItems, optional) — Complete call history for this contact

### BatchContactsResponseContactsItemsCallsItems

- `id` (integer, optional)
- `uuid` (string, optional, nullable)
- `outcome` (string, optional, nullable)
- `call_start_time` (datetime, optional, nullable) — Call start time in UTC (ISO 8601)
- `call_end_time` (datetime, optional, nullable) — Call end time in UTC (ISO 8601)
- `call_duration` (integer, optional, nullable)
- `call_output` (map from string to any, optional, nullable)
- `created_at` (datetime, optional, nullable)

## Examples

**Response**

```json
{
  "contacts": [
    {
      "contact_id": 1,
      "name": "string",
      "phone": 1,
      "batch_id": 1,
      "status": "string",
      "attempts": 1,
      "agent_args": {},
      "calls": [
        {
          "id": 1,
          "uuid": "string",
          "outcome": "string",
          "call_start_time": "2024-01-15T09:30:00Z",
          "call_end_time": "2024-01-15T09:30:00Z",
          "call_duration": 1,
          "call_output": {},
          "created_at": "2024-01-15T09:30:00Z"
        }
      ]
    }
  ],
  "total": 1,
  "offset": 1,
  "limit": 1
}
```

**SDK Code**

```python
import requests

url = "https://v1.getraya.app/api/batch/1/contacts"

headers = {"X-API-Key": "<apiKey>"}

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

print(response.json())
```

```javascript
const url = 'https://v1.getraya.app/api/batch/1/contacts';
const options = {method: 'GET', headers: {'X-API-Key': '<apiKey>'}};

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://v1.getraya.app/api/batch/1/contacts"

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

	req.Header.Add("X-API-Key", "<apiKey>")

	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://v1.getraya.app/api/batch/1/contacts")

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

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<apiKey>'

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://v1.getraya.app/api/batch/1/contacts")
  .header("X-API-Key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://v1.getraya.app/api/batch/1/contacts', [
  'headers' => [
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://v1.getraya.app/api/batch/1/contacts");
var request = new RestRequest(Method.GET);
request.AddHeader("X-API-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-API-Key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://v1.getraya.app/api/batch/1/contacts")! 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()
```