---
title: "Save the agency SMTP configuration. The password arrives in clear text and is stored encrypted"
method: PUT
path: "/v2/agency-CK/{agencyId}/smtp-configuration"
tags: ["Agency Customization Kit Api Service"]
---

# Save the agency SMTP configuration. The password arrives in clear text and is stored encrypted

`PUT /v2/agency-CK/{agencyId}/smtp-configuration`

## Request

- Base URL: `https://app.metricool.com/api`
- URL: `https://app.metricool.com/api/v2/agency-CK/{agencyId}/smtp-configuration`
- Auth: none declared

## Path parameters

- `agencyId` integer, required

## Request body

- AgencySmtpConfigurationUpdateDto: Agency SMTP configuration to save
  - `enabled` boolean, required: true to send with the agency SMTP (settings required), false to go back to the Metricool server keeping the stored configuration
  - `settings` AgencySmtpSettingsDto: SMTP server values filled in the form. Authentication is always on; ports 465 and 2465 use implicit SSL and any other port mandatory STARTTLS
    - `host` string, required: Outgoing mail server, without protocol
    - `port` integer, required: Server port: 25, 465, 587, 2465, 2525 or 2587
    - `user` string, required: Authentication user
    - `password` string: Password or API key in clear text. Empty keeps the stored one
    - `from` string, required: Sender email
    - `fromLabel` string: Sender name. When empty, the agency name is used
  - `provider` 'GOOGLE' | 'MICROSOFT' | 'AMAZON_SES' | 'SENDGRID' | 'MAILGUN' | 'BREVO' | 'OTHER': Provider preset chosen in the form, for analytics only

## Response `200`

Ok

- JsonOkResponseAgencySmtpConfigurationDto
  - `metadata` object
  - `page` JsonPaging
    - `next` string
  - `data` AgencySmtpConfigurationDto: Agency custom SMTP configuration. The password is never returned.
    - `enabled` boolean: Whether emails are sent with the agency SMTP (true) or the Metricool server (false)
    - `configured` boolean: Whether a custom SMTP configuration is stored, even if disabled
    - `host` string: Outgoing mail server, without protocol
    - `port` integer: Server port. 465 and 2465 use implicit SSL, any other port mandatory STARTTLS
    - `user` string: Authentication user
    - `hasPassword` boolean: Whether a password is stored (shown as a placeholder in the form)
    - `from` string: Sender email
    - `fromLabel` string: Sender name. When empty, the agency name is used
    - `status` AgencySmtpStatusDto: Last failure of the agency SMTP when sending a real email
      - `errorType` 'HOST_NOT_FOUND' | 'CONNECTION' | 'ENCRYPTION' | 'AUTHENTICATION' | 'SENDER_REJECTED' | 'OTHER': Error type
      - `detail` string: Technical message returned by the server, to share with support
      - `lastFailureAt` string, date-time: Date of the last failure (UTC)

## Other responses

- `400`: Invalid SMTP configuration, or the agency sends through Amazon SES
- `403`: The user cannot manage the agency configuration

---

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