# QueryCertificates

List all certificates for a company

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

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

## Description

List all certificates recorded by a company
            
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.
            
You can use the `$include` parameter to fetch the following additional objects for expansion:
            
* customers - Retrieves the list of customers linked to the certificate.
* po_numbers - Retrieves all PO numbers tied to the certificate.
* attributes - Retrieves all attributes applied to the certificate.
* histories - Retrieves the certificate update history
* jobs - Retrieves the jobs for this certificate
* jobs.phases - Retrieves the jobs along with their phases
* jobs.tasks - Retrieves the jobs along with their phases and the tasks within each phase
* logs - Retrieves the certificate log
* invalid_reasons - Retrieves invalid reasons for this certificate if the certificate is invalid
* custom_fields - Retrieves custom fields set for this certificate
* jurisdictions - Retrieves the list of jurisdictions associated with 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, TechnicalSupportUser.
* 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 ID number of the company to search |
| `$include` | string | query | No | OPTIONAL: A comma separated list of special fetch options.  You can specify one or more of the following:
            
             * customers - Retrieves the list of customers linked to the certificate.
             * po_numbers - Retrieves all PO numbers tied to the certificate.
             * attributes - Retrieves all attributes applied to the certificate.
             * histories - Retrieves the certificate update history
             * jobs - Retrieves the jobs for this certificate
             * jobs.phases - Retrieves the jobs along with their phases
             * jobs.tasks - Retrieves the jobs along with their phases and the tasks within each phase
             * logs - Retrieves the certificate log
             * invalid_reasons - Retrieves invalid reasons for this certificate if the certificate is invalid
             * custom_fields - Retrieves custom fields set for this certificate
             * jurisdictions - Retrieves the list of jurisdictions associated with the certificate |
| `$filter` | string | query | No | A filter statement to identify specific records to retrieve.  For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).*Not filterable:* exemptionNumber, ecmsId, ecmsStatus, pdf, pages |
| `$top` | integer | query | No | If nonzero, return no more than this number of results.  Used with `$skip` to provide pagination for large datasets.  Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records. |
| `$skip` | integer | query | No | If nonzero, skip this number of results before returning data.  Used with `$top` to provide pagination for large datasets. |
| `$orderBy` | string | query | No | A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`. |
| `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 | `CertificateModelFetchResult` |
| 400 | Bad Request | `ProblemDetails` |
| 401 | Unauthorized | `ProblemDetails` |
| 404 | Not Found | `ProblemDetails` |

### 200 Response: `CertificateModelFetchResult`

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

## Example Request

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