Open MercatoDocsSearch docsAPI reference

REST API

Integrations and data sync API

Register the integration and its credentials, then follow a sync run through its state and logs. A configured integration can exist without a completed data transfer.

Open the API Explorer at /docs/api on your Open Mercato instance to inspect request and response schemas or try a call with an API key.

All examples assume:

export BASE_URL="http://localhost:3000/api"
export API_KEY="<paste your API key secret here>"
export INTEGRATION_ID="<your-integration-id>"

Shared conventions

Integrations API

List integrations - GET /integrations

Feature: integrations.view

Returns paged rows with:

curl -X GET "$BASE_URL/integrations" \
  -H "X-Api-Key: $API_KEY"

Get integration detail - GET /integrations/{id}

Feature: integrations.view

Includes:

curl -X GET "$BASE_URL/integrations/$INTEGRATION_ID" \
  -H "X-Api-Key: $API_KEY"

Update state - PUT /integrations/{id}/state

Feature: integrations.manage

curl -X PUT "$BASE_URL/integrations/$INTEGRATION_ID/state" \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "isEnabled": true, "reauthRequired": false }'

Change API version - PUT /integrations/{id}/version

Feature: integrations.manage

curl -X PUT "$BASE_URL/integrations/$INTEGRATION_ID/version" \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "apiVersion": "v1" }'

If integration has no declared apiVersions, the endpoint returns 422.

Get credentials - GET /integrations/{id}/credentials

Feature: integrations.credentials.manage

Returns:

curl -X GET "$BASE_URL/integrations/$INTEGRATION_ID/credentials" \
  -H "X-Api-Key: $API_KEY"

Save credentials - PUT /integrations/{id}/credentials

Feature: integrations.credentials.manage

The request remains a full-blob replacement by default. To retain an already configured write-only secret while updating other fields, omit its value from credentials and list its schema field name in unchangedSecretFields. Plain omission without that list removes the field; an explicit empty string clears it.

curl -X PUT "$BASE_URL/integrations/$INTEGRATION_ID/credentials" \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "credentials": {
      "apiUrl": "https://api.example.com"
    },
    "unchangedSecretFields": ["apiKey"]
  }'

List integration logs - GET /integrations/logs

Feature: integrations.view

Supported filters:

curl -X GET "$BASE_URL/integrations/logs?integrationId=$INTEGRATION_ID&page=1&pageSize=20" \
  -H "X-Api-Key: $API_KEY"

Data Sync API

Validate connection - POST /data_sync/validate

Feature: data_sync.configure

Checks that:

curl -X POST "$BASE_URL/data_sync/validate" \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationId": "my_integration_products",
    "entityType": "catalog.product",
    "direction": "import"
  }'

Start run - POST /data_sync/run

Feature: data_sync.run

Body:

Returns 201 with { id, progressJobId }.

curl -X POST "$BASE_URL/data_sync/run" \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "integrationId": "my_integration_products",
    "entityType": "catalog.product",
    "direction": "import",
    "batchSize": 100
  }'

List runs - GET /data_sync/runs

Feature: data_sync.view

Filters:

curl -X GET "$BASE_URL/data_sync/runs?integrationId=$INTEGRATION_ID&status=running" \
  -H "X-Api-Key: $API_KEY"

Run detail - GET /data_sync/runs/{id}

Feature: data_sync.view

Returns run counters and optional progressJob summary:

Cancel run - POST /data_sync/runs/{id}/cancel

Feature: data_sync.run

Requests cancellation and marks run status accordingly.

curl -X POST "$BASE_URL/data_sync/runs/$RUN_ID/cancel" \
  -H "X-Api-Key: $API_KEY"

Retry run - POST /data_sync/runs/{id}/retry

Feature: data_sync.run

Body:

Returns 201 with a new run { id, progressJobId }.

curl -X POST "$BASE_URL/data_sync/runs/$RUN_ID/retry" \
  -H "X-Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "fromBeginning": true }'

Progress and event delivery

Previous: Feature toggle API · Next: Module registry API