> For the complete documentation index, see [llms.txt](https://docs.mailofly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailofly.com/rest-api/accounts.md).

# Accounts

Manage SMTP and Google sending identities. List and get responses never include passwords or OAuth tokens.

## GET `/api/v1/accounts`

**List accounts**

Returns all sending identities for the authenticated user, newest first. Passwords and OAuth tokens are never included.

### Response fields

* **data** (`Account[]`) — Public account fields only (no secrets).

### Examples

#### 200 — OK

```json
{
  "data": [
    {
      "id": "uuid",
      "name": "Transactional",
      "provider_type": "smtp",
      "daily_mail_limit": 500
    }
  ]
}
```

### cURL

```bash
curl -sS -X GET "https://www.mailofly.com/api/v1/accounts" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## POST `/api/v1/accounts`

**Create account**

Create an SMTP or Google sending account. For SMTP, send smtp\_host, smtp\_port, smtp\_username, smtp\_password. For Google, send google\_access\_token and google\_refresh\_token (and usually google\_email).

### Request body — Body — SMTP

Omit smtp\_password on PATCH to keep the current password.

```json
{
  "name": "Transactional",
  "provider_type": "smtp",
  "daily_mail_limit": 500,
  "smtp_host": "smtp.example.com",
  "smtp_port": 587,
  "smtp_username": "user",
  "smtp_password": "secret"
}
```

### Response fields

* **data** (`Account`) — Created row.

### Examples

#### 201 — Created

```json
{
  "data": { "id": "uuid", "name": "Transactional", "provider_type": "smtp" }
}
```

#### 400 — Validation

```json
{ "error": "…", "message": "…" }
```

### cURL

```bash
curl -sS -X POST "https://www.mailofly.com/api/v1/accounts" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Transactional","provider_type":"smtp","daily_mail_limit":500,"smtp_host":"smtp.example.com","smtp_port":587,"smtp_username":"user","smtp_password":"secret"}'
```

## GET `/api/v1/accounts/{id}`

**Get account**

Fetch one account by id. Returns 404 if the account does not exist or does not belong to you.

### Response fields

* **data** (`Account`) — Public fields only.

### Examples

#### 200 — OK

```json
{ "data": { "id": "uuid", "name": "…" } }
```

#### 404 — Not found

```json
{ "error": "Not found" }
```

### cURL

```bash
curl -sS -X GET "https://www.mailofly.com/api/v1/accounts/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## PATCH `/api/v1/accounts/{id}`

**Update account**

Partial update. Omit smtp\_password to keep the current stored password.

### Request body — Body

```json
{
  "name": "Renamed",
  "daily_mail_limit": 1000
}
```

### Examples

#### 200 — OK

```json
{ "data": { … } }
```

#### 404 — Not found

```json
{ "error": "Not found" }
```

### cURL

```bash
curl -sS -X PATCH "https://www.mailofly.com/api/v1/accounts/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"name":"Renamed","daily_mail_limit":1000}'
```

## DELETE `/api/v1/accounts/{id}`

**Delete account**

Deletes the sending identity. Does not revoke Google tokens server-side beyond removing the row.

### Examples

#### 200 — OK

```json
{ "ok": true }
```

#### 404 — Not found

```json
{ "error": "Not found" }
```

### cURL

```bash
curl -sS -X DELETE "https://www.mailofly.com/api/v1/accounts/00000000-0000-0000-0000-000000000001" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer mf_live_your_key_here"
```

## Related

* [Product guide: Accounts](/product-guides/accounts.md)
* [← API overview](/rest-api/api.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mailofly.com/rest-api/accounts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
