# Drafts

Save a draft, attach files, and throw one away.

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 Draft object

A message being written: its addresses, its words and its files.

### Attributes

- `id` (string): The draft’s id.
- `mailbox` (string): The mailbox it would be sent from.
- `from` (string): The From address: the mailbox’s own or one of its aliases.
- `to` (string): The To addresses, as typed.
- `cc` (string): The Cc addresses, as typed.
- `bcc` (string): The Bcc addresses, as typed.
- `subject` (string): Its subject.
- `text` (string): Its text.
- `threadId` (nullable string): The conversation it answers, or null for a new one.
- `updatedAt` (number): When it was last saved, in milliseconds since 1970.
- `files` (array of objects): Its files.
  - `id` (string): The file’s id.
  - `name` (string): Its file name.
  - `contentType` (string): Its media type.
  - `size` (number): Its size in bytes.
  - `scan` (enum): What the virus scan said. One of `clean`, `infected`, `unscanned`.
- `markdown` (boolean): The text carries formatting marks, so it goes out formatted.

```json
{
  "id": "out_3f9a1c0e7b2d",
  "mailbox": "text",
  "from": "hello@example.com",
  "to": "ana@example.com",
  "cc": "text",
  "bcc": "text",
  "subject": "Your Acme receipt",
  "text": "text",
  "threadId": "out_3f9a1c0e7b2d",
  "updatedAt": 1796048940000,
  "files": [
    {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "contentType": "text",
      "size": 20480,
      "scan": "clean"
    }
  ],
  "markdown": true
}
```

