---
source_url: https://www.pubnub.com/docs/admin-api/update-decision
title: Update decision
---

# Update decision

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

Updates an existing decision. This is a **full replacement** — any fields, rules, or actions omitted from the PUT body will be deleted.

> **Warning:** All rule references (`inputFieldId`, `outputFieldId`, `actionId`) must use the auto-generated IDs returned from the POST response — not user-defined values.

> **Warning:** This endpoint performs a full replace. Include **all** existing fields, actions, and rules in every PUT request, even if you are only changing one rule.

### What requires deactivation

| Change type | Deactivation required? |
| --- | --- |
| Modifying rule values (conditions, outputs, action status) | No |
| Adding or removing `inputFields`, `outputFields`, or `actions` | **Yes** — set `enabled: false` first |
| Changing `name`, `description`, `activeFrom`, `activeUntil` | No |
| Setting `enabled: true` | No (this is how you activate) |

### Field behavior on PUT

| Field | PUT behavior |
| --- | --- |
| `id` (top-level) | Path parameter — do not include in body |
| `rules` | Include the full rules array with ID references from POST response |
| `inputFields[].id` | Must match the auto-generated IDs — include them |
| `actions[].id` | Must match the auto-generated IDs — include them |
| `enabled` | Set `true` to activate, `false` to deactivate |

### Common errors

| Code | Condition |
| --- | --- |
| 400 | Rule references an `inputFieldId` that does not exist |
| 400 | Structural change (inputFields/outputFields/actions) while `enabled: true` |
| 404 | Decision ID not found |

## Request

Example

```
{
  "createdAt": "2024-01-01T00:00:00.000Z",
  "updatedAt": "2024-01-01T00:00:00.000Z",
  "createdBy": "string",
  "updatedBy": "string",
  "id": "string",
  "name": "string",
  "description": "string",
  "accountId": "string",
  "businessObjectId": "string",
  "sourceType": "BUSINESSOBJECT",
  "sourceId": "string",
  "hitType": "SINGLE",
  "enabled": false,
  "activeFrom": "2024-01-01T00:00:00.000Z",
  "activeUntil": "2024-01-01T00:00:00.000Z",
  "executeOnce": false,
  "executionFrequency": 0,
  "inputFields": [
    {
      "id": "string",
      "sourceType": {},
      "sourceId": "string",
      "name": "string"
    }
  ],
  "outputFields": [
    {
      "id": "string",
      "name": "string",
      "variable": "string"
    }
  ],
  "rules": [
    {
      "id": "string",
      "inputValues": [
        {}
      ],
      "outputValues": [
        {}
      ],
      "actionValues": [
        {}
      ]
    }
  ],
  "actions": [
    {
      "id": "string",
      "actionType": "WEBHOOK_EXECUTION",
      "description": "string",
      "name": "string",
      "template": {},
      "note": "string"
    }
  ],
  "businessObject": {
    "createdAt": "2024-01-01T00:00:00.000Z",
    "updatedAt": "2024-01-01T00:00:00.000Z",
    "createdBy": "string",
    "updatedBy": "string",
    "id": "string",
    "name": "string",
    "isActive": false,
    "description": "string",
    "fields": [
      {
        "id": "string",
        "name": "string",
        "jsonPath": "string",
        "jsonFieldType": "TEXT",
        "isKeyset": false,
        "source": "JSONPATH",
        "derivation": {}
      }
    ],
    "accountId": "string",
    "subkeys": [
      "string"
    ],
    "metrics": [
      {
        "id": "string",
        "name": "string",
        "measureId": "string",
        "businessObjectId": "string",
        "evaluationWindow": 0,
        "function": "string",
        "dimensionIds": [],
        "dimensions": [],
        "filters": []
      }
    ],
    "decisions": [],
    "dashboards": [
      {
        "createdAt": "2024-01-01T00:00:00.000Z",
        "updatedAt": "2024-01-01T00:00:00.000Z",
        "createdBy": "string",
        "updatedBy": "string",
        "id": "string",
        "name": "string",
        "accountId": "string",
        "dateRange": "30 minutes",
        "startDate": "2024-01-01T00:00:00.000Z",
        "endDate": "2024-01-01T00:00:00.000Z",
        "charts": [],
        "customer": {}
      }
    ],
    "queries": [
      {
        "createdAt": "2024-01-01T00:00:00.000Z",
        "updatedAt": "2024-01-01T00:00:00.000Z",
        "createdBy": "string",
        "updatedBy": "string",
        "decisions": [],
        "customer": {},
        "businessObjects": [],
        "id": "string",
        "name": "string",
        "description": "string",
        "definition": {},
        "template": "string",
        "accountId": "string"
      }
    ],
    "customers": [
      {
        "id": "string",
        "name": "string"
      }
    ]
  },
  "metric": {
    "id": "string",
    "name": "string",
    "measureId": "string",
    "businessObjectId": "string",
    "evaluationWindow": 0,
    "function": "string",
    "dimensionIds": [
      "string"
    ],
    "dimensions": [
      {
        "id": "string",
        "name": "string",
        "jsonPath": "string",
        "jsonFieldType": "TEXT",
        "isKeyset": false,
        "source": "JSONPATH",
        "derivation": {}
      }
    ],
    "filters": [
      {
        "id": "string",
        "sourceType": "MEASURE",
        "sourceId": "string",
        "operation": "NUMERIC_GREATER_THAN",
        "arguments": []
      }
    ],
    "businessObject": {
      "createdAt": "2024-01-01T00:00:00.000Z",
      "updatedAt": "2024-01-01T00:00:00.000Z",
      "createdBy": "string",
      "updatedBy": "string",
      "id": "string",
      "name": "string",
      "isActive": false,
      "description": "string",
      "fields": [
        {}
      ],
      "accountId": "string",
      "subkeys": [
        "string"
      ],
      "metrics": [],
      "decisions": [],
      "dashboards": [
        {}
      ],
      "queries": [
        {}
      ],
      "customers": [
        {}
      ]
    }
  },
  "query": {
    "createdAt": "2024-01-01T00:00:00.000Z",
    "updatedAt": "2024-01-01T00:00:00.000Z",
    "createdBy": "string",
    "updatedBy": "string",
    "decisions": [],
    "customer": {
      "id": "string",
      "name": "string"
    },
    "businessObjects": [
      {
        "createdAt": "2024-01-01T00:00:00.000Z",
        "updatedAt": "2024-01-01T00:00:00.000Z",
        "createdBy": "string",
        "updatedBy": "string",
        "id": "string",
        "name": "string",
        "isActive": false,
        "description": "string",
        "fields": [],
        "accountId": "string",
        "subkeys": [],
        "metrics": [],
        "decisions": [],
        "dashboards": [],
        "queries": [],
        "customers": []
      }
    ],
    "id": "string",
    "name": "string",
    "description": "string",
    "definition": {
      "version": "2.0",
      "pipeline": {
        "sources": [],
        "transforms": [],
        "output": {}
      },
      "meta": {}
    },
    "template": "string",
    "accountId": "string"
  },
  "customer": {
    "id": "string",
    "name": "string"
  }
}
```
