REST 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>"
X-Api-Key: $API_KEY on every request.GET /integrationsFeature: integrations.view
Returns paged rows with:
id, title, category, hub, providerKey, bundleIdhasCredentialsisEnabledapiVersioncurl -X GET "$BASE_URL/integrations" \
-H "X-Api-Key: $API_KEY"
GET /integrations/{id}Feature: integrations.view
Includes:
integration definitionbundlebundleIntegrationsstate (isEnabled, apiVersion, reauthRequired, health fields)hasCredentials, credentialsKeyscurl -X GET "$BASE_URL/integrations/$INTEGRATION_ID" \
-H "X-Api-Key: $API_KEY"
PUT /integrations/{id}/stateFeature: 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 }'
PUT /integrations/{id}/versionFeature: 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 /integrations/{id}/credentialsFeature: integrations.credentials.manage
Returns:
integrationIdschemacredentials object; configured secret-bearing fields contain an opaque mask rather than plaintextsecretFieldsConfigured, a field-name-to-boolean map for write-only secret stateupdatedAt, used for optimistic lockingcurl -X GET "$BASE_URL/integrations/$INTEGRATION_ID/credentials" \
-H "X-Api-Key: $API_KEY"
PUT /integrations/{id}/credentialsFeature: 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"]
}'
GET /integrations/logsFeature: integrations.view
Supported filters:
integrationIdlevel (info, warn, error)runIdentityType, entityIdpage, pageSizecurl -X GET "$BASE_URL/integrations/logs?integrationId=$INTEGRATION_ID&page=1&pageSize=20" \
-H "X-Api-Key: $API_KEY"
POST /data_sync/validateFeature: data_sync.configure
Checks that:
providerKeycurl -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"
}'
POST /data_sync/runFeature: data_sync.run
Body:
integrationIdentityTypedirection (import | export)fullSync (default false)batchSize (1..1000, default 100)triggeredByReturns 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
}'
GET /data_sync/runsFeature: data_sync.view
Filters:
integrationIdentityTypestatus (pending, running, completed, failed, cancelled, paused)page, pageSize, max 100)curl -X GET "$BASE_URL/data_sync/runs?integrationId=$INTEGRATION_ID&status=running" \
-H "X-Api-Key: $API_KEY"
GET /data_sync/runs/{id}Feature: data_sync.view
Returns run counters and optional progressJob summary:
progressPercentprocessedCounttotalCountetaSecondsPOST /data_sync/runs/{id}/cancelFeature: 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"
POST /data_sync/runs/{id}/retryFeature: data_sync.run
Body:
fromBeginning (default false)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 jobs and can be queried through sync detail and /progress/active.clientBroadcast: true.