# Exemption

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

Guide: Communications

# Exemption

This example shows how to run an AFC calculation for a Video Streaming. This example removes a tax type 1 due to exemption with a domain of "City" and Scope of all levels.

In this example:

-   Customer type is `0` (Residential)

-   Exemption location PCode is `3775200`

-   Exemption type (`tpe`) is `1`

-   Exemption domain (`dom`) is `3` (city)

-   Exemption scope (`scp`) is `1920` (all)

-   T/S pair is `57/672` (Digital Goods/Streaming Video - On-Net - Live)

## Request

**View example**:

```
curl --location --request POST 'https://communicationsua.avalara.net/api/v2/afc/CalcTaxes' \
--header 'client_id: 787' \
--header 'client_profile_id;' \
--header 'Authorization: Basic {Base64-encoded credentials}' \
--header 'Content-Type: application/json' \
--data-raw '{ // Author MJ Nelson
    "cmpn": { //--The Company Object.  REQUIRED.  This object has data elements that are normally managed via textboxes / checkboxes in a Company Admin screen of the billing platform itself.  You of course can hard code these values if that is more expedient and the company'\''s business model is static.
"bscl": 1, //--Business Class: Typical value is "1". Is the provider and an Incumbant Local Exchange Carrier ("ILEC",  basically those companies that own the wire, antennas and switches of a network) or not?   0=ILEC, 1=NOT an ILEC (or Competitive Local Exchange Carrier "CLEC"). Streaming default to "1"
"svcl": 0, //--Service Class:  Is the provider Primarily a local service provider, or long distance?   0=Primary Local; 1=Primary Long Distance.  Streaming default: 0.
"fclt": false, //--Facilities:  Does the company providing the service have facilities to provide the service?  Streaming default: false.
"frch": false, //--Franchise:  Indicates if the company provides services sold pursuant to a franchise agreement between the carrier and jurisdiction. Streaming default: false.
"reg": false //--Regulated:  Is the Seller is regulated?  Streaming default: false.
    },
    "inv": [
{
    "doc": "StreamingContent1", //--Document Code:  Required.  A unique value that is used to Commit transactions through the Commit API. Do NOT use InvoiceNumber.  GUID preferable. Every unique call must have a unique "doc".
    "exms": [ // Added by MAW
{
    "description": "Example exemption, removes tax type 1 under the Sales Tax Category",
    "loc": {
"pcd" : 3775200
     },
    "tpe" : 1,
    //"cat" : 0,
    "dom" : 3,  // 0 - federal, 1 - state, 2 - county, 3 - city
    "scp" : 1920  // 128: Federal, 256: State, 512: County, 1024: Local For example: To exempt all, use 1920 (Federal + State + County+Local)
}
    ],
    "cmmt": false, //--Commit:  Required.  The status of transaction for end of period compliance reporting.  Previously CalcTaxes uncommitted transactions can be committed through the Commit API.
    "bill": { //--Bill To Object:  Calculates taxed based on the granularity of the address. Options include: passing only Preassigned Pcode value in PCD value via the GEO/PCODE APIs.  The actual address fields: the more granular the address, the more accurate the results.
"ctry": "USA", //--Country ISO Code
"int": true, //--Optional: Incorporated.  Is the location within an Incorporated city.   Default to '\''true'\'' if not a tangible field within the billing platform.  Pass '\''addr'\'','\''city'\'','\''st'\'','\''zip'\'','\''ctry'\'' and you can not pass at all.  Pre-assign PCODE via GEO or PCode API, and not needed.
"geo": false, //--Optional: Geocode: Do you want to send a sub-call to Geocode the location?  For larger transaction volumes, it is better to utilize the Geo API and do this prior to CalcTaxes.  Larger volumes will see performance degradation if '\''true'\''.
"pcd": 0, //--Optional: PCode:  You can pass only this value in the BillTo object.  Preassigned values are handled via the GEO and PCODE APIs.
"addr": "110 Main St", //--Address: Street Address
"city": "Houston", //--City:  City Name
"st": "TX", //--State or Province
"zip": "77002" //--Zip or Canadian Postal Code
    },
    "cust": 0, //--Customer Type: Required.  Default to "0" for Streaming.
    "date": "2021-01-01T12:00:00Z",
    "itms": [
{
    "ref": "StreamingVideo_OnNetLive", //--Invoice Line Number
     "chg": 100, //--Charge amount in native currency of "bill"
    "sale": 1, //--Sale Type:  0=Wholesale, 1=Retail, 2=Consumed (Sales and Use Only), 3=Vendor Use. REQUIRED. Streaming default to "1"
    "incl": false, //--Tax Inclusive:  Indicates if "chg" has tax already included in the amount.
    "tran": 57, //--Transaction Type: Industry vertical...see mapping guidelines for this. REQUIRED
    "serv": 672, //--Service Type:  Billable services for an industry vertical....see mapping guidelines for this. REQUIRED
    "adj": false //--Adjustment:  True, will negate taxes. False, will return positive taxes.  Default is False.
}
    ],
    "invm": true,
    "dtl": false,
    "summ": true,
    "acct": "Broadcaster", //--Account Reference: Optional.  Return an account reference in the Response.
    "custref": "Customer1234", //--Customer Reference: Required. Return a customer reference in the Response.
    "invn": "Invoice1234", //--Invoice Number Reference: Required.  Used for reporting.
    "bcyc": "202010", //--Bill Cycle Reference: Required. Used for reporting.
    "bpd": { //--Billing Period Object: Used for reporting.
"month": "10",
"year": "2020"
    },
    "opt": [
{
    "key": "1",
    "val": "StreamingSamples"
}
    ]
}
    ]
}'
```

## Response

**View example**:

```
{
    "inv": [{    "doc": "StreamingContent1",    "itms": [
{}    ],    "summ": [
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 100.0,
    "calc": 1,
    "cat": "SALES AND USE TAXES",
    "cid": 1,
    "name": "Transit Tax",
    "exm": 0.0,
    "lns": 0,
    "pcd": 3775200,
    "rate": 0.01,
    "sur": false,
    "tax": 1.0,
    "lvl": 3,
    "tid": 33
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.0,
    "calc": 1,
    "cat": "SALES AND USE TAXES",
    "cid": 1,
    "name": "Sales Tax",
    "exm": 100.0,
    "lns": 0,
    "pcd": 3775200,
    "rate": 0.01,
    "sur": true,
    "tax": 0.0,
    "lvl": 3,
    "tid": 1
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.0,
    "calc": 1,
    "cat": "SALES AND USE TAXES",
    "cid": 1,
    "name": "Sales Tax",
    "exm": 100.0,
    "lns": 0,
    "pcd": 3775200,
    "rate": 0.0625,
    "sur": true,
    "tax": 0.0,
    "lvl": 1,
    "tid": 1
}    ]}
    ]
}
```