# API workflows

Source: https://developer.avalara.com/ai-onboarding/nqj3682559757791/

# API workflows

The following sections describe the API workflows used during onboarding, including decision flows, item classification, and address validation.

## Onboarding API decision flow

This section explains how the onboarding workflow selects the appropriate API actions based on the current onboarding step and whether the configuration is new, existing, or mapped.

![Onboarding API Decision Flow](https://knowledge-be.avalara.com/bundle/fuh1905384702210_fuh1905384702210/page/haf0175886498201.image?_LANG=enus)

Table 1. API usage by onboarding step

Onboarding step

Primary APIs

Purpose

**Step 2: Preflight**

`[QueryCompanies](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Companies/QueryCompanies/)`, `[ListNexusByCompany](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Nexus/ListNexusByCompany/)`

Detect existing AvaTax configuration to support intelligent mapping decisions.

**Step 3: Company setup**

`[CreateCompanies](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Companies/CreateCompanies/)`, `[CompanyInitialize](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Companies/CompanyInitialize/)`

Create a new AvaTax company or map an existing company to an ERP entity.

**Step 4: Nexus**

`[ResolveAddressPost](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Addresses/ResolveAddressPost/)`, `[CreateNexus](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Nexus/CreateNexus/)`

Validate addresses, extract jurisdiction information, and declare nexus.

**Step 5: Items**

`TaxCodeRecommendations`, `[CreateItemClassifications](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Items/CreateItemClassifications/)`

Perform AI-assisted tax code classification with a selected storage destination.

**Step 6: Customers**

`[CreateCustomers](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Customers/CreateCustomers/)`, `[CreateCertExpressInvitation](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/CertExpressInvites/CreateCertExpressInvitation/)`

Synchronize customers to ECMS and manage exemption certificate onboarding.

**Execution model**

Each onboarding step implements API calls immediately after user confirmation. Changes are applied when the user approves them. There’s no batch execution at the end of the onboarding process.

## Item classification workflow

**This section describes the API sequence used to classify ERP items and assign AvaTax tax codes during onboarding.**

Item classification follows this workflow:

-   **Read items from ERP**: The product catalog is retrieved from the ERP system, including item descriptions and attributes.

-   **Generate tax code recommendations**: The `TaxCodeRecommendations` API is called to generate AvaTax tax code suggestions based on item attributes.

-   **User review of recommendations**: The user reviews the suggested tax codes and can accept, reject, or modify recommendations at the item or group level.

-   **Storage decision**: The user selects where the tax codes should be stored:

    -   ERP only, or

    -   AvaTax

-   **Execute classification**: Based on the selected storage destination:

    -   Tax codes are written to ERP item fields, or

    -   The `[CreateItemClassifications](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Items/CreateItemClassifications/)` API is implemented to store classifications in AvaTax.

**Bulk classification support**

Currently, items are classified individually during onboarding. A bulk classification API is coming soon to support faster onboarding for large item catalogs.

## Address validation and jurisdiction extraction

This section describes how address data is validated and converted into jurisdiction information used by nexus and customer-related workflows.

The `[ResolveAddressPost](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Addresses/ResolveAddressPost/)` API is central to address validation and jurisdiction determination during onboarding and post onboarding workflows.

The API is used as follows:

1.  **Input**: Raw address data sourced from ERP location records or customer records.

2.  **Validation**: The address is standardized, corrected, and geocoded to ensure accuracy and consistency.

3.  **Jurisdiction extraction**: The API returns jurisdiction identifiers, including:

    -   State

    -   County

    -   City

    -   Special districts

4.  **Nexus proposal support**: The AI agent uses the extracted jurisdiction codes to evaluate physical presence and recommend appropriate nexus declarations.