# LinkAttributesToCertificate

Link attributes to a certificate

`POST /api/v2/companies/{companyId}/certificates/{id}/attributes/link`

**API:** AvaTax API
**Tag:** Certificates
**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/avatax/api/methods/Certificates/LinkAttributesToCertificate/

## Description

Link one or many attributes to a certificate.
            
A certificate may have multiple attributes that control its behavior.  You may link or unlink attributes to a
certificate at any time.  The full list of defined attributes may be found using `ListCertificateAttributes`.
            
A certificate is a document stored in either AvaTax Exemptions or CertCapture.  The certificate document
can contain information about a customer's eligibility for exemption from sales or use taxes based on
criteria you specify when you store the certificate.  To view or manage your certificates directly, please
log onto the administrative website for the product you purchased.
            
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 this certificate |
| `id` | integer | path | Yes | The unique ID number of this certificate |
| `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:** `CertificateAttributeModel[]`

A certificate attribute can be thought of as a feature or flag that is applied to a certificate.
A single certificate can be linked to zero, one, or many certificate attributes.  The full list of
attributes can be obtained by calling the `ListCertificateAttributes` API.

| Property | Type | Required | Description |
|---|---|---|---|
| `id` | integer | No | A unique ID number representing this certificate attribute. Example: `0`. |
| `name` | string | No | A friendly readable name for this certificate attribute. Example: `DIRECT PAY`. |
| `description` | string | No | A full help text description of the certificate attribute. |
| `isSystemCode` | boolean | No | This value is true if this is a system-defined certificate attribute.  System-defined attributes
cannot be modified or deleted on the CertCapture website. Example: `false`. |

## Responses

| Status | Description | Schema |
|---|---|---|
| 200 | Success | `CertificateAttributeModelFetchResult` |
| 400 | Bad Request | `ProblemDetails` |
| 401 | Unauthorized | `ProblemDetails` |
| 404 | Not Found | `ProblemDetails` |

### 200 Response: `CertificateAttributeModelFetchResult`

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

## Example Request

```bash
curl -X POST "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/certificates/{id}/attributes/link" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '[
  {
    "id": 0,
    "name": "DIRECT PAY",
    "isSystemCode": false
  }
]'
```