> ## Documentation Index
> Fetch the complete documentation index at: https://velt.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Email Config

Use this API to update the email service configuration for a workspace. At least one of `useEmailService` or `emailServiceConfig` must be provided.

> [!NOTE]
>
> This endpoint uses **API-key-level auth**: pass `x-velt-api-key` and `x-velt-auth-token` as headers. You can obtain these from the [Get Auth Tokens](https://velt.dev/docs/api-reference/rest-apis/v2/workspace/authtokens-get.md) endpoint.

> [!NOTE]
>
> **Defaults on first enable.** If you enable the service — either with `useEmailService: true` or by sending `emailServiceConfig.type: "custom"` — and the stored config has no `triggers` yet (defaults are seeded even if `type` / SendGrid fields already exist), defaults are seeded automatically: the service is marked as a custom provider (`type: "custom"`), the standard `comment` triggers and all `huddle` triggers are turned on, and `useEmailService` is set to `true`. Existing non-trigger fields are preserved, and any `emailServiceConfig` values you send in the same request are merged on top of these defaults.

> [!NOTE]
>
> The response `data` echoes the latest post-write state as `{ useEmailService, emailServiceConfig }` — the same shape returned by [Get Email Config](https://velt.dev/docs/api-reference/rest-apis/v2/workspace/emailconfig-get.md). Fields not part of your request fall back to the existing stored values.

# Endpoint

`POST https://api.velt.dev/v2/workspace/emailconfig/update`

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**useEmailService** `boolean`

Whether to enable the email service.

**emailServiceConfig** `object`

Email service configuration object.

**properties**

**type** `string`

Email service provider type. Accepted values: `"default"` or `"sendgrid"`.

**apiKey** `string`

API key for the email service provider.

**fromEmail** `string`

Sender email address.

**fromCompany** `string`

Sender company name.

**triggers** `object`

Event triggers that activate email notifications. Each key is an event type string and the value is a boolean to enable (`true`) or disable (`false`) that trigger. See [Webhooks](https://velt.dev/docs/webhooks/advanced.md) for the full list of event types. Common keys include:

**properties**

**comment\_annotation.add** `boolean`

Trigger when a new comment thread is created.

**comment.add** `boolean`

Trigger when a new comment is added to a thread.

**comment\_annotation.status\_change** `boolean`

Trigger when a thread's status changes (e.g., resolved).

**comment\_annotation.assign** `boolean`

Trigger when a thread is assigned to a user.

**comment\_annotation.priority\_change** `boolean`

Trigger when a thread's priority changes.

# Example Request

```JSON theme={null}
{
  "data": {
    "useEmailService": true,
    "emailServiceConfig": {
      "type": "sendgrid",
      "apiKey": "SG.xxxxxxxxxx",
      "fromEmail": "noreply@example.com",
      "fromCompany": "Example Corp"
    }
  }
}
```

# Example Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Email configuration updated successfully.",
    "data": {
      "useEmailService": true,
      "emailServiceConfig": {
        "type": "sendgrid",
        "apiKey": "SG.xxxxxxxxxx",
        "fromEmail": "noreply@example.com",
        "fromCompany": "Example Corp"
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "status": "INVALID_ARGUMENT",
    "message": "Invalid email service configuration."
  }
}
```

```js theme={null}
{
  "result": {
    "status": "success",
    "message": "Email configuration updated successfully.",
    "data": {
      "useEmailService": true,
      "emailServiceConfig": {
        "type": "sendgrid",
        "apiKey": "SG.xxxxxxxxxx",
        "fromEmail": "noreply@example.com",
        "fromCompany": "Example Corp"
      }
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.