> This page is for version Staging.
> For other versions, use one of these documentation indexes:
> - Prod (default): https://docs.chrt.com/prod/llms.txt
> - Staging: https://docs.chrt.com/staging/llms.txt
> - Dev: https://docs.chrt.com/dev/llms.txt

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

# Void

PATCH https://api.staging.chrt.com/billing_new/invoices/void/v1/{invoice_id}
Content-Type: application/json

Voids a draft or approved invoice owned by the caller's organization. | authz: allowed_org_types=[provider], min_org_role=operator | (InvoiceVoidReq) -> (Invoice1)

Reference: https://docs.chrt.com/api-reference/api-reference/billing-new/invoices/void-v-1

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `invoice_id` (string, required)

### Body (application/json)

This endpoint expects an object.

- `void_reason` (string, optional)

## Response

### 200

Successful Response

- `_id` (string, required)
- `created_at_timestamp` (datetime, required)
- `created_by_user_id` (string, required) — Must be a string starting with `user_`
- `currency_code` (enum, required)
  - Allowed values: `USD`, `CAD`, `EUR`, `GBP`, `MXN`, `AUD`, `JPY`, `CNY`, `CHF`, `INR`
- `invoice_type` (enum, required)
  - Allowed values: `accounts_receivable`, `accounts_payable`
- `last_edited_at_timestamp` (datetime, required)
- `last_edited_by_user_id` (string, required) — Must be a string starting with `user_`
- `owned_by_org_id` (string, required) — Must be a string starting with `org_`
- `period_end_at_timestamp` (datetime, required)
- `period_start_at_timestamp` (datetime, required)
- `schema_version` (integer, required)
- `approved_at_timestamp` (datetime, optional)
- `approved_by_user_id` (string, optional) — Must be a string starting with `user_`
- `counterparty_account_ids` (list of string, optional)
- `counterparty_driver_id` (string, optional)
- `counterparty_off_chrt_org_data_id` (string, optional)
- `counterparty_org_id` (string, optional) — Must be a string starting with `org_`
- `description` (string, optional)
- `export_ref__sage__customer_id` (string, optional)
- `export_ref__sage__department_id` (string, optional)
- `file_exported_at_timestamp` (datetime, optional)
- `file_exported_by_user_id` (string, optional) — Must be a string starting with `user_`
- `invoice_line_item_ids` (list of string, optional)
- `merge_exported_at_timestamp` (datetime, optional)
- `merge_exported_by_user_id` (string, optional) — Must be a string starting with `user_`
- `merge_invoice_id` (string, optional)
- `merge_invoice_number` (string, optional)
- `merge_invoice_url` (string, optional)
- `merge_linked_account_id` (string, optional)
- `merge_remote_id` (string, optional)
- `merge_remote_was_deleted` (boolean, optional, default: false)
- `merge_status` (enum, optional)
  - Allowed values: `draft`, `submitted`, `open`, `partially_paid`, `paid`, `void`
- `name` (string, optional)
- `status` (enum, optional)
  - Allowed values: `draft`, `approved`, `void`
- `stripe_exported_at_timestamp` (datetime, optional)
- `stripe_exported_by_user_id` (string, optional) — Must be a string starting with `user_`
- `stripe_invoice_id` (string, optional)
- `stripe_invoice_number` (string, optional)
- `stripe_invoice_url` (string, optional)
- `stripe_status` (enum, optional)
  - Allowed values: `draft`, `open`, `paid`, `uncollectible`, `void`
- `stripe_was_deleted` (boolean, optional, default: false)
- `total_amount` (double, optional)
- `void_reason` (string, optional)
- `voided_at_timestamp` (datetime, optional)
- `voided_by_user_id` (string, optional) — Must be a string starting with `user_`

## Errors

### 422 Invoices Void V1request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ValidationError

- `loc` (list of LocationItem, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (map from string to any, optional)
- `input` (any, optional)

### LocationItem

- string
- integer

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "_id": "_id",
  "created_at_timestamp": "2024-01-15T09:30:00Z",
  "created_by_user_id": "created_by_user_id",
  "currency_code": "USD",
  "invoice_type": "accounts_receivable",
  "last_edited_at_timestamp": "2024-01-15T09:30:00Z",
  "last_edited_by_user_id": "last_edited_by_user_id",
  "owned_by_org_id": "owned_by_org_id",
  "period_end_at_timestamp": "2024-01-15T09:30:00Z",
  "period_start_at_timestamp": "2024-01-15T09:30:00Z",
  "schema_version": 1,
  "approved_at_timestamp": "2024-01-15T09:30:00Z",
  "approved_by_user_id": "approved_by_user_id",
  "counterparty_account_ids": [
    "counterparty_account_ids"
  ],
  "counterparty_driver_id": "counterparty_driver_id",
  "counterparty_off_chrt_org_data_id": "counterparty_off_chrt_org_data_id",
  "counterparty_org_id": "counterparty_org_id",
  "description": "description",
  "export_ref__sage__customer_id": "export_ref__sage__customer_id",
  "export_ref__sage__department_id": "export_ref__sage__department_id",
  "file_exported_at_timestamp": "2024-01-15T09:30:00Z",
  "file_exported_by_user_id": "file_exported_by_user_id",
  "invoice_line_item_ids": [
    "invoice_line_item_ids"
  ],
  "merge_exported_at_timestamp": "2024-01-15T09:30:00Z",
  "merge_exported_by_user_id": "merge_exported_by_user_id",
  "merge_invoice_id": "merge_invoice_id",
  "merge_invoice_number": "merge_invoice_number",
  "merge_invoice_url": "merge_invoice_url",
  "merge_linked_account_id": "merge_linked_account_id",
  "merge_remote_id": "merge_remote_id",
  "merge_remote_was_deleted": true,
  "merge_status": "draft",
  "name": "name",
  "status": "draft",
  "stripe_exported_at_timestamp": "2024-01-15T09:30:00Z",
  "stripe_exported_by_user_id": "stripe_exported_by_user_id",
  "stripe_invoice_id": "stripe_invoice_id",
  "stripe_invoice_number": "stripe_invoice_number",
  "stripe_invoice_url": "stripe_invoice_url",
  "stripe_status": "draft",
  "stripe_was_deleted": true,
  "total_amount": 1.1,
  "void_reason": "void_reason",
  "voided_at_timestamp": "2024-01-15T09:30:00Z",
  "voided_by_user_id": "voided_by_user_id"
}
```

**SDK Code**

```python
import requests

url = "https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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.patch("https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staging.chrt.com/billing_new/invoices/void/v1/invoice_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```