# PATCH /simulations/{simulation_id}

**Update a simulation**

Updates a simulation using its ID.

For scenario simulations, you can optionally include a `config.entities` object in the request body with entity IDs to populate
simulated webhook payloads with real data. The API key making the request needs read permissions:

* For the entities you provided, or the request fails.
* For related entities which aren't nested in the entities you provided, or static examples will be used instead.

For example, when updating a subscription renewal scenario simulation with an API key that has a `subscription.read` permission but not a `transaction.read` permission,
the request succeeds and the subscription data will be used in simulated payloads, but the related transaction data won't be used in payloads and falls back to a static example.

If you don't provide a `config.entities` object, simulated webhook payloads are populated with static examples.

If successful, your response includes a copy of the updated simulation entity.

**Required permissions:** `notification_simulation.write`

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `simulation_id` | string | required | Paddle ID of the simulation entity to work with. |

## Request body



### Request example

```json
{
  "name": "Refund approved",
  "type": "adjustment.updated",
  "payload": {
    "id": "adj_01hvgf2s84dr6reszzg29zbvcm",
    "action": "refund",
    "transaction_id": "txn_01hvcc93znj3mpqt1tenkjb04y",
    "subscription_id": "sub_01hvccbx32q2gb40sqx7n42430",
    "customer_id": "ctm_01hrffh7gvp29kc7xahm8wddwa",
    "reason": "error",
    "credit_applied_to_balance": null,
    "currency_code": "USD",
    "status": "approved",
    "items": [
      {
        "id": "adjitm_01hvgf2s84dr6reszzg2gx70gj",
        "item_id": "txnitm_01hvcc94b7qgz60qmrqmbm19zw",
        "type": "partial",
        "amount": "100",
        "proration": null,
        "totals": {
          "subtotal": "92",
          "tax": "8",
          "total": "100"
        }
      }
    ],
    "totals": {
      "subtotal": "92",
      "tax": "8",
      "total": "100",
      "fee": "5",
      "earnings": "87",
      "currency_code": "USD"
    },
    "payout_totals": {
      "subtotal": "92",
      "tax": "8",
      "total": "100",
      "fee": "5",
      "earnings": "87",
      "currency_code": "USD"
    },
    "created_at": "2024-04-15T08:48:20.239695Z",
    "updated_at": "2024-04-15T08:48:20.239695Z"
  }
}
```

## Response (200)

- `data` (required) — Represents a simulation entity.
- `meta`: object (required) — Information about this response.
  - `request_id`: string (required) — Unique ID for the request relating to this response. Provide this when contacting Paddle support about a specific request.

### Response example

```json
{
  "data": {
    "id": "ntfsim_01j82fs5pvrdse93e1kawqy2fr",
    "notification_setting_id": "ntfset_01j8259dtga48jwekrv2pmk0kp",
    "name": "Refund approved",
    "type": "adjustment.updated",
    "status": "active",
    "payload": {
      "id": "adj_01hvgf2s84dr6reszzg29zbvcm",
      "action": "refund",
      "transaction_id": "txn_01hvcc93znj3mpqt1tenkjb04y",
      "subscription_id": "sub_01hvccbx32q2gb40sqx7n42430",
      "customer_id": "ctm_01hrffh7gvp29kc7xahm8wddwa",
      "reason": "error",
      "credit_applied_to_balance": null,
      "currency_code": "USD",
      "status": "approved",
      "items": [
        {
          "id": "adjitm_01hvgf2s84dr6reszzg2gx70gj",
          "item_id": "txnitm_01hvcc94b7qgz60qmrqmbm19zw",
          "type": "partial",
          "amount": "100",
          "proration": null,
          "totals": {
            "subtotal": "92",
            "tax": "8",
            "total": "100"
          }
        }
      ],
      "totals": {
        "subtotal": "92",
        "tax": "8",
        "total": "100",
        "fee": "5",
        "earnings": "87",
        "currency_code": "USD"
      },
      "payout_totals": {
        "subtotal": "92",
        "tax": "8",
        "total": "100",
        "fee": "5",
        "earnings": "87",
        "currency_code": "USD"
      },
      "created_at": "2024-04-15T08:48:20.239695Z",
      "updated_at": "2024-04-15T08:48:20.239695Z"
    },
    "config": null,
    "last_run_at": "2024-09-18T11:55:18.261049Z",
    "created_at": "2024-09-18T11:55:15.547675Z",
    "updated_at": "2024-09-18T12:07:08.475015Z"
  },
  "meta": {
    "request_id": "ab96e6ec-6a2b-4f3a-9e65-3cf7ac29ea99"
  }
}
```
