# ListUserDefinedFieldsByCompanyId

`GET /api/v2/companies/{companyId}/userdefinedfields`

**API:** AvaTax API
**Tag:** UserDefinedFields
**API Version:** v2
**Base URL:** https://sandbox-rest.avatax.com/
**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/UserDefinedFields/ListUserDefinedFieldsByCompanyId/

## Description

### Security Policies

* This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, ECMAccountUser, ECMCompanyUser, FirmAdmin, FirmUser, ProStoresOperator, Registrar, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
* This API depends on the following active services:*Required* (all):  AvaTaxPro, BasicReturns.

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `companyId` | integer | path | Yes |  |
| `udfType` | string | query | No | Document or Line level UDF |
| `allowDefaults` | boolean | query | No | If true this will add defaulted UDFs to the list that are not named yet |
| `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/) . |

## Responses

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

### 200 Response: `CompanyUserDefinedFieldModelFetchResult`

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

## Example Request

```bash
curl -X GET "https://sandbox-rest.avatax.com/api/v2/companies/{companyId}/userdefinedfields" \
  -H "Authorization: Basic <credentials>" \
  -H "Accept: application/json"
```