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

# Create ProactiveActionConfig

> Create a new ProactiveActionConfig record.

A ProactiveActionConfig is the settings row for one proactive AI agent at one location: whether it runs at all, whether it may act without human review and above what confidence, how many actions it may raise per day, how long it waits before repeating itself, which delivery channel it prefers, and any custom drafting or voice prompts. There is at most one row per location and CriteriaType, and an agent with no row is off. The default posture is human-in-the-loop: the agent raises ProposedAction records into the operator AI Inbox for review, and only turning on AutoExecute lets sufficiently confident actions go out unattended.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`ProactiveActionConfig-Create`** role.
</Note>

## Enums

<Accordion title="eOutboundChannel">
  | Value | Name            |
  | ----- | --------------- |
  | 1     | Email           |
  | 2     | Voice           |
  | 3     | CoworkerMessage |
  | 4     | HelpDesk        |
  | 5     | WhatsApp        |
</Accordion>

## Request Body

### Required Fields

<ParamField body="BusinessId" type="integer" required>
  ID of the location this agent configuration applies to. Each location holds at most one configuration per CriteriaType, and an agent with no configuration row is treated as off..
</ParamField>

<ParamField body="CriteriaType" type="string" required>
  Name of the proactive agent this configuration governs, matching a criteria evaluator: DueInvoiceCriteria, ContractExpiryCriteria, SupportPatternCriteria, SupportIssueCategoryCriteria or MissingFaqCriteria. Unique per location; the actions it produces carry the same value in ProposedAction.CriteriaType..
</ParamField>

<ParamField body="AutoExecuteMinConfidence" type="number" required>
  Confidence an action must reach before AutoExecute will send it without review, on a 0.0–1.0 scale (not a percentage). Defaults to 0.85. Has no effect while AutoExecute is false..
</ParamField>

<ParamField body="CooldownHours" type="integer" required>
  How long the agent waits before raising the same trigger again, in hours; defaults to 24. A candidate is skipped when a non-expired action with the same deduplication key was created inside this window, so in practice it throttles repeat outreach about the same invoice, contract or customer..
</ParamField>

### Optional Fields

<ParamField body="Enabled" type="boolean">
  Whether this agent runs for the location. When false, or when no configuration row exists at all, the agent is skipped entirely and proposes nothing..
</ParamField>

<ParamField body="AutoExecute" type="boolean">
  Whether this agent may act without human review. When true, an action whose confidence reaches AutoExecuteMinConfidence is delivered straight away and recorded as AutoExecuted; anything below it still lands in the inbox. Internal-alert agents ignore this..
</ParamField>

<ParamField body="MaxActionsPerDay" type="integer">
  Cap on how many actions this agent may raise for the location in a single day; it also caps how many candidates one evaluation run will consider. Empty means uncapped, in which case a run still considers at most 20 candidates..
</ParamField>

<ParamField body="ChannelPreference" type="integer">
  Overrides the delivery channel this agent proposes: Email, Voice, CoworkerMessage, HelpDesk or WhatsApp. Empty leaves the choice to the agent's own default. Voice requires the location's AI voice channel to be enabled, and WhatsApp requires a configured WhatsApp number.. See `eOutboundChannel?` enum above.
</ParamField>

<ParamField body="CustomPromptOverride" type="string">
  Extra drafting instructions for this agent, up to 2000 characters, appended to its built-in prompt — for example a tone or signature convention. Starting the text with "OVERRIDE:" (case-insensitive) replaces the agent's whole prompt template instead of adding to it..
</ParamField>

<ParamField body="FirstMessage" type="string">
  Opening line spoken or sent when this agent starts an outbound conversation, up to 500 characters. Supports \{\{variable}} placeholders such as \{\{company\_name}} plus the agent-specific variables listed by the criteria-variables endpoint. Empty uses the built-in opening..
</ParamField>

<ParamField body="SystemPrompt" type="string">
  Voice-agent system prompt for outbound conversations this agent starts, up to 2000 characters. By default the text is added to the standard prompt; starting it with "OVERRIDE:" (case-insensitive) replaces the standard prompt entirely, and the server then rejects the save unless the text also contains the \{\{voice\_message}} placeholder..
</ParamField>

<ParamField body="CriteriaConfiguration" type="string">
  Agent-specific thresholds as a flat JSON object of string values, keyed by the parameter keys the criteria-parameters endpoint publishes for this CriteriaType — for example reminder day counts, minimum invoice amounts or ticket thresholds. Empty means every parameter falls back to its published default..
</ParamField>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST \
    "https://spaces.nexudus.com/api/sys/proactiveactionconfigs" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "BusinessId": 0,
      "CriteriaType": "",
      "AutoExecuteMinConfidence": 0,
      "CooldownHours": 0
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/proactiveactionconfigs',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        BusinessId: 0,
        CriteriaType: '',
        AutoExecuteMinConfidence: 0,
        CooldownHours: 0
      })
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://spaces.nexudus.com/api/sys/proactiveactionconfigs',
      headers={
          'Authorization': 'Bearer YOUR_TOKEN',
          'Content-Type': 'application/json'
      },
      json={
          'BusinessId': 0,
          'CriteriaType': '',
          'AutoExecuteMinConfidence': 0,
          'CooldownHours': 0
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Status" type="integer">
  HTTP status code. `200` on success.
</ResponseField>

<ResponseField name="Message" type="string">
  A human-readable message confirming the creation.
</ResponseField>

<ResponseField name="Value" type="object">
  Contains the `Id` of the newly created record.
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `true` if the proactiveactionconfig was created successfully.
</ResponseField>

<ResponseField name="Errors" type="array">
  `null` on success.
</ResponseField>

```json Example Response theme={null}
{
  "Status": 200,
  "Message": "ProactiveActionConfig was successfully created.",
  "Value": {
    "Id": 87654321
  },
  "OpenInDialog": false,
  "OpenInWindow": false,
  "RedirectURL": null,
  "JavaScript": null,
  "UpdatedOn": "2025-01-15T10:30:00Z",
  "UpdatedBy": "admin@example.com",
  "Errors": null,
  "WasSuccessful": true
}
```

### 400

<ResponseField name="Message" type="string">
  A summary of the validation error(s), in the format `PropertyName: error message`.
</ResponseField>

<ResponseField name="Value" type="any">
  `null` on validation failure.
</ResponseField>

<ResponseField name="Errors" type="object[]">
  Array of validation errors.

  <Expandable>
    <ResponseField name="AttemptedValue" type="any">
      The value that was submitted for the field, or `null` if missing.
    </ResponseField>

    <ResponseField name="Message" type="string">
      The validation error message.
    </ResponseField>

    <ResponseField name="PropertyName" type="string">
      The name of the property that failed validation.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="WasSuccessful" type="boolean">
  `false` when the request fails validation.
</ResponseField>

```json Example Response theme={null}
{
  "Message": "CriteriaType: is a required field",
  "Value": null,
  "Errors": [
    {
      "AttemptedValue": null,
      "Message": "is a required field",
      "PropertyName": "CriteriaType"
    }
  ],
  "WasSuccessful": false
}
```
