Skip to main content

Overview

Use this mode when you want system-to-system integration from ERP, WMS, or custom services.

Configure API Credentials

Visit the API Quickstart to configure API credentials and make your first request.

Import Flow

1

Create an import

Create a new import to get a temporary importId.
const baseUrl = "https://api.algure.com/v1";
const authorization = "Basic <base64(clientId:clientSecret)>";

const createImportRes = await fetch(`${baseUrl}/products/import`, {
  method: "POST",
  headers: { Authorization: authorization },
});

if (!createImportRes.ok) {
  throw new Error(`Create import failed: ${createImportRes.status}`);
}

const productImport = await createImportRes.json();
console.log(productImport); // { id: "...", expiresAt: "..." }
2

Build the CSV feed

Build a UTF-8 CSV string from your source data using the required feed columns.
function buildAlgureCsv(rows) {
  const header = [
    "code",
    "description",
    "stock",
    "warehouseCode",
    "locationCode",
    "locationPriority",
    "costPrice",
    "packagingUnit",
    "lot",
  ].join(",");

  const lines = rows.map((r) =>
    [
      r.code,
      r.description,
      r.stock,
      r.warehouseCode,
      r.locationCode,
      r.locationPriority ?? "",
      r.costPrice,
      r.packagingUnit,
      r.lot ?? "",
    ].join(",")
  );

  return [header, ...lines].join("\n");
}
3

Upload the feed

Upload the CSV body using the importId from step 1.
const csv = buildAlgureCsv(rows);

const uploadRes = await fetch(`${baseUrl}/products/import/${productImport.id}`, {
  method: "PUT",
  headers: {
    Authorization: authorization,
    "Content-Type": "text/csv",
  },
  body: csv,
});

if (uploadRes.status !== 201) {
  throw new Error(`Upload failed: ${uploadRes.status}`);
}

console.log("Feed accepted and queued");
4

Wait for asynchronous processing

Upload acceptance means the file was queued. Processing and row-level validation happen asynchronously.

Operational Notes

  • Recommended workflow: create a new import for each upload
  • Import validity window is short (default: 30 minutes)
  • Upload size limit is 10 MB
  • Accepted upload content types: text/csv (recommended) and text/plain
  • Standard integration feed format is UTF-8 CSV

API Reference

Learn about all available Algure APIs