POST

Bulk Insert Data Items


Adds multiple items to a collection.

When each item is inserted into a collection, its ID is automatically assigned a random value. You can optionally provide your own ID when inserting the item. If you specify an ID that already exists in the collection, the insertion will fail.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage All Data Resources
Manage Data Items
Write Data Items
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/wix-data/v2/bulk/items/insert

Body Params
dataCollectionIdstringRequiredmaxLength 256

ID of the collection in which to insert the items.


dataItemsArray <DataItem>RequiredmaxItems 1000

Data items to insert.


returnEntityboolean

Whether to return the inserted data items. When true, the results objects contain a dataItem field.

Default: false


appOptionsstruct

Additional parameters specific to the Wix app collection you are querying.

When querying the Wix Stores Products collection, pass the following optional parameters:

  • includeHiddenProducts: Whether to include hidden products in the response. Default: false.
  • includeVariants: Whether to include product variants in the query. Default: false.
Response Object
resultsArray <BulkDataItemResult>

Information about the inserted items.


bulkActionMetadataBulkActionMetadata

Bulk action metadata.

Request
cURL
curl -X POST \ 'https://www.wixapis.com/wix-data/v2/bulk/items/insert' \ -H 'Content-Type: application/json' \ -H 'Authorization: <AUTH>' \ -d '{ "dataCollectionId": "cities", "dataItems": [ { "data": { "state": "California", "year": 2022, "city": "Los Angeles", "population": 3800000 } }, { "data": { "state": "California", "year": 2022, "city": "San Francisco", "population": 840000 } } ] }'
Response
JSON
{ "results": [ { "action": "INSERT", "itemMetadata": { "id": "aa019290-b546-4b3e-b302-8f6474baedf9", "originalIndex": 0, "success": true } }, { "action": "INSERT", "itemMetadata": { "id": "39cbd938-7b42-4e33-8acf-ff1ce278664c", "originalIndex": 1, "success": true } } ], "bulkActionMetadata": { "totalSuccesses": 2, "totalFailures": 0 } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Event TriggersThis method triggers the following events:
Did this help?