Answered by [drafts.save](https://mailset.app/docs/api/drafts#drafts.save), [drafts.list](https://mailset.app/docs/api/drafts#drafts.list).

## drafts.save

Save a draft, new or by id.

`POST /v1/drafts.save`

Any signed-in person, with an API token.

### Parameters

- `id` (string, optional): The draft to change. Left out: a new draft.
- `from` (string, required): One of your addresses.
- `to` (string, optional): Who it goes to, as typed: addresses with commas between them. At most 10,000 characters.
- `cc` (string, optional): Who gets a copy, as typed. At most 10,000 characters.
- `bcc` (string, optional): Who gets a hidden copy, as typed. At most 10,000 characters.
- `subject` (string, optional): The subject, on one line. At most 998 characters.
- `text` (string, optional): The draft’s text. At most 1,000,000 characters.
- `threadId` (string, optional): The conversation it answers.
- `markdown` (boolean, optional): `text` has Markdown to send as formatting. Default `false`.

### Returns

`data` is the [Draft object](https://mailset.app/docs/api/drafts#draft).

### Request

TypeScript:

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

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

const answer = await mailset.drafts.save({
	from: "ana@example.com",
	to: "maria@example.com",
	subject: "Quote for March",
	text: "Hi Maria, the quote is attached.",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.drafts.save(
    {
        "from": "ana@example.com",
        "to": "maria@example.com",
        "subject": "Quote for March",
        "text": "Hi Maria, the quote is attached.",
    }
)
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.DraftsSaveParams{
		From:    "ana@example.com",
		To:      mailset.String("maria@example.com"),
		Subject: mailset.String("Quote for March"),
		Text: mailset.String("Hi Maria, the quote is " +
			"attached."),
	}
	answer, err := client.Drafts.Save(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.drafts.save(
  from: 'ana@example.com',
  to: 'maria@example.com',
  subject: 'Quote for March',
  text: 'Hi Maria, the quote is attached.'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->drafts->save([
    'from' => 'ana@example.com',
    'to' => 'maria@example.com',
    'subject' => 'Quote for March',
    'text' => 'Hi Maria, the quote is attached.',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.Draft;
import app.mailset.model.DraftsSaveParams;

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

var params = DraftsSaveParams.builder()
        .from("ana@example.com")
        .to("maria@example.com")
        .subject("Quote for March")
        .text("Hi Maria, the quote is attached.")
        .build();
Draft answer = mailset.drafts().save(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DraftsSaveParams;

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

let answer = mailset
    .drafts()
    .save(DraftsSaveParams {
        from: "ana@example.com".into(),
        to: Some("maria@example.com".into()),
        subject: Some("Quote for March".into()),
        text: Some(
            "Hi Maria, the quote is attached.".into(),
        ),
        ..Default::default()
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/drafts.save \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"from":"ana@example.com","to":"maria@example.com","subject":"Quote for March","text":"Hi Maria, the quote is attached."}}'
```

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 drafts save --from ana@example.com --to maria@example.com --subject "Quote for March" --text "Hi Maria, the quote is attached."
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "mailbox": "text",
    "from": "hello@example.com",
    "to": "ana@example.com",
    "cc": "text",
    "bcc": "text",
    "subject": "Your Acme receipt",
    "text": "text",
    "threadId": "out_3f9a1c0e7b2d",
    "updatedAt": 1796048940000,
    "files": [
      {
        "id": "out_3f9a1c0e7b2d",
        "name": "Acme API",
        "contentType": "text",
        "size": 20480,
        "scan": "clean"
      }
    ],
    "markdown": true
  }
}
```

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

## drafts.list

List your drafts.

`POST /v1/drafts.list`

Any signed-in person, with an API token.

### Parameters

It takes no input: send an empty object.

### Returns

`data` is a list of [Draft objects](https://mailset.app/docs/api/drafts#draft).

### Request

TypeScript:

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

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

const answer = await mailset.drafts.list();
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.drafts.list()
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.Drafts.List(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.drafts.list
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->drafts->list();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

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

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

List<Draft> answer = mailset.drafts().list();
System.out.println(answer);
```

Rust:

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

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

curl:

```bash
curl https://mailset.app/v1/drafts.list \
  -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 drafts list
```

### Response

```json
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "mailbox": "text",
      "from": "hello@example.com",
      "to": "ana@example.com",
      "cc": "text",
      "bcc": "text",
      "subject": "Your Acme receipt",
      "text": "text",
      "threadId": "out_3f9a1c0e7b2d",
      "updatedAt": 1796048940000,
      "files": [
        {
          "id": "out_3f9a1c0e7b2d",
          "name": "Acme API",
          "contentType": "text",
          "size": 20480,
          "scan": "clean"
        }
      ],
      "markdown": true
    }
  ]
}
```

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

## drafts.remove

Throw a draft away.

`POST /v1/drafts.remove`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The draft’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.drafts.remove({
	id: "dr_7a4f2e9c1b6d3058e2c9a4f1",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.drafts.remove(
    {"id": "dr_7a4f2e9c1b6d3058e2c9a4f1"}
)
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.DraftsRemoveParams{
		ID: "dr_7a4f2e9c1b6d3058e2c9a4f1",
	}
	answer, err := client.Drafts.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.drafts.remove(
  id: 'dr_7a4f2e9c1b6d3058e2c9a4f1'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

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

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DraftsRemoveParams;
import app.mailset.model.DraftsRemoveResult;

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

var params = DraftsRemoveParams.builder()
        .id("dr_7a4f2e9c1b6d3058e2c9a4f1")
        .build();
DraftsRemoveResult answer =
        mailset.drafts().remove(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DraftsRemoveParams;

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

let answer = mailset
    .drafts()
    .remove(DraftsRemoveParams {
        id: "dr_7a4f2e9c1b6d3058e2c9a4f1".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 drafts remove dr_7a4f2e9c1b6d3058e2c9a4f1
```

### Response

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

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

## drafts.attach

Attach a file to a draft.

`POST /v1/drafts.attach`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The draft’s id.
- `name` (string, required): The file’s name. At most 255 characters.
- `contentType` (string, optional): Its media type. Default `application/octet-stream`. At most 120 characters.
- `data` (string, required): The file, base64.

### Returns

`data` is an object with:

- `id` (string): The file’s id.
- `name` (string): Its file name.
- `contentType` (string): Its media type.
- `size` (number): Its size in bytes.
- `scan` (enum): What the virus scan said. One of `clean`, `infected`, `unscanned`.

### Request

TypeScript:

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

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

const answer = await mailset.drafts.attach({
	contentType: "application/pdf",
	id: "dr_7a4f2e9c1b6d3058e2c9a4f1",
	name: "quote.pdf",
	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.drafts.attach(
    {
        "content_type": "application/pdf",
        "id": "dr_7a4f2e9c1b6d3058e2c9a4f1",
        "name": "quote.pdf",
        "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.DraftsAttachParams{
		ContentType: mailset.String("application/pdf"),
		ID:          "dr_7a4f2e9c1b6d3058e2c9a4f1",
		Name:        "quote.pdf",
		Data:        "<the message as base64>",
	}
	answer, err := client.Drafts.Attach(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.drafts.attach(
  content_type: 'application/pdf',
  id: 'dr_7a4f2e9c1b6d3058e2c9a4f1',
  name: 'quote.pdf',
  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->drafts->attach([
    'contentType' => 'application/pdf',
    'id' => 'dr_7a4f2e9c1b6d3058e2c9a4f1',
    'name' => 'quote.pdf',
    '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.DraftFile;
import app.mailset.model.DraftsAttachParams;

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

var params = DraftsAttachParams.builder()
        .contentType("application/pdf")
        .id("dr_7a4f2e9c1b6d3058e2c9a4f1")
        .name("quote.pdf")
        .data("<the message as base64>")
        .build();
DraftFile answer = mailset.drafts().attach(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::DraftsAttachParams;

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

let answer = mailset
    .drafts()
    .attach(DraftsAttachParams {
        id: "dr_7a4f2e9c1b6d3058e2c9a4f1".into(),
        name: "quote.pdf".into(),
        content_type: Some("application/pdf".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/drafts.attach \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"contentType":"application/pdf","id":"dr_7a4f2e9c1b6d3058e2c9a4f1","name":"quote.pdf","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 drafts attach dr_7a4f2e9c1b6d3058e2c9a4f1 --file quote.pdf --content-type application/pdf
```

### Response

```json
{
  "ok": true,
  "data": {
    "id": "out_3f9a1c0e7b2d",
    "name": "Acme API",
    "contentType": "text",
    "size": 20480,
    "scan": "clean"
  }
}
```

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

## drafts.detach

Take a file off a draft.

`POST /v1/drafts.detach`

Any signed-in person, with an API token.

### Parameters

- `file` (string, required): The attached file’s id, from the draft’s `files`.

### 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.drafts.detach({
	file: "att_3c9e1f7a5b2d4086c7e1a9f2",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.drafts.detach(
    {"file": "att_3c9e1f7a5b2d4086c7e1a9f2"}
)
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.DraftsDetachParams{
		File: "att_3c9e1f7a5b2d4086c7e1a9f2",
	}
	answer, err := client.Drafts.Detach(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.drafts.detach(
  file: 'att_3c9e1f7a5b2d4086c7e1a9f2'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->drafts->detach([
    'file' => 'att_3c9e1f7a5b2d4086c7e1a9f2',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DraftsDetachParams;
import app.mailset.model.DraftsDetachResult;

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

var params = DraftsDetachParams.builder()
        .file("att_3c9e1f7a5b2d4086c7e1a9f2")
        .build();
DraftsDetachResult answer =
        mailset.drafts().detach(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DraftsDetachParams;

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

let answer = mailset
    .drafts()
    .detach(DraftsDetachParams {
        file: "att_3c9e1f7a5b2d4086c7e1a9f2".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

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

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 drafts detach att_3c9e1f7a5b2d4086c7e1a9f2
```

### Response

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

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

## drafts.forward

Copy a message’s attachments onto a draft.

`POST /v1/drafts.forward`

Any signed-in person, with an API token.

### Parameters

- `id` (string, required): The draft’s id.
- `messageId` (string, required): The message whose attachments are copied.

### Returns

`data` is an object with:

- `files` (array of objects): The files now on the draft from that message.
  - `id` (string): The file’s id.
  - `name` (string): Its file name.
  - `contentType` (string): Its media type.
  - `size` (number): Its size in bytes.
  - `scan` (enum): What the virus scan said. One of `clean`, `infected`, `unscanned`.
- `skipped` (number): How many didn’t fit, or can’t be sent on.

### Request

TypeScript:

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

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

const answer = await mailset.drafts.forward({
	messageId: "msg_91b7e4c2a6f03d58b1c4e7a9",
	id: "dr_7a4f2e9c1b6d3058e2c9a4f1",
});
console.log(answer);
```

Python:

```python
from mailset import Mailset

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

answer = mailset.drafts.forward(
    {
        "message_id": "msg_91b7e4c2a6f03d58b1c4e7a9",
        "id": "dr_7a4f2e9c1b6d3058e2c9a4f1",
    }
)
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.DraftsForwardParams{
		MessageID: "msg_91b7e4c2a6f03d58b1c4e7a9",
		ID:        "dr_7a4f2e9c1b6d3058e2c9a4f1",
	}
	answer, err := client.Drafts.Forward(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.drafts.forward(
  message_id: 'msg_91b7e4c2a6f03d58b1c4e7a9',
  id: 'dr_7a4f2e9c1b6d3058e2c9a4f1'
)
p answer
```

PHP:

```php
<?php

require 'vendor/autoload.php';

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

$answer = $mailset->drafts->forward([
    'messageId' => 'msg_91b7e4c2a6f03d58b1c4e7a9',
    'id' => 'dr_7a4f2e9c1b6d3058e2c9a4f1',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
```

Java:

```java
import app.mailset.Mailset;
import app.mailset.model.DraftsForwardParams;
import app.mailset.model.DraftsForwardResult;

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

var params = DraftsForwardParams.builder()
        .messageId("msg_91b7e4c2a6f03d58b1c4e7a9")
        .id("dr_7a4f2e9c1b6d3058e2c9a4f1")
        .build();
DraftsForwardResult answer =
        mailset.drafts().forward(params);
System.out.println(answer);
```

Rust:

```rust
use mailset::types::DraftsForwardParams;

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

let answer = mailset
    .drafts()
    .forward(DraftsForwardParams {
        id: "dr_7a4f2e9c1b6d3058e2c9a4f1".into(),
        message_id: "msg_91b7e4c2a6f03d58b1c4e7a9".into(),
    })
    .await?;
println!("{answer:?}");
```

curl:

```bash
curl https://mailset.app/v1/drafts.forward \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"messageId":"msg_91b7e4c2a6f03d58b1c4e7a9","id":"dr_7a4f2e9c1b6d3058e2c9a4f1"}}'
```

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 drafts forward dr_7a4f2e9c1b6d3058e2c9a4f1 --message-id msg_91b7e4c2a6f03d58b1c4e7a9
```

### Response

```json
{
  "ok": true,
  "data": {
    "files": [
      {
        "id": "out_3f9a1c0e7b2d",
        "name": "Acme API",
        "contentType": "text",
        "size": 20480,
        "scan": "clean"
      }
    ],
    "skipped": 1
  }
}
```

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

---

© 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