# UpdateUPC

Update a single UPC

`PUT /api/v2/companies/{companyId}/upcs/{id}`

**API:** AvaTax API
**Tag:** Upcs
**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/Upcs/UpdateUPC/

## Description

Replace the existing UPC object at this URL with an updated object.
A UPC represents a single UPC code in your catalog and matches this product to the tax code identified by this UPC.
All data from the existing object will be replaced with data in the object you PUT.
To set a field's value to null, you may either set its value to null or omit that field from the object you post.

### Security Policies

* This API requires one of the following user roles: AccountAdmin, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
* This API depends on the following active services:*Required* (all):  AvaUpc.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes | The ID of the company that this UPC belongs to. |
| `id` | integer | path | Yes | The ID of the UPC you wish to update |
| `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:** `UPCModel`

One Universal Product Code object as defined for your company.

| Property | Type | Required | Description |
|---|---|---|---|
| `id` | integer | No | The unique ID number for this UPC. Example: `123456789`. |
| `companyId` | integer | No | The unique ID number of the company to which this UPC belongs. Example: `1234567`. |
| `upc` | string | **Yes** | The 12-14 character Universal Product Code, European Article Number, or Global Trade Identification Number. Example: `023032550992`. |
| `legacyTaxCode` | string | No | Legacy Tax Code applied to any product sold with this UPC. Example: `PS081282`. |
| `description` | string | **Yes** | Description of the product to which this UPC applies. Example: `Yarn`. |
| `effectiveDate` | string | No | If this UPC became effective on a certain date, this contains the first date on which the UPC was effective. |
| `endDate` | string | No | If this UPC expired or will expire on a certain date, this contains the last date on which the UPC was effective. |
| `usage` | integer | No | A usage identifier for this UPC code. |
| `isSystem` | integer | No | A flag indicating whether this UPC code is attached to the AvaTax system or to a company. |
| `createdDate` | string | No | The date when this record was created. |
| `createdUserId` | integer | No | The User ID of the user who created this record. |
| `modifiedDate` | string | No | The date/time when this record was last modified. |
| `modifiedUserId` | integer | No | The user ID of the user who last modified this record. |

## Responses

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

### 200 Response: `UPCModel`

One Universal Product Code object as defined for your company.

| Property | Type | Required | Description |
|---|---|---|---|
| `id` | integer | No | The unique ID number for this UPC. Example: `123456789`. |
| `companyId` | integer | No | The unique ID number of the company to which this UPC belongs. Example: `1234567`. |
| `upc` | string | **Yes** | The 12-14 character Universal Product Code, European Article Number, or Global Trade Identification Number. Example: `023032550992`. |
| `legacyTaxCode` | string | No | Legacy Tax Code applied to any product sold with this UPC. Example: `PS081282`. |
| `description` | string | **Yes** | Description of the product to which this UPC applies. Example: `Yarn`. |
| `effectiveDate` | string | No | If this UPC became effective on a certain date, this contains the first date on which the UPC was effective. |
| `endDate` | string | No | If this UPC expired or will expire on a certain date, this contains the last date on which the UPC was effective. |
| `usage` | integer | No | A usage identifier for this UPC code. |
| `isSystem` | integer | No | A flag indicating whether this UPC code is attached to the AvaTax system or to a company. |
| `createdDate` | string | No | The date when this record was created. |
| `createdUserId` | integer | No | The User ID of the user who created this record. |
| `modifiedDate` | string | No | The date/time when this record was last modified. |
| `modifiedUserId` | integer | No | The user ID of the user who last modified this record. |

## Example Request

```bash
curl -X PUT "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/upcs/{id}" \
  -H "Authorization: Basic <credentials>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
  "id": 123456789,
  "companyId": 1234567,
  "upc": "023032550992",
  "legacyTaxCode": "PS081282",
  "description": "Yarn"
}'
```