ValeronDocs

Walkthroughs

Sync Valeron into your CRM

Load your contacts and companies, keep them current, and write changes back.

This walkthrough keeps a custom CRM and Valeron in step. You load everything once, then fetch only what changed, and you send your own changes back.

#1. Create a key

In Settings › Developers, create a key with contacts:read, companies:read and schema:read. Add contacts:write and companies:write if you will write back.

#2. Learn the fields

Valeron's contacts and companies have fields, some built in and some your organization created. List them so you can map them to your CRM's columns.

cURL
curl "https://api.valeron.io/v1/fields?object=contacts" \
  -H "Authorization: Bearer $VALERON_API_KEY"

Each field has a key, a label and a type. Pipelines and stages come from GET /v1/pipelines.

#3. Load everything

Page through GET /v1/contacts and GET /v1/companies with limit=200 until has_more is false. Each record is { id, object, fields, processing, archived_at }, and fields holds each value with its label and type. Store the Valeron id next to your own ID so later runs update the same row. Contacts are ct_… and companies are co_….

#4. Fetch changes

Before each run, record the current time. Pass the previous run's time as updated_since. The code is in Pagination and syncing.

#5. Write back

Send changes with PATCH /v1/contacts/{record_id}. The body is { "fields": { … } }, with null to clear a field.

JavaScript
await fetch("https://api.valeron.io/v1/contacts/ct_01JEX4R7Q2", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.VALERON_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ fields: { phone: "+14155550132" } }),
});
Python
import os
import requests

requests.patch(
    "https://api.valeron.io/v1/contacts/ct_01JEX4R7Q2",
    headers={"Authorization": f"Bearer {os.environ['VALERON_API_KEY']}"},
    json={"fields": {"phone": "+14155550132"}},
).raise_for_status()

To create a contact, POST /v1/contacts with the same body and an Idempotency-Key so a retry cannot create it twice. If a contact with the same email address or phone number already exists, Valeron adds your values to it and answers 200 with is_matched: true, instead of creating a duplicate.

To move a contact through your pipeline, POST /v1/contacts/{contact_id}/stage with { "stage_id": "stg_…" }. To remove one, DELETE /v1/contacts/{record_id} archives it, and POST /v1/contacts/{record_id}/restore brings it back.

#6. Stay current

Polling works, and webhooks are faster. See Keep your CRM up to date with webhooks.