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

# List contacts

GET https://api.getdial.ai/api/v1/contacts

Every phone number your lines have exchanged a message or a call with,
newest activity first.

A contact is derived, not stored — there is no address book to add
anyone to. Dial reads your message and call history and reports one row
per counterparty, so a number appears here the moment it first texts or
calls one of your lines, or one of your lines first reaches it, and
never needs to be created or deleted.

**Counts span every line on the account.** Two of your numbers talking
to the same person is one contact with the totals added together, not
two rows — the contact is the person, not the pairing.

**Group conversations are not contacts.** A group message is addressed
to the group rather than to a person, so it is counted under neither the
group nor the participant who sent it. List groups is where those live.

**Pagination** is Stripe-style and matches List billing activity: pass
`limit` for the page size and `starting_after` set to the `lastAt` of
the last contact you received to fetch the next page (only contacts
whose activity is strictly older are returned). `hasMore` tells you
whether to ask again. Most accounts get everything in one call.


Reference: https://docs.getdial.ai/api-reference/rest-api/contacts/list-contacts

## Authentication

- `Authorization` header (bearer token, required) — Your Dial API key, sent as `Authorization: Bearer sk_live_...`

## Request

### Query parameters

- `limit` (integer, optional, default: 100) — Max contacts per page (clamped to 1-1000).
- `starting_after` (datetime, optional) — Exclusive cursor — an exact ISO timestamp (the `lastAt` of the last contact from the previous page). Only contacts with strictly older activity are returned.

## Response

### 200

One page of contacts, newest activity first.

- `contacts` (list of object, required)
  - `number` (string, required) — The contact's number in E.164.
  - `messageCount` (integer, required) — One-to-one messages exchanged with this contact across every line on the account, in both directions. Group messages are excluded.
  - `callCount` (integer, required) — Calls exchanged with this contact across every line on the account, in both directions.
  - `lastAt` (datetime, required) — When the most recent message or call happened. The list is ordered by this, newest first, and it is the value to pass as `starting_after` for the next page.
  - `lastDirection` (enum, required) — Whether the most recent interaction came from them or from you.
    - Allowed values: `inbound`, `outbound`
  - `lastKind` (enum, required) — Whether the most recent interaction was a message or a call. It selects which of the two fields below carries anything.
    - Allowed values: `message`, `call`
  - `lastBody` (string, required) — The most recent message's text, for a preview line. Empty when the most recent interaction was a call, when the message carried only an attachment, and when data retention has cleared its content — `lastKind`, `lastMediaCount` and `lastRedacted` tell those apart.
  - `lastMediaCount` (integer, required) — Attachments on the most recent message; 0 for a call and for a text-only message. A positive count with an empty `lastBody` is a media-only message.
  - `lastRedacted` (boolean, required) — True when data retention cleared the most recent message's content. Distinguishes a swept conversation from an empty one, which would otherwise look identical.
  - `lastCallDuration` (integer, required, nullable) — The most recent call's duration in seconds, or null when the most recent interaction was a message. 0 for a call that never connected.
- `hasMore` (boolean, required) — True when more contacts exist with activity older than the last one returned.

## Errors

### 400 Bad Request Error

Invalid `limit` or `starting_after`.

- `error` (string or map from string to any, optional) — An error message, or a validation-error object for 400 responses.

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (string or map from string to any, optional) — An error message, or a validation-error object for 400 responses.

## Examples

**Response**

```json
{
  "contacts": [
    {
      "number": "+14155550123",
      "messageCount": 42,
      "callCount": 3,
      "lastAt": "2024-01-15T09:30:00Z",
      "lastDirection": "inbound",
      "lastKind": "message",
      "lastBody": "see you then",
      "lastMediaCount": 0,
      "lastRedacted": true,
      "lastCallDuration": null
    }
  ],
  "hasMore": true
}
```

**SDK Code**

```python
import requests

url = "https://api.getdial.ai/api/v1/contacts"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'https://api.getdial.ai/api/v1/contacts';
const options = {method: 'GET', headers: {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.getdial.ai/api/v1/contacts"

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

	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.getdial.ai/api/v1/contacts")

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

request = Net::HTTP::Get.new(url)
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.getdial.ai/api/v1/contacts")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.getdial.ai/api/v1/contacts', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.getdial.ai/api/v1/contacts");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getdial.ai/api/v1/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()
```