# cancelTax refactor to VoidTransaction

Source: https://developer.avalara.com/restv1-to-restv2-refactor-guide/rmg2372671758371/

# cancelTax refactor to VoidTransaction

Understand the differences between `cancelTax` (RESTv1) and `VoidTransaction` (RESTv2) and learn how to migrate.

The table below shows the differences in the fields between [cancelTax](https://developer.avalara.com/api-reference/avatax/rest/v1/methods/cancelTax/) (RESTv1) and [ResolveAddress](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Addresses/ResolveAddress/) (RESTv2). The example below the table shows how to migrate from RESTv1 to RESTv2.

RESTv1

RESTv2

`CompanyCode`

N/A. The company code is specified in the request URL.

`DocType`

N/A. The document type is specified in the request URL.

`DocCode`

N/A. The document code is specified in the request URL.

`CancelCode`

`code`

## **Examples**

**RESTv1 example**

```
curl
  -X POST
  -H 'Accept: application/json'
  -H' Authorization: Basic ${btoa(`:`)}'
  'https://development.avalara.net/1.0/tax/cancel'
  --data '{
    "CancelCode": "DocDeleted",
    "CompanyCode": "CINC",
    "DocCode": "12345",
    "DocType": "SalesInvoice"
  }'
```

**RESTv2 example**

```
curl
  -X POST
  -H 'Authorization: Basic ${btoa(`:`)}'
  -H 'Content-Type: application/json'
  --data '{
    "code": "DocVoided"
  }'
  'https://sandbox-rest.avatax.com/api/v2/companies/CINC/transactions/12345/void'
```