> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# BulkUpsertContactTaxDetails

# Package: tax

# Namespace: ContactTaxDetailsService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/contact-tax-details/bulk-upsert-contact-tax-details.md

## Permission Scopes:
Manage Orders: SCOPE.DC-STORES.MANAGE-ORDERS

## Introduction

Creates or updates the tax details of multiple contacts in a single request.

For each contact, if tax details already exist they're updated. Otherwise, new tax details are created.

To create or update tax details for a single contact, call [Upsert Contact Tax Details](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/contact-tax-details/upsert-contact-tax-details.md).

---

## REST API

### Schema

```
 Method: bulkUpsertContactTaxDetails
 Description: Creates or updates the tax details of multiple contacts in a single request.  For each contact, if tax details already exist they're updated. Otherwise, new tax details are created.  To create or update tax details for a single contact, call [Upsert Contact Tax Details](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/contact-tax-details/upsert-contact-tax-details.md).
 URL: https://www.wixapis.com/billing/v1/bulk/contact-tax-details/upsert
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  contactTaxDetails
 Method parameters: 
   param name: contactTaxDetails | type: array<contactTaxDetails> | description: Contact tax details to create or update. | required: true | validation: minItems 1, maxItems 100
              - name: id | type: string | description: Contact GUID. Also serves as the GUID of the contact tax details, since each contact has a single set of tax details.  | validation: format GUID
              - name: taxExemptGroupId | type: string | description: GUID of the tax exempt group the contact is associated with. Setting this value makes the contact eligible for the group's tax exemption at checkout.  | validation: format GUID
              - name: contactDetails | type: ContactDetails | description: The contact's details, such as name, email, and VAT GUID.  Returned only when `CONTACT_DETAILS` is passed to the `fields` array in the request.  
              - name: extendedFields | type: ExtendedFields | description: Custom field data for the contact tax details.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
                 - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
              - name: tags | type: Tags | description: Tags associated with the contact tax details.  
                 - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.  
                    - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
                 - name: publicTags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
   param name: fields | type: array<fields> | description: Additional fields to return in the response.  Supported values: `CONTACT_DETAILS`  | validation: maxItems 10
                 - enum:
                 -     CONTACT_DETAILS: Returns the contact's details, including first name, last name, company, email, and VAT ID.
   param name: returnEntity | type: returnEntity | description: Whether to return the created or updated contact tax details in the response.  Default: `false`  
 Return type: BulkUpsertContactTaxDetailsResponse
  - name: results | type: array<BulkContactTaxDetailsResult> | description: Results of the bulk upsert operation.  | validation: minItems 1, maxItems 100
     - name: itemMetadata | type: ItemMetadata | description: Metadata for the single upsert operation.  
        - name: id | type: string | description: Item GUID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.  | validation: format GUID
        - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.  | validation: minimum 0
        - name: success | type: boolean | description: Whether the requested action for this item was successful. When `false`, the `error` field is returned.  
        - name: error | type: ApplicationError | description: Details about the error in case of failure.  
           - name: code | type: string | description: Error code.  
           - name: description | type: string | description: Description of the error.  
           - name: data | type: object | description: Data related to the error.  
     - name: item | type: ContactTaxDetails | description: Created or updated contact tax details. Returned only if `returnEntity` is `true` in the request.  
        - name: id | type: string | description: Contact GUID. Also serves as the GUID of the contact tax details, since each contact has a single set of tax details.  | validation: format GUID
        - name: revision | type: string | description: Revision number, which increments by 1 each time the contact tax details are updated.  | read-only: true | validation: format int64
        - name: createdDate | type: string | description: Date and time the contact tax details were created.  | read-only: true | validation: format date-time
        - name: updatedDate | type: string | description: Date and time the contact tax details were updated.  | read-only: true | validation: format date-time
        - name: taxExemptGroupId | type: string | description: GUID of the tax exempt group the contact is associated with. Setting this value makes the contact eligible for the group's tax exemption at checkout.  | validation: format GUID
        - name: contactDetails | type: ContactDetails | description: The contact's details, such as name, email, and VAT GUID.  Returned only when `CONTACT_DETAILS` is passed to the `fields` array in the request.  
           - name: firstName | type: string | description: Contact's first name.  | read-only: true | validation: maxLength 100
           - name: lastName | type: string | description: Contact's last name.  | read-only: true | validation: maxLength 100
           - name: company | type: string | description: Contact's company name.  | read-only: true | validation: maxLength 100
           - name: email | type: string | description: Contact's email address.  | read-only: true | validation: format EMAIL
           - name: vatId | type: string | description: Contact's VAT GUID. Read from the contact's `invoices.vatId` extended field, so it's empty unless that field is set on the contact.  | read-only: true | validation: maxLength 100
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the contact tax details.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: tags | type: Tags | description: Tags associated with the contact tax details.  
           - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.  
              - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
           - name: publicTags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
  - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk upsert operation metadata.  
     - name: totalSuccesses | type: integer | description: Number of items that were successfully processed.  | validation: minimum 0
     - name: totalFailures | type: integer | description: Number of items that couldn't be processed.  | validation: minimum 0
     - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.  | validation: minimum 0


```

