# Release authorization

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


The release\_authorization operation releases previously held credits back to the usable balance, effectively canceling an existing authorization (hold).

**API Behavior**

-   Reverses an earlier `authorize` operation.
-   Moves credits from held (reserved) → usable balance.
-   No consumption occurs as part of this operation.
-   Always releases the entire remaining held amount; partial releases are not supported.
-   Once released, the hold is considered closed.

**Requirements**

Requires the `authorization_id` of the original authorize request.

**Business Use Cases**

Cancellation flows When an authorized action is no longer needed.

Failure recovery Downstream processing fails after authorization.

Timeout handling Manual alternative to auto-release on hold expiry.

**Usage**

Ensures held credits are fully returned to the usable balance, preventing funds from remaining locked.

The response returns `ledger_operations` (and, for compatibility, a deprecated singular `ledger_operation`), the updated `ledger_account_balance`, the affected `grant_blocks`, and the `ledger_entries` recorded by this operation.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/ledger_operations/release_authorization \
     -u {site_api_key}:\
     --header 'Content-Type: application/json;charset=UTF-8' \
     --data '{
     "authorization_id": "eyexnp6sc",
     "id": "v8u3jjems",
     "ledger_operation_timestamp": 1774978590
}'
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = LedgerOperation.ReleaseAuthorization()
		.AuthorizationId("eyexnp6sc")
		.Id("v8u3jjems")
		.LedgerOperationTimestamp(1774978590)
		.Request();

