Tracking jobs

Background operations — track them with GET or through the webhook (job.completed, job.partially_completed, job.failed).

Everything that depends on the marketplace runs in the background, as a job. The API answers right away; the work goes on afterwards.

There are six job types (list in States and events). The most common is connection.sync, started for each connected account. Its id arrives in data.syncJobId: in the connection.created event, and in connection.updated when the seller connects the same account again.

Two ways to track

  1. Through the webhook (recommended): subscribe your endpoint to job.completed, job.partially_completed and job.failed (or *). Each final status has its own event: job.completed only arrives when every item succeeded. The event carries the whole job. See Receiving webhooks.
  2. By polling: Get a job with the id. JOB_ID is the data.syncJobId of the connection.created event (or of the connection.updated of a reconnection). Wait a few seconds between calls.
curl $BACKEND_URL/v1/jobs/$JOB_ID \
  -H "Authorization: Bearer mk_your_api_key"

Outcome

The final status tells how it went: completed (every item succeeded), partial (some failed) or failed (none succeeded). Each job has items with their own outcome: the failed ones are in List items with status=failed. States and rules are in Jobs.

A job can stay running longer when the marketplace limits how many calls we can make. The remaining items wait for the quota to come back, then go on. The job does not fail because of it.