/transactions/{name}

DELETE SYNC

Delete all transactions for a specific wallet.

DELETE /api/v1/transactions/{name}
Alias: /clear-transaction-history/{name}

Description

Permanently deletes the entire transaction history and all associated receipts for a given wallet.

Warning: Destructive Operation

This action is permanent and cannot be undone. All historical transaction data for the specified wallet will be lost.

Path Parameters

ParameterTypeRequiredDescription
name string Yes The name of the wallet whose transaction history will be cleared.

Response

Returns a `200 OK` response with no content if the transaction history was deleted successfully.

Examples

JavaScript Example

const apiHost = 'http://localhost:8006';

async function deleteAllTransactions(walletName) {
    try {
        const response = await fetch(`${apiHost}/api/v1/transactions/${walletName}`, {
            method: 'DELETE'
        });

        if (response.ok) {
            console.log(`Successfully deleted all transactions for wallet: ${walletName}`);
        } else {
            console.error(`Failed to delete transactions. Status: ${response.status}`);
        }
    } catch (error) {
        console.error('Error deleting transactions:', error);
    }
}

// deleteAllTransactions('WalletToDeleteHistory');

cURL Example

# Delete all transactions for the wallet named "WalletToDeleteHistory"
curl -X DELETE "http://localhost:8006/api/v1/transactions/WalletToDeleteHistory"

Go Example

package main

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

const apiHost = "http://localhost:8006/api/v1"

func deleteAllTransactions(walletName string) {
    url := fmt.Sprintf("%s/transactions/%s", apiHost, walletName)
    
    req, err := http.NewRequest(http.MethodDelete, url, nil)
    if err != nil {
        log.Fatalf("Failed to create request: %v", err)
    }

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        log.Fatalf("Failed to execute request: %v", err)
    }
    defer resp.Body.Close()

    if resp.StatusCode == http.StatusOK {
        fmt.Printf("Successfully deleted all transactions for wallet: %s\n", walletName)
    } else {
        log.Printf("Failed to delete transactions, status: %s", resp.Status)
    }
}

func main() {
    deleteAllTransactions("WalletToDeleteHistory")
}