LedgerOperation ledgerOperation = result.LedgerOperation;
List<LedgerOperation> ledgerOperations = result.LedgerOperations;
LedgerAccountBalance ledgerAccountBalance = result.LedgerAccountBalance;
List<GrantBlock> grantBlocks = result.GrantBlocks;
List<LedgerEntry> ledgerEntries = result.LedgerEntries;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    ledgeroperationAction "github.com/chargebee/chargebee-go/v3/actions/ledgeroperation"
    "github.com/chargebee/chargebee-go/v3/models/ledgeroperation"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := ledgeroperationAction.ReleaseAuthorization(&ledgeroperation.ReleaseAuthorizationRequestParams{
        AuthorizationId : "eyexnp6sc",
        Id : "v8u3jjems",
        LedgerOperationTimestamp : chargebee.Int64(1774978590),
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        LedgerOperation := res.LedgerOperation
        LedgerOperations := res.LedgerOperations
        LedgerAccountBalance := res.LedgerAccountBalance
        GrantBlocks := res.GrantBlocks
        LedgerEntries := res.LedgerEntries
    }
}
```

#### 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)
  req := &chargebee.LedgerOperationReleaseAuthorizationRequest{
    AuthorizationId : "eyexnp6sc",
    Id : "v8u3jjems",
    LedgerOperationTimestamp : chargebee.Int64(1774978590),
}
  res, err := client.LedgerOperation.ReleaseAuthorization(req)
      if err != nil {
        fmt.Println(err)
    } else {
        LedgerOperation := res.LedgerOperation
        LedgerOperations := res.LedgerOperations
        LedgerAccountBalance := res.LedgerAccountBalance
        GrantBlocks := res.GrantBlocks
        LedgerEntries := res.LedgerEntries
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;
import java.util.List;
import java.sql.Timestamp;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = LedgerOperation.releaseAuthorization()
            .authorizationId("eyexnp6sc")
            .id("v8u3jjems")
            .ledgerOperationTimestamp(new Timestamp(1774978590L * 1000))
            .request();

        LedgerOperation ledgerOperation = result.ledgerOperation();
        List<LedgerOperation> ledgerOperations = result.ledgerOperations();
        LedgerAccountBalance ledgerAccountBalance = result.ledgerAccountBalance();
        List<GrantBlock> grantBlocks = result.grantBlocks();
        List<LedgerEntry> ledgerEntries = result.ledgerEntries();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.grantBlock.GrantBlock;
import com.chargebee.v4.models.ledgerAccountBalance.LedgerAccountBalance;
import com.chargebee.v4.models.ledgerEntry.LedgerEntry;
import com.chargebee.v4.models.ledgerOperation.LedgerOperation;
import com.chargebee.v4.models.ledgerOperation.LedgerOperation;
import com.chargebee.v4.models.ledgerOperation.params.LedgerOperationReleaseAuthorizationParams;
import com.chargebee.v4.models.ledgerOperation.responses.LedgerOperationReleaseAuthorizationResponse;
import java.sql.Timestamp;
import java.util.List;

public class LedgerOperationReleaseAuthorization {

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

        LedgerOperationReleaseAuthorizationParams params = LedgerOperationReleaseAuthorizationParams.builder()
            .authorizationId("eyexnp6sc")
            .id("v8u3jjems")
            .ledgerOperationTimestamp(new Timestamp(1774978590L * 1000))
            .build();

        LedgerOperationReleaseAuthorizationResponse response = client.ledgerOperations().releaseAuthorization(params);

        LedgerOperation ledgerOperation = response.getLedgerOperation();
        List<LedgerOperation> ledgerOperations = response.getLedgerOperations();
        LedgerAccountBalance ledgerAccountBalance = response.getLedgerAccountBalance();
        List<GrantBlock> grantBlocks = response.getGrantBlocks();
        List<LedgerEntry> ledgerEntries = response.getLedgerEntries();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.ledgerOperation.releaseAuthorization({
        authorization_id: "eyexnp6sc",
        id: "v8u3jjems",
        ledger_operation_timestamp: 1774978590
    });

    console.log(result);
    const ledgerOperation = result.ledger_operation;
    const ledgerOperations = result.ledger_operations;
    const ledgerAccountBalance = result.ledger_account_balance;
    const grantBlocks = result.grant_blocks;
    const ledgerEntries = result.ledger_entries;
} 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()->releaseAuthorization([
    "authorization_id" => "eyexnp6sc",
    "id" => "v8u3jjems",
    "ledger_operation_timestamp" => 1774978590
]);
$ledgerOperation = $result->ledger_operation;
$ledgerOperations = $result->ledger_operations;
$ledgerAccountBalance = $result->ledger_account_balance;
$grantBlocks = $result->grant_blocks;
$ledgerEntries = $result->ledger_entries;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.LedgerOperation.release_authorization(
    cb_client.LedgerOperation.ReleaseAuthorizationParams(
        authorization_id="eyexnp6sc",
        id="v8u3jjems",
        ledger_operation_timestamp=1774978590
    )
)
ledger_operation = response.ledger_operation
ledger_operations = response.ledger_operations
ledger_account_balance = response.ledger_account_balance
grant_blocks = response.grant_blocks
ledger_entries = response.ledger_entries
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::LedgerOperation.release_authorization({
  :authorization_id => "eyexnp6sc",
  :id => "v8u3jjems",
  :ledger_operation_timestamp => 1774978590
})

ledger_operation = result.ledger_operation
ledger_operations = result.ledger_operations
ledger_account_balance = result.ledger_account_balance
grant_blocks = result.grant_blocks
ledger_entries = result.ledger_entries
```

## Sample Response

