---
title: "Update an SMTP/IMAP mailbox"
method: PATCH
path: "/email-providers/{providerId}"
tags: ["Email providers"]
---

# Update an SMTP/IMAP mailbox

`PATCH /email-providers/{providerId}`

## Request

- Base URL: `https://api.emelia.io`
- URL: `https://api.emelia.io/email-providers/{providerId}`
- Auth: API key in header `Authorization`

Updates the credentials of an SMTP or Google IMAP mailbox, retests them and marks the mailbox as connected again. Masked passwords (`********`) are replaced by the stored values before the test.

## Path parameters

- `providerId` string, required: MongoDB ObjectId: 24 hexadecimal characters.

## Request body

- EmailProviderInput: SMTP and IMAP credentials of the mailbox. The credentials are tested before saving. For Google and Microsoft accounts prefer the OAuth connection in the app.
  - `senderName` string
  - `senderEmail` string, email, required
  - `senderPassword` string: Used when `smtp.password` is empty.
  - `emailType` 'GOOGLE' | 'OFFICE' | 'EXCHANGE' | 'SMTP' | 'GOOGLEIMAP', required
  - `smtp` object
    - `login` string
    - `password` string
    - `server` string, required
    - `port` integer, required
    - `ssl` boolean
  - `imap` object
    - `login` string
    - `password` string
    - `server` string, required
    - `port` integer, required
    - `ssl` boolean
  - `signature` string
  - `domainName` string: Optional custom tracking domain to attach.

## Response `200`

Success.

- object
  - `success` unknown
  - `id` string: MongoDB ObjectId: 24 hexadecimal characters.

## Other responses

- `400`: Invalid request.
- `401`: Missing, malformed, unknown or disabled API key. The key must be exactly 48 characters, otherwise it is treated as a session token and rejected the same way.
- `500`: Unexpected error. IMPORTANT: this is also what you receive today when the per minute quota of your account is exceeded (the quota error is not mapped to 429 for API keys). No `Retry-After` header is sent. Wait until the next minute window before retrying.

---

[API](https://skmtc.dev/emelia/apis/emelia-api.md) · [All operations](https://skmtc.dev/emelia/apis/emelia-api/llms.txt) · [OpenAPI document](https://skmtc.dev/emelia/apis/emelia-api/revisions/8c0cb435f2c4?raw)
