---
title: REST API – Refresh an online store order
description: "This page describes the operation that **re-runs the import of a document already downloaded from an online store**. It is the remote, batch equivalent of the \"Refresh from store\" button located on the document. | Operation | Method | Description…"
url: "https://www.kafinea.com/en/help/api/rest-api-refresh-an-online-store-order/"
updated: "2026-11-22"
category: API
---

# REST API – Refresh an online store order

This page describes the operation that **re-runs the import of a document already downloaded from an online
 store**. It is the remote, batch equivalent of the "Refresh from store"
 button located on the document.

| Operation | Method | Description |
| --- | --- | --- |
| `onlinestore_refresh_order` | POST | Re-run the import of a batch of documents from their store |

> **Restricted to administrators.** This operation rewrites sales management documents from
>  an external source.

---

## When to use it

A document imported from a store reflects the store **at the time of import**. If a store
 setting has changed since then (customer recognition, customer creation, a shipping fee
 rule, an added item or payment method mapping), the document does not retroactively benefit from the new
 setting. Refreshing re-runs it with the current settings, **subject to the safeguards below**.

The most common case: orders linked to the store's **fallback customer** because
 their customer was not yet recognized. You complete the mappings (see
 [Bulk Import](https://www.kafinea.com/en/help/api/rest-api-bulk-import-upsert/)) or you authorize customer creation on the store
 record, then you refresh the orders concerned: each one is re-assigned to its customer.

The same batch allows you to set the **payment method** after completing the
 **Payment mappings** on the store record. The method is retrieved with the current
 mapping. If this mapping remains to be completed, the refresh proceeds and keeps the method already
 present on the document. Payment terms are not modified by this mapping.

## What the operation guarantees

- **It updates the existing document**, without creating a second document.
- **It applies the standard checks for locked documents and linked records.** A document whose
   lines are included in an invoice, a delivery note, or a credit note is not refreshed: `errors`
   identifies this document, and the requested document remains unchanged.
- **It recalculates the tax region when provided by the store.** If no region applies
   anymore with the current configuration, the document no longer carries one and the **VAT to verify** notice indicates this.
- **A rejection does not prevent the processing of other documents.** The response indicates the document and the reason.
- **A new run remains possible for eligible documents**, with current data and
   settings. With identical source and settings, it maintains the same result.

Before launching a batch, review the data, history, and linked records of the documents concerned.
 Refreshing may overwrite adjustments made in Kafinea with store data;
 exclude documents to be kept from the submitted list. A **VAT to verify** notice or a
 **Store amount discrepancy** remains informational and does not, on its own, block invoicing.

---

## Refresh a batch of documents

> **POST** `https://apps.kafinea.com/{instance}/webservice.php`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `operation` | string | yes | `onlinestore_refresh_order` |
| `sessionName` | string | yes | Session ID obtained upon authentication |
| `ids` | string | yes | JSON array of document Webservice IDs, up to 100 maximum |

The originating store and order reference are **read from the document**: you do not need
 to provide anything else, and a document that does not originate from a store is flagged as such.

```bash
curl -X POST https://apps.kafinea.com/YourKafinea/webservice.php 
  -d "operation=onlinestore_refresh_order" 
  -d "sessionName=YOUR_SESSION_ID" 
  -d 'ids=["5x700001","5x700002"]'
```

Response example (all IDs on this page are fictitious):

```json
{
  "success": true,
  "result": {
    "processed": 2,
    "refreshed": 2,
    "documents": [
      {"index": 0, "id": "5x700001", "module": "SalesOrder", "externalRef": "DEMO-701", "storeId": 900001},
      {"index": 1, "id": "5x700002", "module": "SalesOrder", "externalRef": "DEMO-702", "storeId": 900001}
    ],
    "errors": []
  }
}
```

`index` is the position of the document in the submitted array: this allows you to find the
 line to correct when `errors` is not empty.

---

## Related references 🔗

- [Bulk import (identifier mapping)](https://www.kafinea.com/en/help/api/rest-api-bulk-import-upsert/)
- [Complete API reference](https://www.kafinea.com/en/help/api/rest-api-full-reference-openapi/)
- [Queries and search](https://www.kafinea.com/en/help/api/rest-api-requests-and-querying/)
- [Document tax region](https://www.kafinea.com/fr/documentation/parametrage/la-region-fiscale-des-documents/)