```json
{
  "ledger_operations": [
    {
      "id": "v8u3jjems",
      "subscription_id": "1mGETgZVF2umUZq",
      "unit_id": "ai_credits",
      "unit_type": "credit_unit",
      "type": "release_authorization",
      "amount": "50.4525",
      "provisioned_start_balance": "100.25",
      "provisioned_end_balance": "100.25",
      "overdraft_start_balance": "20",
      "overdraft_end_balance": "20",
      "ledger_operation_timestamp": 1774978590,
      "created_at": 1774978599,
      "modified_at": 1774978599,
      "object": "ledger_operation",
      "parent_ledger_operation_id": "eyexnp6sc"
    },
    {..}
  ],
  "ledger_account_balance": {
    "subscription_id": "1mGETgZVF2umUZq",
    "unit_id": "ai_credits",
    "unit_type": "credit_unit",
    "created_at": 1746723600,
    "modified_at": 1774978599,
    "resource_version": 1774978599000,
    "provisioned_balance": {
      "total_balance": "100.25",
      "usable_balance": "100.25",
      "hold_amount": "0"
    },
    "overdraft_balance": {
      "is_unlimited": false,
      "limit": "20",
      "total_balance": "20",
      "usable_balance": "20",
      "used_amount": "0",
      "hold_amount": "0"
    },
    "object": "ledger_account_balance"
  },
  "grant_blocks": [
    {
      "id": "gb_ai_credits_001",
      "subscription_id": "1mGETgZVF2umUZq",
      "unit_id": "ai_credits",
      "unit_type": "credit_unit",
      "account_type": "provisioned",
      "effective_from": 1746723600,
      "expires_at": 1775402925,
      "status": "available",
      "grant_source": "subscription_created",
      "created_at": 1746723600,
      "modified_at": 1774978599,
      "resource_version": 1774978599000,
      "object": "grant_block",
      "provisioned_block_balance": {
        "granted_amount": "100.25",
        "total_balance": "100.25",
        "usable_balance": "100.25",
        "hold_amount": "0",
        "used_amount": "0",
        "expired_amount": "0",
        "rolled_over_amount": "0",
        "voided_amount": "0"
      },
      "overdraft_block_balance": null
    },
    {..}
  ],
  "ledger_entries": [
    {
      "id": "le_release_auth_001",
      "subscription_id": "1mGETgZVF2umUZq",
      "unit_id": "ai_credits",
      "unit_type": "credit_unit",
      "account_type": "provisioned",
      "amount": "50.4525",
      "grant_block_start_balance": "100.25",
      "grant_block_end_balance": "100.25",
      "account_start_balance": "100.25",
      "account_end_balance": "100.25",
      "type": "unhold",
      "ledger_operation_id": "v8u3jjems",
      "grant_block_id": "gb_ai_credits_001",
      "created_at": 1774978599,
      "modified_at": 1774978599,
      "object": "ledger_entry"
    },
    {..}
  ]
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/ledger_operations/release_authorization

## Input Parameters

- `authorization_id` (required, string, max chars=50)
  Identifier of the original `authorize` operation whose hold is being captured.
  
  **Behavior**
  
  -   Must reference a valid and active hold created via an `authorize` request.
  -   Must match the `ledger_operation_id` used in the original `authorize` call.

- `id` (optional, string, max chars=50)
  Optional client-supplied identifier for this release\_authorization operation.
  
  **Behavior**
  
  -   When provided, must uniquely identify this operation across the entire ledger.
  -   Should not conflict with any other operation, regardless of type.

- `ledger_operation_timestamp` (required, timestamp(UTC) in seconds)
  Unix timestamp (in seconds) representing when the release\_authorization occurred in the upstream system.
  
  **Usage**
  
  -   Used for period attribution, grace-period eligibility, and reporting accuracy.
  
  **Note**
  
  Late or out-of-order submissions appear in arrival order, while attribution and eligibility logic rely on `ledger_operation_timestamp`.

- `metadata` (optional, jsonobject)
  Optional opaque JSON object carrying additional business context.
  
  **Behavior**
  
  -   Stored as-is and returned verbatim by the system.
  -   Not interpreted, validated, or indexed by the system.

## Returns

- `ledger_operation` (Ledger operation object)
  **Deprecated.** Use [`ledger_operations`](#ledger_operations) instead. The single [`ledger_operation`](/docs/api/ledger_operations) resulting from this capture\_authorization. Retained for backward compatibility.

- `ledger_operations` (always returned)
  The resulting [`ledger_operations`](/docs/api/ledger_operations) for this release\_authorization. Array of one or more ledger operations. The [`amount`](/docs/api/ledger_operations#amount) field reflects the credit grants returned to the usable balance.

- `ledger_account_balance` (Ledger account balance object)
  Summarized real-time [`ledger_account_balance`](/docs/api/ledger_account_balances) after this release.

- `grant_blocks` (always returned)
  The [`grant_blocks`](/docs/api/grant_blocks) affected by this operation, each reflecting its updated balances after the operation.

- `ledger_entries` (always returned)
  The [`ledger_entries`](/docs/api/ledger_entries) recorded by this operation — immutable, per-grant-block movements of type `unhold` that make up this operation.
