> ## 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.

# Set Config

<Warning>
  To use this API, you must have the this feature enabled in [Velt console](https://console.velt.dev/dashboard/config/notification)
</Warning>

Use this API to set the notifications config for users.

# Endpoint

`POST https://api.velt.dev/v2/notifications/config/set`

# 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="organizationId" type="string" required>
      The ID of the organization.
    </ParamField>

    <ParamField body="documentIds" type="string[]">
      An array of document IDs. The notification configuration will be applied to these documents for the specified users. When omitted, the config is applied at the organization level and stored as the user's default for all documents.
    </ParamField>

    <ParamField body="userIds" type="string[]" required>
      An array of user IDs. The notification configuration will be set for these users.
    </ParamField>

    <ParamField body="config" type="object" required>
      Object containing the notification preferences.

      <Expandable title="properties">
        <ParamField body="inbox" type="string">
          In-app inbox notification preference. Valid values:

          <ul>
            <li>`ALL`: User receives all notifications in their inbox.</li>
            <li>`MINE`: User receives notifications in their inbox only for activities directly involving them (e.g., mentions, replies).</li>
            <li>`NONE`: User receives no notifications in their inbox.</li>
          </ul>

          Optional.
        </ParamField>

        <ParamField body="email" type="string">
          Email notification preference. Valid values:

          <ul>
            <li>`ALL`: User receives email notifications for all activities.</li>
            <li>`MINE`: User receives email notifications only for activities directly involving them.</li>
            <li>`NONE`: User receives no email notifications.</li>
          </ul>

          Optional.
        </ParamField>

        <ParamField body="slack" type="string">
          Slack notification preference (requires Slack integration to be effective). Valid values:

          <ul>
            <li>`ALL`: User receives Slack notifications for all activities.</li>
            <li>`MINE`: User receives Slack notifications only for activities directly involving them.</li>
            <li>`NONE`: User receives no Slack notifications.</li>
          </ul>

          Optional.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

<Tabs>
  <Tab title="Document-Level Config">
    ```JSON theme={null}
    {
        "data": {
            "organizationId": "org1",
            "documentIds": ["doc1"],
            "userIds": ["USER_ID1"],
            "config": {
                "inbox": "ALL",
                "email": "ALL"
            }
        }
    }
    ```
  </Tab>

  <Tab title="Org-Level Config">
    ```JSON theme={null}
    {
        "data": {
            "organizationId": "org1",
            "userIds": ["USER_ID1"],
            "config": {
                "inbox": "ALL",
                "email": "ALL"
            }
        }
    }
    ```
  </Tab>
</Tabs>

# Response

#### Success Response

```JSON theme={null}
{
    "result": {
        "status": "success",
        "message": "User config set successfully.",
        "data": {
            "USER_ID1": {
                "success": true,
                "userId": "USER_ID1",
                "documentId": "doc1",
                "message": "User config set successfully."
            }
        }
    }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
      "result": {
          "status": "success",
          "message": "User config set successfully.",
          "data": {
              "USER_ID1": {
                  "success": true,
                  "userId": "USER_ID1",
                  "documentId": "doc1",
                  "message": "User config set successfully."
              }
          }
      }
  }
  ```
</ResponseExample>
