> ## Documentation Index
> Fetch the complete documentation index at: https://docs.velt.dev/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.

<Info>
  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](/api-reference/rest-apis/v2/workspace/authtokens-get) endpoint.
</Info>

# Endpoint

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

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="useEmailService" type="boolean">
      Whether to enable the email service.
    </ParamField>

    <ParamField body="emailServiceConfig" type="object">
      Email service configuration object.

      <Expandable title="properties">
        <ParamField body="type" type="string">
          Email service provider type. Accepted values: `"default"` or `"sendgrid"`.
        </ParamField>

        <ParamField body="apiKey" type="string">
          API key for the email service provider.
        </ParamField>

        <ParamField body="fromEmail" type="string">
          Sender email address.
        </ParamField>

        <ParamField body="fromCompany" type="string">
          Sender company name.
        </ParamField>

        <ParamField body="triggers" type="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](/webhooks/advanced) for the full list of event types. Common keys include:

          <Expandable title="properties">
            <ParamField body="comment_annotation.add" type="boolean">
              Trigger when a new comment thread is created.
            </ParamField>

            <ParamField body="comment.add" type="boolean">
              Trigger when a new comment is added to a thread.
            </ParamField>

            <ParamField body="comment_annotation.status_change" type="boolean">
              Trigger when a thread's status changes (e.g., resolved).
            </ParamField>

            <ParamField body="comment_annotation.assign" type="boolean">
              Trigger when a thread is assigned to a user.
            </ParamField>

            <ParamField body="comment_annotation.priority_change" type="boolean">
              Trigger when a thread's priority changes.
            </ParamField>
          </Expandable>
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

# 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": null
  }
}
```

#### Failure Response

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

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Email configuration updated successfully.",
      "data": null
    }
  }
  ```
</ResponseExample>
