# Commit scenarios

Source: https://developer.avalara.com/products/communications/integration-guides/communications-integration/aeu1588464096744/

Guide: Communications

# Commit scenarios

The first call for a given code (`doc`) establishes the committed state of the document and of all subsequent calls to AFC with that same document code. (Even if you try to set the `cmmt` flag to something else in the `CalculateTaxes` request, the commit state won’t change.) The `cmmt` flag in the `CalculateTaxes` request is a "use-once" feature that establishes the state of all the transactions for a particular document on its first call using `CalculateTaxes` in a particular reporting month.

The attribute `invn` attribute is used to ensure matching between systems.

The attribute `doc` is used to make sure you have a method to track your calls to AFC and to track blocks of transactions.

For example:

-   You could call the `CalculateTaxes` API with a `doc` of 1 and an `invn` of 1, and set `cmmt: true` in your first call. This call will be recorded and committed to AFC (tax liability is recorded).
-   You could call the `CalculateTaxes` API with a `doc` of 1 again, an `invn` of 1, and set `cmmt: false` in your second call. In this case, the commit flag has no effect, and you have just doubled the tax liability for `invn` 1.
-   You could call the `CalculateTaxes` API with a doc of 1.1, an `invn` of 1, and set `cmmt: true`. From a reporting perspective, you now have all three calls tied to `invn` 1.
-   You could call the Commit API for `doc` 1 and set `cmmt: false`. Now, you’ve removed the tax liabilities created in calls 1 and 2 above. For `invn` 1 you still have tax liabilities based on the call made in step 3 using doc 1.1.

To change the state of a give doc after the first call using `CalculateTaxes` for that doc, you must use the Commit endpoint. Calling this endpoint can also provide verification that all is well with the doc and the state of the document.