### Examples

### Bulk Upsert Contact Tax Details
Associates multiple contacts with tax exempt groups in a single request.

```curl
curl -X POST \
    'https://www.wixapis.com/billing/v1/bulk/contact-tax-details/upsert' \
    -H 'Authorization: <AUTH>' \
    -H 'Content-Type: application/json' \
    -d '{
    "contactTaxDetails": [
      {
        "id": "f1c3e2a0-1b2c-4d5e-8f90-1a2b3c4d5e6f",
        "taxExemptGroupId": "8046df3c-7575-4098-a5ab-c91ad8f33c47"
      },
      {
        "id": "a2b4d6e8-2c3d-4e5f-9a01-2b3c4d5e6f70",
        "taxExemptGroupId": "8046df3c-7575-4098-a5ab-c91ad8f33c47"
      }
    ],
    "returnEntity": true
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.ecom.contactTaxDetails.bulkUpsertContactTaxDetails(contactTaxDetails, options)
 Description: Creates or updates the tax details of multiple contacts in a single request.  For each contact, if tax details already exist they're updated. Otherwise, new tax details are created.  To create or update tax details for a single contact, call [Upsert Contact Tax Details](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/tax/contact-tax-details/upsert-contact-tax-details.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  contactTaxDetails
 Method parameters: 
   param name: contactTaxDetails | type: array<array> | description: Contact tax details to create or update. | required: true | validation: minItems 1, maxItems 100
              - name: _id | type: string | description: Contact GUID. Also serves as the GUID of the contact tax details, since each contact has a single set of tax details.  | validation: format GUID
              - name: taxExemptGroupId | type: string | description: GUID of the tax exempt group the contact is associated with. Setting this value makes the contact eligible for the group's tax exemption at checkout.  | validation: format GUID
              - name: contactDetails | type: ContactDetails | description: The contact's details, such as name, email, and VAT GUID.  Returned only when `CONTACT_DETAILS` is passed to the `fields` array in the request.  
              - name: extendedFields | type: ExtendedFields | description: Custom field data for the contact tax details.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
                 - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
              - name: tags | type: Tags | description: Tags associated with the contact tax details.  
                 - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.  
                    - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
                 - name: publicTags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
   param name: options | type: BulkUpsertContactTaxDetailsOptions  none  
        - name: returnEntity | type: boolean | description: Whether to return the created or updated contact tax details in the response.  Default: `false`  
        - name: fields | type: array<ContactTaxDetailsRequestedFields> | description: Additional fields to return in the response.  Supported values: `CONTACT_DETAILS`  | validation: maxItems 10
             - enum:
             -     CONTACT_DETAILS: Returns the contact's details, including first name, last name, company, email, and VAT ID.
 Return type: PROMISE<BulkUpsertContactTaxDetailsResponse>
  - name: results | type: array<BulkContactTaxDetailsResult> | description: Results of the bulk upsert operation.  | validation: minItems 1, maxItems 100
     - name: itemMetadata | type: ItemMetadata | description: Metadata for the single upsert operation.  
        - name: _id | type: string | description: Item GUID. Provided only whenever possible. For example, `itemId` can't be provided when item creation has failed.  | validation: format GUID
        - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items.  | validation: minimum 0
        - name: success | type: boolean | description: Whether the requested action for this item was successful. When `false`, the `error` field is returned.  
        - name: error | type: ApplicationError | description: Details about the error in case of failure.  
           - name: code | type: string | description: Error code.  
           - name: description | type: string | description: Description of the error.  
           - name: data | type: object | description: Data related to the error.  
     - name: item | type: ContactTaxDetails | description: Created or updated contact tax details. Returned only if `returnEntity` is `true` in the request.  
        - name: _id | type: string | description: Contact GUID. Also serves as the GUID of the contact tax details, since each contact has a single set of tax details.  | validation: format GUID
        - name: revision | type: string | description: Revision number, which increments by 1 each time the contact tax details are updated.  | read-only: true | validation: format int64
        - name: _createdDate | type: Date | description: Date and time the contact tax details were created.  | read-only: true 
        - name: _updatedDate | type: Date | description: Date and time the contact tax details were updated.  | read-only: true 
        - name: taxExemptGroupId | type: string | description: GUID of the tax exempt group the contact is associated with. Setting this value makes the contact eligible for the group's tax exemption at checkout.  | validation: format GUID
        - name: contactDetails | type: ContactDetails | description: The contact's details, such as name, email, and VAT GUID.  Returned only when `CONTACT_DETAILS` is passed to the `fields` array in the request.  
           - name: firstName | type: string | description: Contact's first name.  | read-only: true | validation: maxLength 100
           - name: lastName | type: string | description: Contact's last name.  | read-only: true | validation: maxLength 100
           - name: company | type: string | description: Contact's company name.  | read-only: true | validation: maxLength 100
           - name: email | type: string | description: Contact's email address.  | read-only: true | validation: format EMAIL
           - name: vatId | type: string | description: Contact's VAT GUID. Read from the contact's `invoices.vatId` extended field, so it's empty unless that field is set on the contact.  | read-only: true | validation: maxLength 100
        - name: extendedFields | type: ExtendedFields | description: Custom field data for the contact tax details.  [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) must be configured in the app dashboard before they can be accessed with API calls.  
           - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map
        - name: tags | type: Tags | description: Tags associated with the contact tax details.  
           - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors.  
              - name: tagIds | type: array<string> | description: List of tag GUIDs.  | validation: maxItems 100, maxLength 5
           - name: publicTags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors.  
  - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk upsert operation metadata.  
     - name: totalSuccesses | type: integer | description: Number of items that were successfully processed.  | validation: minimum 0
     - name: totalFailures | type: integer | description: Number of items that couldn't be processed.  | validation: minimum 0
     - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded.  | validation: minimum 0


```

### Examples

### bulkUpsertContactTaxDetails
```javascript
import { contactTaxDetails } from '@wix/ecom';

async function bulkUpsertContactTaxDetails(contactTaxDetails,options) {
  const response = await contactTaxDetails.bulkUpsertContactTaxDetails(contactTaxDetails,options);
};
```

### bulkUpsertContactTaxDetails (with elevated permissions)
```javascript
import { contactTaxDetails } from '@wix/ecom';
import { auth } from '@wix/essentials';

async function myBulkUpsertContactTaxDetailsMethod(contactTaxDetails,options) {
  const elevatedBulkUpsertContactTaxDetails = auth.elevate(contactTaxDetails.bulkUpsertContactTaxDetails);
  const response = await elevatedBulkUpsertContactTaxDetails(contactTaxDetails,options);
}
```

### bulkUpsertContactTaxDetails (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { contactTaxDetails } from '@wix/ecom';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { contactTaxDetails },
  // Include the auth strategy and host as relevant
});


async function bulkUpsertContactTaxDetails(contactTaxDetails,options) {
  const response = await myWixClient.contactTaxDetails.bulkUpsertContactTaxDetails(contactTaxDetails,options);
};
```

---