# LinkAttributesToCustomer

Link attributes to a customer

`PUT /api/v2/companies/{companyId}/customers/{customerCode}/attributes/link`

**API:** AvaTax API
**Tag:** Customers
**API Version:** v2
**Base URL:** https://sandbox-rest.avatax.com/
**Content-Type:** `application/json`
**Accepts:** `application/json`
**Authentication:** API Key (`Authorization` in header) or OAuth 2.0 or Basic (username + license key)

Source: https://developer.avalara.com/products/crossborder/api/methods/Customers/LinkAttributesToCustomer/

## Description

Link one or many attributes to a customer.
            
A customer may have multiple attributes that control its behavior.  You may link or unlink attributes to a
customer at any time.  The full list of defined attributes may be found using `QueryCompanyCustomerAttributes` API.
            
A customer object defines information about a person or business that purchases products from your
company.  When you create a tax transaction in AvaTax, you can use the `customerCode` from this
record in your `CreateTransaction` API call.  AvaTax will search for this `customerCode` value and
identify any certificates linked to this customer object.  If any certificate applies to the transaction,
AvaTax will record the appropriate elements of the transaction as exempt and link it to the `certificate`.
            
Before you can use any exemption certificates endpoints, you must set up your company for exemption certificate data storage.
Companies that do not have this storage system set up will see `CertCaptureNotConfiguredError` when they call exemption
certificate related APIs. To check if this is set up for a company, call `GetCertificateSetup`.  To request setup of exemption
certificate storage for this company, call `RequestCertificateSetup`.

### Security Policies

* This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin.
* This API depends on the following active services:*Required* (all):  AvaTaxPro, ECMEssentials, ECMPro, ECMPremium, VEMPro, VEMPremium, ECMProComms, ECMPremiumComms.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes | The unique ID number of the company that recorded the provided customer |
| `customerCode` | string | path | Yes | The unique code representing the current customer |
| `X-Avalara-Client` | string | header | No | Identifies the software you are using to call this API.  For more information on the client header, see [Client Headers](https://developer.avalara.com/avatax/client-headers/) . |

## Request Body

**Schema:** `CustomerAttributeModel[]`

A Customer's linked attribute denoting what features applied to the customer. A customer can
be linked to multiple customer attributes and vice versa.

| Property | Type | Required | Description |
|---|---|---|---|
| `id` | integer | No | A unique ID number representing this attribute. Example: `1`. |
| `name` | string | No | A friendly readable name for this attribute. Example: `ADDRESS CHANGE NEEDED`. |
| `description` | string | No | A full help text description of the attribute. Example: `Customer address change is needed.`. |
| `isSystemCode` | boolean | No | This value is true if this is a system-defined attribute.  System-defined attributes
cannot be modified or deleted on the CertCapture website. Example: `false`. |
| `isNonDeliver` | boolean | No | A flag denotes that future exemption certificate request won't be mailed to the customer Example: `true`. |
| `isChangeable` | boolean | No | A flag denotes that this attribute can't be removed/added to a customer record Example: `true`. |

## Responses

| Status | Description | Schema |
|---|---|---|
| 200 | Success | `CustomerAttributeModelFetchResult` |

### 200 Response: `CustomerAttributeModelFetchResult`

| Property | Type | Required | Description |
|---|---|---|---|
| `@recordsetCount` | integer | No |  |
| `value` | CustomerAttributeModel[] | No |  |
| `@nextLink` | string | No |  |
| `pageKey` | string | No |  |

## Example Request

```bash
curl -X PUT "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/customers/{customerCode}/attributes/link" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '[
  {
    "id": 1,
    "name": "ADDRESS CHANGE NEEDED",
    "description": "Customer address change is needed.",
    "isSystemCode": false,
    "isNonDeliver": true,
    "isChangeable": true
  }
]'
```