> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.lucanto.eu/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.lucanto.eu/_mcp/server.

# Delete a transaction

DELETE https://app.lucanto.eu/api/v1/workspaces/{workspace_id}/transactions/{id}

Permanently removes the transaction. This is a hard delete, the same one
the web app performs — there is no soft-delete or undo, and a
PSD2-connected account may re-import the movement on a later sync.

The cleanup is handled for you: payment allocations are removed with it,
bank statement entries survive but lose their link, and the payment
status of whatever document or expense it settled is re-derived — so
deleting a matched transaction leaves its invoice correctly unpaid
rather than stale.

Intended for correcting an import that landed rows it should not have —
most typically a camt.053 statement uploaded for a period the account
had already received over PSD2, which imports as duplicates because the
parser's duplicate check matches on the bank's own reference and that
differs between a live feed and a downloaded statement.

Requires the `manage:transactions` scope — a `write`-scoped key cannot
delete.


Reference: https://docs.lucanto.eu/api-reference/api-reference/transactions/delete-transaction

## Authentication

- `Authorization` header (bearer token, required) — JWT issued via POST /api/v1/auth/sign_in. Used by mobile and SPA clients. Revoked tokens are rejected.
- `Authorization` header (bearer token, required) — Lucanto API key. Two prefixes: * `lct_pat_<random><checksum>` — personal access token (owner: User) * `lct_live_<random><checksum>` — workspace token, live data Issue keys at `/settings/api_keys` (personal) or `/:workspace_id/settings/api_keys` (workspace). Plaintext token is shown once and never again.

## Request

### Path parameters

- `workspace_id` (long, required) — Workspace ID. The numeric ID shown in your URLs.
- `id` (ResourceId, required) — Transaction ID. Either the numeric `id` or the `public_id` (`txn_…`).

## Response

### 204

No Content

## Errors

### 401 Unauthorized Error

Missing or invalid authentication credentials.

- `error` (string, required) — Machine-readable error code. Stable across releases — clients should branch on this rather than the human-readable message.
- `message` (string, required) — Human-readable error description, localized to `Accept-Language`. Subject to wording changes between releases.
- `request_id` (string, required) — Server-side request identifier. Same value as the `X-Request-Id` response header. Quote this in support tickets so we can pull the matching server log line.
- `docs_url` (string, required) — URL of the per-error-code documentation page. Useful for SDK error subclasses to deep-link from a stack trace to the docs explaining the cause + remediation.

### 402 Payment Required Error

Workspace has no active subscription. Visit the upgrade URL to subscribe.

- `error` (string, required) — Machine-readable error code. Stable across releases — clients should branch on this rather than the human-readable message.
- `message` (string, required) — Human-readable error description, localized to `Accept-Language`. Subject to wording changes between releases.
- `request_id` (string, required) — Server-side request identifier. Same value as the `X-Request-Id` response header. Quote this in support tickets so we can pull the matching server log line.
- `docs_url` (string, required) — URL of the per-error-code documentation page. Useful for SDK error subclasses to deep-link from a stack trace to the docs explaining the cause + remediation.
- `upgrade_url` (string, optional) — URL to the billing/plans page

### 403 Forbidden Error

Authenticated, but the token's scope or the user's role does not permit this action. Both the token scope and the user's role must allow the action. Also returned when a workspace token is sent to an endpoint that acts for a user (`/user`, `/user/workspaces`, devices, notification preferences, diagnostics): a workspace token has no user behind it, so use a personal access token or a JWT there.

- `error` (string, required) — Machine-readable error code. Stable across releases — clients should branch on this rather than the human-readable message.
- `message` (string, required) — Human-readable error description, localized to `Accept-Language`. Subject to wording changes between releases.
- `request_id` (string, required) — Server-side request identifier. Same value as the `X-Request-Id` response header. Quote this in support tickets so we can pull the matching server log line.
- `docs_url` (string, required) — URL of the per-error-code documentation page. Useful for SDK error subclasses to deep-link from a stack trace to the docs explaining the cause + remediation.

### 404 Not Found Error

Resource does not exist, or exists but is not visible to the authenticated principal (cross-workspace isolation returns 404, not 403, to avoid leaking existence).

- `error` (string, required) — Machine-readable error code. Stable across releases — clients should branch on this rather than the human-readable message.
- `message` (string, required) — Human-readable error description, localized to `Accept-Language`. Subject to wording changes between releases.
- `request_id` (string, required) — Server-side request identifier. Same value as the `X-Request-Id` response header. Quote this in support tickets so we can pull the matching server log line.
- `docs_url` (string, required) — URL of the per-error-code documentation page. Useful for SDK error subclasses to deep-link from a stack trace to the docs explaining the cause + remediation.

### 429 Too Many Requests Error

Rate limit exceeded. Retry after the window resets.

- `error` (string, required) — Machine-readable error code. Stable across releases — clients should branch on this rather than the human-readable message.
- `message` (string, required) — Human-readable error description, localized to `Accept-Language`. Subject to wording changes between releases.
- `request_id` (string, required) — Server-side request identifier. Same value as the `X-Request-Id` response header. Quote this in support tickets so we can pull the matching server log line.
- `docs_url` (string, required) — URL of the per-error-code documentation page. Useful for SDK error subclasses to deep-link from a stack trace to the docs explaining the cause + remediation.

## Types

### ResourceId

The record's numeric `id` or its `public_id` (`doc_01h455vb4pex5vsknk084sn02q`). The bare UUID form of the `public_id` is still accepted but deprecated.

- long
- string
- string

## Examples

**SDK Code**

```python
import requests

url = "https://app.lucanto.eu/api/v1/workspaces/42/transactions/1"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.lucanto.eu/api/v1/workspaces/42/transactions/1';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.lucanto.eu/api/v1/workspaces/42/transactions/1"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.lucanto.eu/api/v1/workspaces/42/transactions/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://app.lucanto.eu/api/v1/workspaces/42/transactions/1")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://app.lucanto.eu/api/v1/workspaces/42/transactions/1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.lucanto.eu/api/v1/workspaces/42/transactions/1");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.lucanto.eu/api/v1/workspaces/42/transactions/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```