# Mail

OpenAPI spec: [https://api.payweave.app/app/app_n885eg97q5gcnai80k8x8xwi/openapi.json](https://api.payweave.app/app/app_n885eg97q5gcnai80k8x8xwi/openapi.json)

## Networks

| Name | CAIP-2 | Chain ID / Cluster | Protocols |
|---|---|---|---|
| Tempo Mainnet | `eip155:4217` | 4217 | mpp |
| Solana Mainnet | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | mainnet-beta | mpp, x402 |
| Base | `eip155:8453` | 8453 | x402 |

## Accepted Currencies

| Symbol | Name | Decimals | Network | Address | Protocols |
|---|---|---|---|---|---|
| USDC.e | Bridged USDC (Stargate) | 6 | `eip155:4217` | `0x20c000000000000000000000b9537d11c60e8b50` | mpp |
| USDC | USD Coin (Solana) | 6 | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | mpp, x402 |
| USDC | USD Coin | 6 | `eip155:8453` | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` | x402 |

## Endpoints (9)

### Email: List Inboxes

Free (identity-only) list of every inbox owned by the paying wallet, across all TTL tiers (random + vanity). Sign the $0 challenge to prove wallet ownership; no charge.

- Method: GET
- Path: `/inboxes`
- Price: $0.00000000

**Input Schema**

```json
{
  "anyOf": [
    {
      "not": {}
    },
    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  ]
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "inboxes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "address": {
            "type": "string"
          },
          "ttl_days": {
            "type": "integer"
          },
          "expires_at": {
            "type": "string"
          },
          "webhook_configured": {
            "type": "boolean"
          }
        },
        "required": [
          "slug",
          "address",
          "ttl_days",
          "expires_at",
          "webhook_configured"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "inboxes"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes" -H 'Content-Type: application/json' -d '{}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes" --json '{}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes" -H 'Content-Type: application/json' -d '{}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes" -m GET -b '{}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes" -m GET -b '{}' -p x402
```

### Email: Create Inbox

Create a disposable email inbox. Returns an address you can publish anywhere and read messages from via this API. TTL tier (1 / 7 / 30 / 90 days, default 30) drives both price ($0.002–$0.020 USDC) and inbox lifetime — R2 lifecycle deletes the inbox and its messages at expiry. Optional `local_part` reserves a globally-unique vanity address (`<local_part>@<EMAIL_DOMAIN>`, 30/90-day TTL, flat $0.10) — call the free `GET /inboxes/available?local_part=…` first to confirm it is free (if taken, create refunds and returns 409). Optional `webhook_url` fires HMAC-signed POSTs on every new inbound message. The returned `webhook_secret` is shown exactly once; store it to verify webhook signatures.

- Method: POST
- Path: `/inboxes`
- Price: $0.00200000
- Content-Type: application/json

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "ttl_days": {
      "type": "number",
      "enum": [
        1,
        7,
        30,
        90
      ]
    },
    "webhook_url": {
      "type": "string",
      "format": "uri"
    },
    "local_part": {
      "type": "string",
      "minLength": 3,
      "maxLength": 32
    },
    "display_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    }
  },
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "address": {
      "type": "string",
      "format": "email",
      "description": "Disposable email address. Receive mail here."
    },
    "slug": {
      "type": "string",
      "description": "Inbox slug. Use in list/get/send route paths."
    },
    "ttl_days": {
      "type": "integer",
      "description": "TTL tier: 1, 7, 30, or 90."
    },
    "expires_at": {
      "type": "string",
      "description": "ISO-8601. R2 lifecycle deletes the inbox and its messages at this time."
    },
    "display_name": {
      "type": "string",
      "description": "Friendly From display name, when set. Default sender name on send."
    },
    "webhook_url": {
      "type": "string",
      "format": "uri"
    },
    "webhook_secret": {
      "type": "string",
      "description": "Returned only when a webhook is configured. Save it now — used to verify HMAC on incoming webhook POSTs. Never returned again."
    }
  },
  "required": [
    "address",
    "slug",
    "ttl_days",
    "expires_at"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "ttl_days": 1,
    "webhook_url": "https://example.com",
    "local_part": ""
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "ttl_days": 1,
    "webhook_url": "https://example.com",
    "local_part": ""
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes" -X POST -H 'Content-Type: application/json' -d '{"ttl_days":1,"webhook_url":"https://example.com","local_part":""}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes" -X POST --json '{"ttl_days":1,"webhook_url":"https://example.com","local_part":""}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes" -X POST -H 'Content-Type: application/json' -d '{"ttl_days":1,"webhook_url":"https://example.com","local_part":""}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes" -m POST -b '{"ttl_days":1,"webhook_url":"https://example.com","local_part":""}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "ttl_days": 1,
    "webhook_url": "https://example.com",
    "local_part": ""
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes" -m POST -b '{"ttl_days":1,"webhook_url":"https://example.com","local_part":""}' -p x402
```

### Email: Extend Inbox

Renew an inbox for another full TTL period, keeping the same address and tier. Resets the expiry to now + ttl_days and keeps existing messages alive. Wallet must own the inbox.

- Method: POST
- Path: `/inboxes/:slug/extend`
- Price: $0.00200000
- Content-Type: application/json

**Input Schema**

```json
{
  "anyOf": [
    {
      "not": {}
    },
    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  ]
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "slug": {
      "type": "string"
    },
    "ttl_days": {
      "type": "integer"
    },
    "expires_at": {
      "type": "string",
      "description": "New expiry after renewal (now + ttl_days)."
    }
  },
  "required": [
    "slug",
    "ttl_days",
    "expires_at"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/extend', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/extend', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/extend" -X POST -H 'Content-Type: application/json' -d '{}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/extend" -X POST --json '{}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/extend" -X POST -H 'Content-Type: application/json' -d '{}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/extend" -m POST -b '{}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/extend', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/extend" -m POST -b '{}' -p x402
```

### Email: List Messages

List the messages received by one of your inboxes. Wallet-scoped: 404 if the inbox is not owned by the paying wallet.

- Method: GET
- Path: `/inboxes/:slug/messages`
- Price: $0.00100000

**Input Schema**

```json
{
  "anyOf": [
    {
      "not": {}
    },
    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  ]
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "received_at": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 0
          }
        },
        "required": [
          "id",
          "from",
          "subject",
          "received_at",
          "size"
        ],
        "additionalProperties": false
      }
    },
    "cursor": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "messages",
    "cursor"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/messages', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/messages', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/messages" -H 'Content-Type: application/json' -d '{}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/messages" --json '{}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/messages" -H 'Content-Type: application/json' -d '{}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/messages" -m GET -b '{}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/messages', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/messages" -m GET -b '{}' -p x402
```

### Email: Read Message

Read a single message — parsed headers, text, html, and signed-once URLs to attachment bodies. Wallet-scoped: 404 if the inbox is not owned by the paying wallet.

- Method: GET
- Path: `/inboxes/:slug/messages/:id`
- Price: $0.00100000

**Input Schema**

```json
{
  "anyOf": [
    {
      "not": {}
    },
    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  ]
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "slug": {
      "type": "string"
    },
    "received_at": {
      "type": "string"
    },
    "message_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "from": {
      "type": [
        "string",
        "null"
      ]
    },
    "to": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "cc": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "subject": {
      "type": [
        "string",
        "null"
      ]
    },
    "date": {
      "type": [
        "string",
        "null"
      ]
    },
    "text": {
      "type": [
        "string",
        "null"
      ]
    },
    "html": {
      "type": [
        "string",
        "null"
      ]
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "attachments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "filename": {
            "type": "string"
          },
          "content_type": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "url": {
            "type": "string",
            "description": "Short-lived (1-hour) signed download URL for the attachment body. Fetch with a plain GET — no payment required."
          }
        },
        "required": [
          "filename",
          "content_type",
          "size",
          "url"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "id",
    "slug",
    "received_at",
    "message_id",
    "from",
    "to",
    "cc",
    "subject",
    "date",
    "text",
    "html",
    "headers",
    "attachments"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/messages/:id', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/messages/:id', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/messages/:id" -H 'Content-Type: application/json' -d '{}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/messages/:id" --json '{}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/messages/:id" -H 'Content-Type: application/json' -d '{}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/messages/:id" -m GET -b '{}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/messages/:id', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/messages/:id" -m GET -b '{}' -p x402
```

### Email: Delete Message

Free (identity-only) delete of a single message and its attachments. Sign the $0 challenge to prove wallet ownership; no charge. 404 if the inbox/message is not owned by the caller.

- Method: POST
- Path: `/inboxes/:slug/messages/:id/delete`
- Price: $0.00000000
- Content-Type: application/json

**Input Schema**

```json
{
  "anyOf": [
    {
      "not": {}
    },
    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  ]
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "deleted": {
      "type": "boolean"
    }
  },
  "required": [
    "deleted"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/messages/:id/delete', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/messages/:id/delete', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/messages/:id/delete" -X POST -H 'Content-Type: application/json' -d '{}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/messages/:id/delete" -X POST --json '{}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/messages/:id/delete" -X POST -H 'Content-Type: application/json' -d '{}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/messages/:id/delete" -m POST -b '{}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/messages/:id/delete', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/messages/:id/delete" -m POST -b '{}' -p x402
```

### Email: Send

Send an email from one of your inboxes via Cloudflare Email Service. The `from` is locked to the inbox's own address (`<slug>@<EMAIL_DOMAIN>`); the wallet must own the slug. Sends multipart/alternative (a plain-text part is auto-derived from `html` when omitted) and attaches a one-click `List-Unsubscribe` header — recipients who unsubscribe are dropped from future sends. Set a friendly From name via the inbox `display_name` or per-message `from_name`. Upstream cost: $0.00035 per send (5.7× margin at $0.002). Requires the sender domain to be verified in the Cloudflare dashboard.

- Method: POST
- Path: `/inboxes/:slug/send`
- Price: $0.00200000
- Content-Type: application/json

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "to": {
      "anyOf": [
        {
          "type": "string",
          "format": "email"
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "format": "email"
          },
          "minItems": 1,
          "maxItems": 50
        }
      ]
    },
    "cc": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "email"
      },
      "maxItems": 50
    },
    "bcc": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "email"
      },
      "maxItems": 50
    },
    "reply_to": {
      "type": "string",
      "format": "email"
    },
    "from_name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "subject": {
      "type": "string",
      "minLength": 1,
      "maxLength": 998
    },
    "text": {
      "type": "string",
      "maxLength": 1048576
    },
    "html": {
      "type": "string",
      "maxLength": 1048576
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "required": [
    "to",
    "subject"
  ],
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "message_id": {
      "type": "string"
    },
    "accepted_at": {
      "type": "string"
    },
    "skipped": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Recipients dropped because they previously unsubscribed from this inbox."
    }
  },
  "required": [
    "message_id",
    "accepted_at"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "to": "user@example.com",
    "subject": "",
    "cc": [
      "user@example.com"
    ]
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "to": "user@example.com",
    "subject": "",
    "cc": [
      "user@example.com"
    ]
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/send" -X POST -H 'Content-Type: application/json' -d '{"to":"user@example.com","subject":"","cc":["user@example.com"]}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/send" -X POST --json '{"to":"user@example.com","subject":"","cc":["user@example.com"]}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/send" -X POST -H 'Content-Type: application/json' -d '{"to":"user@example.com","subject":"","cc":["user@example.com"]}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/send" -m POST -b '{"to":"user@example.com","subject":"","cc":["user@example.com"]}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "to": "user@example.com",
    "subject": "",
    "cc": [
      "user@example.com"
    ]
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/send" -m POST -b '{"to":"user@example.com","subject":"","cc":["user@example.com"]}' -p x402
```

### Email: Inbox Status

Free (identity-only) inbox status: existence, expiry, message count, and whether a webhook is configured. Sign the $0 challenge to prove wallet ownership; no charge. Use this to poll cheaply instead of paying per list.

- Method: GET
- Path: `/inboxes/:slug/status`
- Price: $0.00000000

**Input Schema**

```json
{
  "anyOf": [
    {
      "not": {}
    },
    {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    }
  ]
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "exists": {
      "type": "boolean"
    },
    "slug": {
      "type": "string"
    },
    "address": {
      "type": "string"
    },
    "ttl_days": {
      "type": "integer"
    },
    "expires_at": {
      "type": "string"
    },
    "message_count": {
      "type": "integer",
      "minimum": 0
    },
    "webhook_configured": {
      "type": "boolean"
    }
  },
  "required": [
    "exists",
    "slug",
    "address",
    "ttl_days",
    "expires_at",
    "message_count",
    "webhook_configured"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/status', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/status', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/status" -H 'Content-Type: application/json' -d '{}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/status" --json '{}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/status" -H 'Content-Type: application/json' -d '{}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/status" -m GET -b '{}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/status', {
  method: 'GET',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({}),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/status" -m GET -b '{}' -p x402
```

### Email: Update Inbox

Free (identity-only) inbox config update. Set/replace `webhook_url` (a fresh `webhook_secret` is returned once) or `display_name` (the From name on outbound mail), or pass null to remove either; omit a field to leave it unchanged. Sign the $0 challenge to prove wallet ownership; no charge.

- Method: POST
- Path: `/inboxes/:slug/update`
- Price: $0.00000000
- Content-Type: application/json

**Input Schema**

```json
{
  "type": "object",
  "properties": {
    "webhook_url": {
      "anyOf": [
        {
          "type": "string",
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "display_name": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "additionalProperties": false
}
```

**Output Schema**

```json
{
  "type": "object",
  "properties": {
    "slug": {
      "type": "string"
    },
    "webhook_url": {
      "anyOf": [
        {
          "type": "string",
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "webhook_secret": {
      "type": "string",
      "description": "Returned once when a new webhook URL is set. Save it to verify HMAC signatures."
    }
  },
  "required": [
    "slug",
    "webhook_url",
    "display_name"
  ],
  "additionalProperties": false
}
```

## How to invoke

Payment is handled automatically — the client signs the 402 challenge and retries.

### TypeScript — Tempo (mppx + fetch) ([docs](https://mpp.dev/sdk/typescript/client))

```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'

Mppx.create({
  methods: [tempo({ account: privateKeyToAccount('0x...') })],
})

const res = await fetch('https://mail.payweave.services/inboxes/:slug/update', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "webhook_url": "https://example.com",
    "display_name": ""
  }),
})
const data = await res.json()
```

### TypeScript — Solana (@solana/mpp + fetch) ([docs](https://github.com/solana-foundation/mpp-sdk))

```ts
import { createKeyPairSignerFromBytes } from '@solana/kit'
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const signer = await createKeyPairSignerFromBytes(/* 64-byte secret key */)
Mppx.create({ methods: [solana({ signer })] })

const res = await fetch('https://mail.payweave.services/inboxes/:slug/update', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "webhook_url": "https://example.com",
    "display_name": ""
  }),
})
const data = await res.json()
```

### mppx CLI ([docs](https://mpp.dev/sdk/typescript/cli))

```sh
npx mppx "https://mail.payweave.services/inboxes/:slug/update" -X POST -H 'Content-Type: application/json' -d '{"webhook_url":"https://example.com","display_name":""}'
```

### Tempo Wallet ([docs](https://docs.tempo.xyz/cli/wallet))

```sh
tempo request "https://mail.payweave.services/inboxes/:slug/update" -X POST --json '{"webhook_url":"https://example.com","display_name":""}'
```

### pay.sh — Solana Foundation ([docs](https://pay.sh))

```sh
pay --mainnet curl "https://mail.payweave.services/inboxes/:slug/update" -X POST -H 'Content-Type: application/json' -d '{"webhook_url":"https://example.com","display_name":""}'
```

### agentcash CLI ([docs](https://www.npmjs.com/package/agentcash))

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/update" -m POST -b '{"webhook_url":"https://example.com","display_name":""}' -p mpp
```

### x402 — Base / Solana USDC (x402-fetch) ([docs](https://x402.org))

```ts
import { wrapFetchWithPayment } from 'x402-fetch'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...') // Base USDC wallet
const fetchWithPay = wrapFetchWithPayment(fetch, account)

const res = await fetchWithPay('https://mail.payweave.services/inboxes/:slug/update', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "webhook_url": "https://example.com",
    "display_name": ""
  }),
})
const data = await res.json()
```

### x402 — agentcash CLI

```sh
npx agentcash fetch "https://mail.payweave.services/inboxes/:slug/update" -m POST -b '{"webhook_url":"https://example.com","display_name":""}' -p x402
```
