# Understanding simple transactions

Source: https://developer.avalara.com/avatax-dm-combined-erp/sales-tax-badge/transactions/simple-transactions/

# Understanding simple transactions

Transactions can be very simple, very complex, or anywhere in between. The AvaTax [CreateTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) supports a wide variety of features and functionality that enables businesses of any size to accurately reflect their tax liability.

To understand AvaTax, it’s best to start small - so let’s look at the minimum information required to calculate a transaction, and why that information is required:

-   The`companyCode` of the company that recorded the transaction. If you have multiple companies within your account, you need to specify which one is creating this transaction.
-   The`code` field or "Document Code" refers to a unique reference to a transaction. For example, an invoice number generated by your ERP would be mapped to`code`. A`code` must be unique within each company and within each doc`type`. (For example, you can have both a Sales Order and a Purchase Order with a doc`code` of 1234.) Be careful not to use a duplicate code. If you attempt to create two transactions with the same`code` for the same company and document`type`, AvaTax will assume you want to modify the existing transaction and report an error.
-   The`type` of the transaction - for example, sales are recorded as a`SalesInvoice`, which is a permanent transaction that can be reported to a tax authority.
-   The`date` when the transaction took place.
-   The`customerCode` of the customer requesting the transaction. This feature is necessary to allow customers who have exemption certificates to be exempted from sales tax correctly. If you're creating a sales order for a customer that does not yet exist in your system, you can send a dummy`customerCode` as sales orders are not recorded.
-   The list of`addresses` involved in the transaction.
-   For each of the`lines` in the invoice, we'll need to know the total`amount` of the line.

Here’s what the smallest possible transaction looks like:

```
POST /api/v2/transactions/create{  "companyCode": "DEVGUIDE",  "code": "1001",  "type": "SalesOrder",  "date": "2017-06-15",  "customerCode": "EXAMPLECUSTOMER",  "addresses": {    "singleLocation": {      "line1": "100 Ravine Lane NE",      "city": "Bainbridge Island",      "region": "WA",      "country": "US",      "postalCode": "98110"    }  },  "lines": [    {      "amount": 100    }  ]}
```

Now let's understand why AvaTax requires these key fields.

[Previous](/avatax-dm-combined-erp/sales-tax-badge/transactions)

[Next](/avatax-dm-combined-erp/sales-tax-badge/transactions/simple-transactions/company-codes)