Also in docs/dev/quickstarts.md
Sync a target to a CRM
Push scraped or ingested records into HubSpot (Salesforce works the same way). About 4 minutes.
You need:
- An API key in
PYROSYNC_API_KEYand the deployment URL inPYROSYNC_URL(for examplehttps://app.example.com). Export routes need an admin key. - A HubSpot private-app token in
HUBSPOT_TOKEN.
1. Pick a target
GET /api/v1/targets
TARGET_ID=$(curl -sS -X GET "$PYROSYNC_URL/api/v1/targets" \
-H "X-API-Key: $PYROSYNC_API_KEY" | jq -r '.data[0].id')
echo "$TARGET_ID"
2. Bind the HubSpot export
POST /api/targets/{id}/exports
curl -sS -X POST "$PYROSYNC_URL/api/targets/$TARGET_ID/exports" \
-H "X-API-Key: $PYROSYNC_API_KEY" \
-H "Content-Type: application/json" \
-d "$(cat <<JSON
{
"adapter": "hubspot",
"config": {
"accessToken": "${HUBSPOT_TOKEN}",
"objectType": "contacts",
"mode": "upsert",
"dedupProperty": "email",
"fieldMap": {
"email": "email",
"name": "firstname"
}
}
}
JSON
)"
Check credentials first with POST /api/exports/test and the same adapter and config.
3. Run it now
POST /api/targets/{id}/exports/{adapter}/run
curl -sS -X POST "$PYROSYNC_URL/api/targets/$TARGET_ID/exports/hubspot/run" \
-H "X-API-Key: $PYROSYNC_API_KEY"
4. Check the run
GET /api/targets/{id}/exports/{adapter}/runs
curl -sS -X GET "$PYROSYNC_URL/api/targets/$TARGET_ID/exports/hubspot/runs" \
-H "X-API-Key: $PYROSYNC_API_KEY"
Result: The target’s latest records upserted as HubSpot contacts, with a run record showing counts and errors.