# Contacts

Your address book: add, merge, import and export.

An SDK signs every request with your key: [Authentication](https://mailset.app/docs/authentication.md). To sign one yourself, see [Calling the API without an SDK](https://mailset.app/docs/authentication/http.md).

## The Contact object

A person in your contacts, with every field you keep of them.

### Attributes

- `id` (string): The contact’s id.
- `name` (string): The full name as shown.
- `firstName` (string)
- `middleName` (string)
- `lastName` (string)
- `prefix` (string)
- `suffix` (string)
- `nickname` (string)
- `company` (string)
- `title` (string)
- `department` (string)
- `emails` (array of objects)
  - `value` (string): The address, number, URL or text.
  - `label` (string): What it’s for: `work`, `home`. Empty when unlabelled.
- `phones` (array of objects)
  - `value` (string): The address, number, URL or text.
  - `label` (string): What it’s for: `work`, `home`. Empty when unlabelled.
- `addresses` (array of objects)
  - `value` (string): The address, number, URL or text.
  - `label` (string): What it’s for: `work`, `home`. Empty when unlabelled.
- `websites` (array of objects)
  - `value` (string): The address, number, URL or text.
  - `label` (string): What it’s for: `work`, `home`. Empty when unlabelled.
- `birthday` (string)
- `notes` (string)
- `labels` (array of strings): The labels on the contact, by name.
- `other` (array of objects)
  - `value` (string): The address, number, URL or text.
  - `label` (string): What it’s for: `work`, `home`. Empty when unlabelled.
- `picture` (nullable string): A short-lived URL for their photo. Null: none, so show initials.
- `createdAt` (number): When it was saved, in ms since the epoch.
- `updatedAt` (number): When it last changed, in ms since the epoch.

```json
{
  "id": "out_3f9a1c0e7b2d",
  "name": "Acme API",
  "firstName": "text",
  "middleName": "text",
  "lastName": "text",
  "prefix": "text",
  "suffix": "text",
  "nickname": "text",
  "company": "text",
  "title": "text",
  "department": "text",
  "emails": [
    {
      "value": "text",
      "label": "text"
    }
  ],
  "phones": [
    {
      "value": "text",
      "label": "text"
    }
  ],
  "addresses": [
    {
      "value": "text",
      "label": "text"
    }
  ],
  "websites": [
    {
      "value": "text",
      "label": "text"
    }
  ],
  "birthday": "text",
  "notes": "text",
  "labels": [
    "text"
  ],
  "other": [
    {
      "value": "text",
      "label": "text"
    }
  ],
  "picture": "text",
  "createdAt": 1796048940000,
  "updatedAt": 1796048940000
}
```

Answered by [contacts.get](https://mailset.app/docs/api/contacts#contacts.get), [contacts.add](https://mailset.app/docs/api/contacts#contacts.add), [contacts.update](https://mailset.app/docs/api/contacts#contacts.update).

## contacts.list

List your contacts, by name.

`POST /v1/contacts.list`

Any signed-in person, with an API token.

### Parameters

- `limit` (integer, optional): How many contacts a page holds, 1 to 200. Default `50`. From 1 to 200.
- `after` (string, optional): The `next` of the page before, for the page after it.
- `label` (string, optional): Only contacts with this label. At most 64 characters.

### Returns

`data` is an object with:

- `contacts` (array of objects)
  - `id` (string)
  - `name` (string)
  - `emails` (array of strings)
  - `phones` (array of strings)
  - `company` (string)
  - `title` (string)
  - `labels` (array of strings)
  - `picture` (nullable string)
- `next` (nullable string): Pass as `after` for the next page. Null at the end.
- `total` (number)
- `revision` (number): Rises with every change to the address book.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.list({
	label: "Customers",
	limit: 100,
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.list(
    {"label": "Customers", "limit": 100}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsListParams{
		Label: mailset.String("Customers"),
		Limit: mailset.Int(100),
	}
	answer, err := client.Contacts.List(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.list(
  label: 'Customers',
  limit: 100
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->list([
    'label' => 'Customers',
    'limit' => 100,
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactPage;
import app.mailset.model.ContactsListParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsListParams.builder()
        .label("Customers")
        .limit(100L)
        .build();
ContactPage answer = mailset.contacts().list(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsListParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .list(ContactsListParams {
        limit: Some(100),
        label: Some("Customers".into()),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.list \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"label":"Customers","limit":100}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts list --label Customers --limit 100
```

### Response

```json
{
  "ok": true,
  "data": {
    "contacts": [
      {
        "id": "out_3f9a1c0e7b2d",
        "name": "Acme API",
        "emails": [
          "hello@example.com"
        ],
        "phones": [
          "text"
        ],
        "company": "text",
        "title": "text",
        "labels": [
          "text"
        ],
        "picture": "text"
      }
    ],
    "next": "eyJhIjoxNzk2MDkyNDQyfQ",
    "total": 12,
    "revision": 1
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-list)

## contacts.search

Search your contacts: name, address, phone, company, notes, labels.

`POST /v1/contacts.search`

Any signed-in person, with an API token.

### Parameters

- `query` (string, required): What to find, in a name, address, phone, company, note or label. At most 200 characters.
- `limit` (integer, optional): How many contacts a page holds, 1 to 200. Default `50`. From 1 to 200.
- `after` (string, optional): The `next` of the page before, for the page after it.

### Returns

`data` is an object with:

- `contacts` (array of objects)
  - `id` (string)
  - `name` (string)
  - `emails` (array of strings)
  - `phones` (array of strings)
  - `company` (string)
  - `title` (string)
  - `labels` (array of strings)
  - `picture` (nullable string)
- `next` (nullable string): Pass as `after` for the next page. Null at the end.
- `total` (number)
- `revision` (number): Rises with every change to the address book.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.search({
	query: "maria",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.search({"query": "maria"})
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsSearchParams{
		Query: "maria",
	}
	answer, err := client.Contacts.Search(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.search(query: 'maria')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->search([
    'query' => 'maria',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactPage;
import app.mailset.model.ContactsSearchParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsSearchParams.builder()
        .query("maria")
        .build();
ContactPage answer = mailset.contacts().search(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsSearchParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .search(ContactsSearchParams {
        query: "maria".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.search \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"query":"maria"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts search maria
```

### Response

```json
{
  "ok": true,
  "data": {
    "contacts": [
      {
        "id": "out_3f9a1c0e7b2d",
        "name": "Acme API",
        "emails": [
          "hello@example.com"
        ],
        "phones": [
          "text"
        ],
        "company": "text",
        "title": "text",
        "labels": [
          "text"
        ],
        "picture": "text"
      }
    ],
    "next": "eyJhIjoxNzk2MDkyNDQyfQ",
    "total": 12,
    "revision": 1
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-search)

## contacts.get

Show one contact.

`POST /v1/contacts.get`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The contact’s id.

### Returns

`data` is the [Contact object](https://mailset.app/docs/api/contacts#contact).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.get({
	id: "con_4e9a2c7f1b6d3058a3c7e1b9",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.get(
    {"id": "con_4e9a2c7f1b6d3058a3c7e1b9"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsGetParams{
		ID: "con_4e9a2c7f1b6d3058a3c7e1b9",
	}
	answer, err := client.Contacts.Get(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.get(
  id: 'con_4e9a2c7f1b6d3058a3c7e1b9'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->get([
    'id' => 'con_4e9a2c7f1b6d3058a3c7e1b9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Contact;
import app.mailset.model.ContactsGetParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsGetParams.builder()
        .id("con_4e9a2c7f1b6d3058a3c7e1b9")
        .build();
Contact answer = mailset.contacts().get(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsGetParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .get(ContactsGetParams {
        id: "con_4e9a2c7f1b6d3058a3c7e1b9".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.get \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"con_4e9a2c7f1b6d3058a3c7e1b9"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts get con_4e9a2c7f1b6d3058a3c7e1b9
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "firstName": "text",
    "middleName": "text",
    "lastName": "text",
    "prefix": "text",
    "suffix": "text",
    "nickname": "text",
    "company": "text",
    "title": "text",
    "department": "text",
    "emails": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "phones": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "addresses": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "websites": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "birthday": "text",
    "notes": "text",
    "labels": [
      "text"
    ],
    "other": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "picture": "text",
    "createdAt": 1796048940000,
    "updatedAt": 1796048940000
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-get)

## contacts.add

Save someone.

`POST /v1/contacts.add`

Any signed-in person, with an API token.

### Parameters

- `name` (string, optional): The full name as shown. Left empty, it is put together from the parts. At most 200 characters.
- `firstName` (string, optional): Their first name. At most 200 characters.
- `middleName` (string, optional): Their middle name. At most 200 characters.
- `lastName` (string, optional): Their last name. At most 200 characters.
- `prefix` (string, optional): What goes before the name: Dr. At most 200 characters.
- `suffix` (string, optional): What goes after it: Jr. At most 200 characters.
- `nickname` (string, optional): What you call them. At most 200 characters.
- `company` (string, optional): Where they work. At most 200 characters.
- `title` (string, optional): Their job title. At most 200 characters.
- `department` (string, optional): Their department. At most 200 characters.
- `emails` (array of strings or objects, optional): Addresses, the first is primary. Each is an address, or `{ value, label }`. Up to 20. At most 20 items.
  - `value` (string, required): The address, number, URL or text.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `phones` (array of strings or objects, optional): Phone numbers, each a number or `{ value, label }`. Up to 20. At most 20 items.
  - `value` (string, required): The address, number, URL or text. At most 64 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `addresses` (array of strings or objects, optional): Postal addresses, each as text or `{ value, label }`. Up to 10. At most 10 items.
  - `value` (string, required): The address, number, URL or text. At most 1,000 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `websites` (array of strings or objects, optional): Websites, each a URL or `{ value, label }`. Up to 10. At most 10 items.
  - `value` (string, required): The address, number, URL or text. At most 1,000 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `birthday` (string, optional): Their birthday, as written: `1990-04-12`. At most 32 characters.
- `notes` (string, optional): Your own notes about them. At most 20,000 characters.
- `labels` (array of strings, optional): The labels on the contact, by name. Up to 50. At most 50 items.
- `other` (array of strings or objects, optional): Anything else a contact came with: events, relations, custom fields. At most 50 items.
  - `value` (string, required): The address, number, URL or text. At most 1,000 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.

### Returns

`data` is the [Contact object](https://mailset.app/docs/api/contacts#contact).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.add({
	emails: [
		"maria@example.com",
	],
	phones: [
		"+1 555 0100",
	],
	company: "Example Inc",
	name: "Maria Lopez",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.add(
    {
        "emails": ["maria@example.com"],
        "phones": ["+1 555 0100"],
        "company": "Example Inc",
        "name": "Maria Lopez",
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsAddParams{
		Emails:  []any{"maria@example.com"},
		Phones:  []any{"+1 555 0100"},
		Company: mailset.String("Example Inc"),
		Name:    mailset.String("Maria Lopez"),
	}
	answer, err := client.Contacts.Add(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.add(
  emails: ['maria@example.com'],
  phones: ['+1 555 0100'],
  company: 'Example Inc',
  name: 'Maria Lopez'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->add([
    'emails' => ['maria@example.com'],
    'phones' => ['+1 555 0100'],
    'company' => 'Example Inc',
    'name' => 'Maria Lopez',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Contact;
import app.mailset.model.ContactsAddParams;
import java.util.List;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsAddParams.builder()
        .emails(List.of("maria@example.com"))
        .phones(List.of("+1 555 0100"))
        .company("Example Inc")
        .name("Maria Lopez")
        .build();
Contact answer = mailset.contacts().add(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsAddParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .add(ContactsAddParams {
        name: Some("Maria Lopez".into()),
        company: Some("Example Inc".into()),
        emails: Some(vec!["maria@example.com".into()]),
        phones: Some(vec!["+1 555 0100".into()]),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.add \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"emails":["maria@example.com"],"phones":["+1 555 0100"],"company":"Example Inc","name":"Maria Lopez"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts add "Maria Lopez" --emails maria@example.com --phones "+1 555 0100" --company "Example Inc"
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "firstName": "text",
    "middleName": "text",
    "lastName": "text",
    "prefix": "text",
    "suffix": "text",
    "nickname": "text",
    "company": "text",
    "title": "text",
    "department": "text",
    "emails": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "phones": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "addresses": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "websites": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "birthday": "text",
    "notes": "text",
    "labels": [
      "text"
    ],
    "other": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "picture": "text",
    "createdAt": 1796048940000,
    "updatedAt": 1796048940000
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-add)

## contacts.update

Change a contact. Only the fields you pass change.

`POST /v1/contacts.update`

Any signed-in person, with an API token.

### Parameters

- `name` (string, optional): The full name as shown. Left empty, it is put together from the parts. At most 200 characters.
- `firstName` (string, optional): Their first name. At most 200 characters.
- `middleName` (string, optional): Their middle name. At most 200 characters.
- `lastName` (string, optional): Their last name. At most 200 characters.
- `prefix` (string, optional): What goes before the name: Dr. At most 200 characters.
- `suffix` (string, optional): What goes after it: Jr. At most 200 characters.
- `nickname` (string, optional): What you call them. At most 200 characters.
- `company` (string, optional): Where they work. At most 200 characters.
- `title` (string, optional): Their job title. At most 200 characters.
- `department` (string, optional): Their department. At most 200 characters.
- `emails` (array of strings or objects, optional): Addresses, the first is primary. Each is an address, or `{ value, label }`. Up to 20. At most 20 items.
  - `value` (string, required): The address, number, URL or text.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `phones` (array of strings or objects, optional): Phone numbers, each a number or `{ value, label }`. Up to 20. At most 20 items.
  - `value` (string, required): The address, number, URL or text. At most 64 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `addresses` (array of strings or objects, optional): Postal addresses, each as text or `{ value, label }`. Up to 10. At most 10 items.
  - `value` (string, required): The address, number, URL or text. At most 1,000 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `websites` (array of strings or objects, optional): Websites, each a URL or `{ value, label }`. Up to 10. At most 10 items.
  - `value` (string, required): The address, number, URL or text. At most 1,000 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `birthday` (string, optional): Their birthday, as written: `1990-04-12`. At most 32 characters.
- `notes` (string, optional): Your own notes about them. At most 20,000 characters.
- `labels` (array of strings, optional): The labels on the contact, by name. Up to 50. At most 50 items.
- `other` (array of strings or objects, optional): Anything else a contact came with: events, relations, custom fields. At most 50 items.
  - `value` (string, required): The address, number, URL or text. At most 1,000 characters.
  - `label` (string, optional): What it’s for: `work`, `home`. At most 64 characters.
- `id` (string, required): The contact’s id.

### Returns

`data` is the [Contact object](https://mailset.app/docs/api/contacts#contact).

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.update({
	company: "Example Inc",
	title: "Head of Finance",
	id: "con_4e9a2c7f1b6d3058a3c7e1b9",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.update(
    {
        "company": "Example Inc",
        "title": "Head of Finance",
        "id": "con_4e9a2c7f1b6d3058a3c7e1b9",
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsUpdateParams{
		Company: mailset.String("Example Inc"),
		Title:   mailset.String("Head of Finance"),
		ID:      "con_4e9a2c7f1b6d3058a3c7e1b9",
	}
	answer, err := client.Contacts.Update(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.update(
  company: 'Example Inc',
  title: 'Head of Finance',
  id: 'con_4e9a2c7f1b6d3058a3c7e1b9'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->update([
    'company' => 'Example Inc',
    'title' => 'Head of Finance',
    'id' => 'con_4e9a2c7f1b6d3058a3c7e1b9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Contact;
import app.mailset.model.ContactsUpdateParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsUpdateParams.builder()
        .company("Example Inc")
        .title("Head of Finance")
        .id("con_4e9a2c7f1b6d3058a3c7e1b9")
        .build();
Contact answer = mailset.contacts().update(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsUpdateParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .update(ContactsUpdateParams {
        company: Some("Example Inc".into()),
        title: Some("Head of Finance".into()),
        id: "con_4e9a2c7f1b6d3058a3c7e1b9".into(),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.update \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"company":"Example Inc","title":"Head of Finance","id":"con_4e9a2c7f1b6d3058a3c7e1b9"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts update con_4e9a2c7f1b6d3058a3c7e1b9 --company "Example Inc" --title "Head of Finance"
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "firstName": "text",
    "middleName": "text",
    "lastName": "text",
    "prefix": "text",
    "suffix": "text",
    "nickname": "text",
    "company": "text",
    "title": "text",
    "department": "text",
    "emails": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "phones": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "addresses": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "websites": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "birthday": "text",
    "notes": "text",
    "labels": [
      "text"
    ],
    "other": [
      {
        "value": "text",
        "label": "text"
      }
    ],
    "picture": "text",
    "createdAt": 1796048940000,
    "updatedAt": 1796048940000
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-update)

## contacts.remove

Delete contacts and their photos.

`POST /v1/contacts.remove`

Any signed-in person, with an API token.

### Parameters

- `ids` (array of strings, required): One contact’s id, or a list of up to 200. 1 to 200 items.

### Returns

`data` is an object with:

- `removed` (number): How many were deleted.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.remove({
	ids: [
		"con_4e9a2c7f1b6d3058a3c7e1b9",
	],
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.remove(
    {"ids": ["con_4e9a2c7f1b6d3058a3c7e1b9"]}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsRemoveParams{
		IDs: []string{"con_4e9a2c7f1b6d3058a3c7e1b9"},
	}
	answer, err := client.Contacts.Remove(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.remove(
  ids: ['con_4e9a2c7f1b6d3058a3c7e1b9']
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->remove([
    'ids' => ['con_4e9a2c7f1b6d3058a3c7e1b9'],
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactsRemoveParams;
import app.mailset.model.ContactsRemoveResult;
import java.util.List;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsRemoveParams.builder()
        .ids(List.of("con_4e9a2c7f1b6d3058a3c7e1b9"))
        .build();
ContactsRemoveResult answer =
        mailset.contacts().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsRemoveParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .remove(ContactsRemoveParams {
        ids: vec!["con_4e9a2c7f1b6d3058a3c7e1b9".into()],
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"ids":"con_4e9a2c7f1b6d3058a3c7e1b9"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts remove con_4e9a2c7f1b6d3058a3c7e1b9
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": 1
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-remove)

## contacts.duplicates

Find contacts that look like the same person.

`POST /v1/contacts.duplicates`

Any signed-in person, with an API token.

### Parameters

It takes no input: send an empty object.

### Returns

`data` is a list of objects, each with:

- `reason` (enum): One of `email`, `phone`, `name`.
- `contacts` (array of objects)
  - `id` (string)
  - `name` (string)
  - `emails` (array of strings)
  - `phones` (array of strings)
  - `company` (string)
  - `title` (string)
  - `labels` (array of strings)
  - `picture` (nullable string)

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.duplicates();
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.duplicates()
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Contacts.Duplicates(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.duplicates
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->duplicates();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DuplicateGroup;
import java.util.List;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

List<DuplicateGroup> answer =
        mailset.contacts().duplicates();
System.out.println(answer);
```

Rust:

```rust
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.contacts().duplicates().await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.duplicates \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts duplicates
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "reason": "email",
      "contacts": [
        {
          "id": "out_3f9a1c0e7b2d",
          "name": "Acme API",
          "emails": [
            "hello@example.com"
          ],
          "phones": [
            "text"
          ],
          "company": "text",
          "title": "text",
          "labels": [
            "text"
          ],
          "picture": "text"
        }
      ]
    }
  ]
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-duplicates)

## contacts.merge

Merge duplicates.

`POST /v1/contacts.merge`

Any signed-in person, with an API token.

### Parameters

- `ids` (array of strings, optional): The contacts to merge, 2 to 50. The first is kept. 2 to 50 items.
- `all` (boolean, optional): Merge every group `contacts duplicates` finds.

### Returns

`data` is an object with:

- `removed` (number): Contacts folded into another and gone.
- `kept` (array of strings): Who was left standing.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.merge({
	ids: [
		"con_4e9a2c7f1b6d3058a3c7e1b9",
		"con_a1c6e3b9f2d74058b6e2a9c4",
	],
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.merge(
    {
        "ids": [
            "con_4e9a2c7f1b6d3058a3c7e1b9",
            "con_a1c6e3b9f2d74058b6e2a9c4",
        ],
    }
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsMergeParams{
		IDs: []string{
			"con_4e9a2c7f1b6d3058a3c7e1b9",
			"con_a1c6e3b9f2d74058b6e2a9c4",
		},
	}
	answer, err := client.Contacts.Merge(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.merge(
  ids: [
    'con_4e9a2c7f1b6d3058a3c7e1b9',
    'con_a1c6e3b9f2d74058b6e2a9c4'
  ]
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->merge([
    'ids' => [
        'con_4e9a2c7f1b6d3058a3c7e1b9',
        'con_a1c6e3b9f2d74058b6e2a9c4',
    ],
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactsMergeParams;
import app.mailset.model.MergeResult;
import java.util.List;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsMergeParams.builder()
        .ids(List.of(
                "con_4e9a2c7f1b6d3058a3c7e1b9",
                "con_a1c6e3b9f2d74058b6e2a9c4"))
        .build();
MergeResult answer = mailset.contacts().merge(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsMergeParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .merge(ContactsMergeParams {
        ids: Some(vec![
            "con_4e9a2c7f1b6d3058a3c7e1b9".into(),
            "con_a1c6e3b9f2d74058b6e2a9c4".into(),
        ]),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.merge \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"ids":["con_4e9a2c7f1b6d3058a3c7e1b9","con_a1c6e3b9f2d74058b6e2a9c4"]}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts merge --ids con_4e9a2c7f1b6d3058a3c7e1b9,con_a1c6e3b9f2d74058b6e2a9c4
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": 1,
    "kept": [
      "text"
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-merge)

## contacts.import

Import a Google Contacts CSV or a vCard file.

`POST /v1/contacts.import`

Any signed-in person, with an API token.

### Parameters

- `name` (string, required): The file’s name. At most 255 characters.
- `data` (string, required): The file, base64.

### Returns

`data` is an object with:

- `format` (enum): One of `csv`, `vcard`.
- `read` (number): Rows or cards found in the file.
- `added` (number)
- `merged` (number): Already saved: anything new in the file was added to them.
- `unchanged` (number): Already saved, with nothing new to add.
- `skipped` (array of objects): Rows or cards left out, and why. Up to 200 are listed; `skippedTotal` counts them all.
  - `at` (number): The row or card it was, counting from 1.
  - `who` (string): What’s known of it, so you can find it in your file.
  - `reason` (string)
- `skippedTotal` (number)
- `photos` (object)
  - `added` (number): Every photo kept, inline or fetched.
  - `refused` (number): Inline photos refused for their type or size.
  - `remote` (number): Links anywhere but Google’s photo hosts: Mailset doesn’t fetch them.
  - `fetched` (number): Links on Google’s photo hosts, fetched and kept. Counted in `added` too.
  - `failed` (number): Links on Google’s photo hosts that gave no usable photo.
  - `remaining` (number): Links on Google’s photo hosts this import had no room or time for. Importing the file again fetches them.
- `ignored` (array of strings): Columns or properties with data that Mailset has no field for.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.import({
	name: "contacts.vcf",
	data: "<the message as base64>",
});
console.log(answer);
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.import_contacts(
    {
        "name": "contacts.vcf",
        "data": "<the message as base64>",
    }
)
print(answer)
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsImportParams{
		Name: "contacts.vcf",
		Data: "<the message as base64>",
	}
	answer, err := client.Contacts.Import(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.import(
  name: 'contacts.vcf',
  data: '<the message as base64>'
)
p answer
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->import([
    'name' => 'contacts.vcf',
    'data' => '<the message as base64>',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactImportReport;
import app.mailset.model.ContactsImportParams;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsImportParams.builder()
        .name("contacts.vcf")
        .data("<the message as base64>")
        .build();
ContactImportReport answer =
        mailset.contacts().importContacts(params);
System.out.println(answer);
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Rust:

```rust
use mailset::types::ContactsImportParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .import(ContactsImportParams {
        name: "contacts.vcf".into(),
        data: "<the message as base64>".into(),
    })
    .await?;
println!("{answer:?}");
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

curl:

```bash
curl https://mailset.app/v1/contacts.import \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"name":"contacts.vcf","data":"<base64 of the file>"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts import --file contacts.vcf
```

### Response

```json
{
  "ok": true,
  "data": {
    "format": "csv",
    "read": 1,
    "added": 1,
    "merged": 1,
    "unchanged": 1,
    "skipped": [
      {
        "at": 1796048940000,
        "who": "text",
        "reason": "The day’s sending limit is reached."
      }
    ],
    "skippedTotal": 12,
    "photos": {
      "added": 1,
      "refused": 1,
      "remote": 1,
      "fetched": 1,
      "failed": 1,
      "remaining": 1
    },
    "ignored": [
      "text"
    ]
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-import)

## contacts.export

Print your contacts as vCard or CSV.

`POST /v1/contacts.export`

Any signed-in person, with an API token.

### Parameters

- `format` (enum, optional): `vcard` or `csv`. One of `vcard`, `csv`. Default `vcard`.
- `photos` (boolean, optional): Inline each photo in a vCard. Default `true`.

### Returns

`data` is an object with:

- `format` (enum): One of `vcard`, `csv`.
- `filename` (string)
- `contentType` (string)
- `count` (number)
- `photosOmitted` (number): Photos left out of the vCard to keep the file a sensible size.
- `text` (string)

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.export({
	format: "csv",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.export({"format": "csv"})
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsExportParams{
		Format: mailset.ContactsExportParamsFormatCSV,
	}
	answer, err := client.Contacts.Export(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.export(format: 'csv')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->export(['format' => 'csv']);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactExport;
import app.mailset.model.ContactsExportParams;
import app.mailset.model.ContactsExportParamsFormat;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsExportParams.builder()
        .format(ContactsExportParamsFormat.CSV)
        .build();
ContactExport answer = mailset.contacts().export(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::{
    ContactsExportParams, ContactsExportParamsFormat,
};

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .export(ContactsExportParams {
        format: Some(ContactsExportParamsFormat::Csv),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.export \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"format":"csv"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts export --format csv
```

### Response

```json
{
  "ok": true,
  "data": {
    "format": "vcard",
    "filename": "text",
    "contentType": "text",
    "count": 12,
    "photosOmitted": 1,
    "text": "text"
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-export)

## contacts.others

People you’ve exchanged mail with and haven’t saved.

`POST /v1/contacts.others`

Any signed-in person, with an API token.

### Parameters

- `limit` (integer, optional): How many people a page holds, 1 to 200. Default `50`. From 1 to 200.
- `after` (string, optional): The `next` of the page before, for the page after it.
- `query` (string, optional): Only people whose name or address has this in it. At most 200 characters.

### Returns

`data` is an object with:

- `people` (array of objects)
  - `email` (string)
  - `name` (string)
  - `count` (number): How many times you’ve exchanged mail with them.
  - `lastAt` (number)
- `next` (nullable string)
- `total` (number)

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.others({
	query: "example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.others({"query": "example.com"})
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsOthersParams{
		Query: mailset.String("example.com"),
	}
	answer, err := client.Contacts.Others(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.others(query: 'example.com')
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->others([
    'query' => 'example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactsOthersParams;
import app.mailset.model.OtherContactPage;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsOthersParams.builder()
        .query("example.com")
        .build();
OtherContactPage answer =
        mailset.contacts().others(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsOthersParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .others(ContactsOthersParams {
        query: Some("example.com".into()),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.others \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"query":"example.com"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts others --query example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "people": [
      {
        "email": "hello@example.com",
        "name": "Acme API",
        "count": 12,
        "lastAt": 1796048940000
      }
    ],
    "next": "eyJhIjoxNzk2MDkyNDQyfQ",
    "total": 12
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-others)

## contacts.forget

Take someone off your other contacts.

`POST /v1/contacts.forget`

Any signed-in person, with an API token.

### Parameters

- `address` (string, required): The person’s address.

### Returns

`data` is an object with:

- `removed` (boolean)

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.forget({
	address: "maria@example.com",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.forget(
    {"address": "maria@example.com"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsForgetParams{
		Address: "maria@example.com",
	}
	answer, err := client.Contacts.Forget(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.forget(
  address: 'maria@example.com'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->forget([
    'address' => 'maria@example.com',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactsForgetParams;
import app.mailset.model.ContactsForgetResult;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsForgetParams.builder()
        .address("maria@example.com")
        .build();
ContactsForgetResult answer =
        mailset.contacts().forget(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsForgetParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .forget(ContactsForgetParams {
        address: "maria@example.com".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.forget \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"address":"maria@example.com"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts forget maria@example.com
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": true
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-forget)

## contacts.photo.set

Set a contact’s photo from a PNG, JPEG or WebP file.

`POST /v1/contacts.photo.set`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The contact’s id.
- `name` (string, required): The photo file’s name. At most 255 characters.
- `data` (string, required): The file, base64.

### Returns

`data` is an object with:

- `id` (string): The contact’s id.
- `picture` (string): A short-lived URL for the photo.

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.photo.set({
	id: "con_4e9a2c7f1b6d3058a3c7e1b9",
	name: "maria.jpg",
	data: "<the message as base64>",
});
console.log(answer);
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.photo.set(
    {
        "id": "con_4e9a2c7f1b6d3058a3c7e1b9",
        "name": "maria.jpg",
        "data": "<the message as base64>",
    }
)
print(answer)
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsPhotoSetParams{
		ID:   "con_4e9a2c7f1b6d3058a3c7e1b9",
		Name: "maria.jpg",
		Data: "<the message as base64>",
	}
	answer, err := client.Contacts.Photo.Set(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.photo.set(
  id: 'con_4e9a2c7f1b6d3058a3c7e1b9',
  name: 'maria.jpg',
  data: '<the message as base64>'
)
p answer
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->photo->set([
    'id' => 'con_4e9a2c7f1b6d3058a3c7e1b9',
    'name' => 'maria.jpg',
    'data' => '<the message as base64>',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactsPhotoSetParams;
import app.mailset.model.ContactsPhotoSetResult;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsPhotoSetParams.builder()
        .id("con_4e9a2c7f1b6d3058a3c7e1b9")
        .name("maria.jpg")
        .data("<the message as base64>")
        .build();
ContactsPhotoSetResult answer =
        mailset.contacts().photo().set(params);
System.out.println(answer);
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

Rust:

```rust
use mailset::types::ContactsPhotoSetParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .photo()
    .set(ContactsPhotoSetParams {
        id: "con_4e9a2c7f1b6d3058a3c7e1b9".into(),
        name: "maria.jpg".into(),
        data: "<the message as base64>".into(),
    })
    .await?;
println!("{answer:?}");
```

`<the message as base64>` is a whole email, headers and body: [Send your own MIME](https://mailset.app/docs/recipes/mime).

curl:

```bash
curl https://mailset.app/v1/contacts.photo.set \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"con_4e9a2c7f1b6d3058a3c7e1b9","name":"maria.jpg","data":"<base64 of the file>"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts photo set con_4e9a2c7f1b6d3058a3c7e1b9 --file maria.jpg
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "picture": "text"
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-photo-set)

## contacts.photo.remove

Remove a contact’s photo.

`POST /v1/contacts.photo.remove`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The contact’s id.

### Returns

`data` is an object with:

- `removed` (boolean)

### Request

TypeScript:

```typescript
import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.contacts.photo.remove({
	id: "con_4e9a2c7f1b6d3058a3c7e1b9",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.contacts.photo.remove(
    {"id": "con_4e9a2c7f1b6d3058a3c7e1b9"}
)
print(answer)
```

Go:

```go
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.ContactsPhotoRemoveParams{
		ID: "con_4e9a2c7f1b6d3058a3c7e1b9",
	}
	answer, err := client.Contacts.Photo.Remove(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
```

Ruby:

```ruby
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.contacts.photo.remove(
  id: 'con_4e9a2c7f1b6d3058a3c7e1b9'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->contacts->photo->remove([
    'id' => 'con_4e9a2c7f1b6d3058a3c7e1b9',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.ContactsPhotoRemoveParams;
import app.mailset.model.ContactsPhotoRemoveResult;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = ContactsPhotoRemoveParams.builder()
        .id("con_4e9a2c7f1b6d3058a3c7e1b9")
        .build();
ContactsPhotoRemoveResult answer =
        mailset.contacts().photo().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::ContactsPhotoRemoveParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .contacts()
    .photo()
    .remove(ContactsPhotoRemoveParams {
        id: "con_4e9a2c7f1b6d3058a3c7e1b9".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/contacts.photo.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"con_4e9a2c7f1b6d3058a3c7e1b9"}}'
```

curl can’t sign a request. `$TOKEN` is your credential’s token, and `$MS_TIME` and `$MS_PROOF` sign this exact body: [Calling the API without an SDK](https://mailset.app/docs/authentication/http) shows how.

CLI:

```bash
mailset contacts photo remove con_4e9a2c7f1b6d3058a3c7e1b9
```

### Response

```json
{
  "ok": true,
  "data": {
    "removed": true
  }
}
```

In the CLI: [mailset reference](https://mailset.app/docs/cli/contacts#contacts-photo-remove)

---

© 2026 Intenseloop, Inc. Mailset’s site, docs and guides are copyrighted. You may read them and use their code to build with Mailset. Don’t republish them or use them to build a copy of Mailset. Terms: https://mailset.app/terms#content