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

# Edit or delete revenue

> Edit or delete a revenue entry through its state-machine actions.

Revenue entries do not have dedicated `PUT`/`DELETE` endpoints. Instead, editing
and deleting are exposed as **state-machine (FSM) actions** on the `revenue`
object type, the same pattern used for invoice line items. You first ask which
actions are available for a revenue entry, then perform the chosen action as a
transition.

<Note>
  **Availability.** `EDIT` and `DELETE` are only offered for a revenue entry when
  **both** conditions hold:

  * the revenue's parent invoice is in the **`draft`** state, and
  * the revenue's `type` is **not `unbilled`** (i.e. `billed` or `deferred_without_date`).

  For any other revenue entry the actions endpoint returns an empty list and a
  transition attempt is rejected. Unbilled revenue is managed through the invoice
  line item **Mark as Unbilled / Mark as Billed** flow, not edited directly.
</Note>

<Warning>
  **Admin-only.** Editing and deleting revenue require **admin** access — the
  caller must hold `RevenueService:updateRevenue` / `RevenueService:deleteRevenue`
  (granted to `AdminAccess`) in addition to `FsmService:transition`. A `SystemUser`
  token can create and read revenue but cannot edit or delete it.

  The actions endpoint is **not** role-filtered, so a non-admin caller may still
  see `EDIT` / `DELETE` listed — the transition itself is rejected (`Access denied`)
  without the mutation permission.
</Warning>

## 1. Get available actions

Fetch the actions that can currently be performed on a revenue entry.

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.getenso.ai/objects/revenue/{revenueId}/actions \
    --header 'Authorization: Bearer <token>'
  ```
</CodeGroup>

When editing/deleting is allowed, the response includes the `EDIT` and `DELETE`
actions (with `EDIT`'s editable fields); otherwise the list is empty.

```json theme={null}
[
  {
    "eventType": "EDIT",
    "label": "Edit",
    "fields": [
      { "name": "value", "type": "text", "required": true },
      { "name": "startDate", "type": "date", "required": false },
      { "name": "endDate", "type": "date", "required": false }
    ]
  },
  { "eventType": "DELETE", "label": "Delete" }
]
```

<Note>Required policy action: `FsmService:getActions`. See [Get object actions](/api-reference/endpoint/get-objects-type-id-actions).</Note>

## 2. Edit a revenue entry

Send an `EDIT` transition with the new values. `value` is required; `startDate`
and `endDate` are optional (omit both for `deferred_without_date` revenue). When
both dates are provided, `startDate` must be on or before `endDate`.

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.getenso.ai/objects/revenue/{revenueId}/transition \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "action": "EDIT",
      "value": 1200.00,
      "startDate": "2026-01-01",
      "endDate": "2026-01-31"
    }'
  ```
</CodeGroup>

<Note>Required policy actions: `FsmService:transition` **and** `RevenueService:updateRevenue` (`AdminAccess`). See [Transition object state](/api-reference/endpoint/post-objects-type-id-transition).</Note>

## 3. Delete a revenue entry

Send a `DELETE` transition. No additional fields are required.

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.getenso.ai/objects/revenue/{revenueId}/transition \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{ "action": "DELETE" }'
  ```
</CodeGroup>

<Note>Required policy actions: `FsmService:transition` **and** `RevenueService:deleteRevenue` (`AdminAccess`). See [Transition object state](/api-reference/endpoint/post-objects-type-id-transition).</Note>
