# Retrieve ledger operation

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Returns the details of a specific ledger operation by its unique identifier.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/ledger_operations/9lfj6x1f5 \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = LedgerOperation.RetrieveLedgerOperation("9lfj6x1f5").Request();

LedgerOperation ledgerOperation = result.LedgerOperation;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    ledgeroperationAction "github.com/chargebee/chargebee-go/v3/actions/ledgeroperation"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := ledgeroperationAction.RetrieveLedgerOperation("9lfj6x1f5").Request()
    if err != nil {
        fmt.Println(err)
    } else {
        LedgerOperation := res.LedgerOperation
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  
  res, err := client.LedgerOperation.RetrieveLedgerOperation("9lfj6x1f5")
      if err != nil {
        fmt.Println(err)
    } else {
        LedgerOperation := res.LedgerOperation
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = LedgerOperation.retrieveLedgerOperation("9lfj6x1f5").request();

        LedgerOperation ledgerOperation = result.ledgerOperation();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.ledgerOperation.LedgerOperation;
import com.chargebee.v4.models.ledgerOperation.params.RetrieveLedgerOperationParams;
import com.chargebee.v4.models.ledgerOperation.responses.RetrieveLedgerOperationResponse;

public class RetrieveLedgerOperation {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        RetrieveLedgerOperationResponse response = client.ledgerOperations().retrieveLedgerOperation("9lfj6x1f5");

        LedgerOperation ledgerOperation = response.getLedgerOperation();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.ledgerOperation.retrieveLedgerOperation("9lfj6x1f5");

    console.log(result);
    const ledgerOperation = result.ledger_operation;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->ledgerOperation()->retrieveLedgerOperation("9lfj6x1f5");
$ledgerOperation = $result->ledger_operation;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.LedgerOperation.retrieve_ledger_operation("9lfj6x1f5")
ledger_operation = response.ledger_operation
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::LedgerOperation.retrieve_ledger_operation("9lfj6x1f5")

ledger_operation = result.ledger_operation
```

## Sample Response

```json
{
  "ledger_operation": {
    "id": "9lfj6x1f5",
    "subscription_id": "1mGETgZVF2umUZq",
    "unit_id": "ai_credits",
    "unit_type": "credit_unit",
    "type": "capture_authorization",
    "amount": "10",
    "provisioned_start_balance": "100.25",
    "provisioned_end_balance": "90.25",
    "overdraft_start_balance": "20",
    "overdraft_end_balance": "20",
    "ledger_operation_timestamp": 1774978580,
    "created_at": 1774978590,
    "modified_at": 1774978591,
    "object": "ledger_operation",
    "parent_ledger_operation_id": "eyexnp6sc"
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/ledger_operations/{ledger-operation-id}

## Returns

- `ledger_operation` (Ledger operation object)
  The [`ledger_operation`](/docs/api/ledger_operations) resource matching the given `id`, containing the full details of the operation including its `type`, `amount`, balance snapshots (`provisioned_start_balance`, `provisioned_end_balance`, `overdraft_start_balance`, `overdraft_end_balance`), timestamps, and any associated `metadata`.
