Contacts

Push profiles from your system into OpenHouse. Each becomes a contact, identified by your own stable customer id (externalId) or by email, and re-sending a record safely upserts.

POST/ingest/contacts
{
  "mode": "upsert",
  "records": [
    {
      "externalId": "cus_42",
      "email": "ada@example.com",
      "firstName": "Ada",
      "lastName": "Lovelace",
      "country": "DE",
      "consentStatus": "opted_in",
      "custom": { "company": "Acme GmbH", "cohort": "2026-Q3" }
    }
  ]
}
Record fields — all optional, but a record needs an identity: externalId and/or email
externalId
string ≤200
Your system's stable customer id, unique within your organization. Immutable once set.
email
string ≤320
Lowercased and validated. An attribute, not an identity — it can change, and two contacts may share one.
firstName
string ≤200
Non-empty values enrich; omitted fields never erase.
lastName
string ≤200
Same enrichment semantics.
country
string ≤10
Country code.
consentStatus
opted_in | opted_out | unknown
Only changes when explicitly present — a record without it never touches stored consent. New contacts without it start as unknown. Sending opted_in for an opted-out contact re-subscribes them, so only send it when the person has opted in again.
custom
object
Values for your organization's own custom fields, keyed by field key. The fields must exist first (see Attributes). Each value is checked against its field's type; a value that doesn't fit is reported in fieldErrors and the record still lands. null or an omitted key never erases a stored value.

Contacts also carry a read-only randomBucket (0–999), assigned by the system at creation and returned on every contact response. It is the handle for random samples and A/B arms in segments (randomBucket less_than 100 is a stable 10%). It is not accepted on ingest.

mode (batch-level, default "upsert"): with upsert, a record matching no existing contact creates one; with enrich, it is skipped with a named reason and nothing is created — for integrations that must only ever update what already exists.

Which keys custom accepts, how to create a field, the value types, and what happens to a value that doesn't fit are on Attributes.

How records match contacts

Matching is strict and predictable — no write ever merges contacts implicitly:

  • A record with externalId matches by externalId only — never by email fallback. Re-sending {"externalId": "cus_42", "email": "new@x.com"} updates that contact's email; an unmatched externalId creates a new contact even if the email matches an existing one.
  • A record without externalId matches by email: exactly one match updates it; several contacts sharing the email skip the record with a named reason (use externalId); no match creates (upsert) or skips (enrich).
POST/contacts/identify

Attaches your externalIds to contacts that exist only by email — typically once, when your integration arrives after a CSV-imported profile base. Up to 1000 records:

{ "records": [ { "externalId": "cus_42", "email": "ada@example.com" } ] }

Each record stamps the externalId onto the contact with that email only when the email matches exactly one contact that has no externalId yet; contacts that already carry an id are not counted against it and are never touched. Anything else — id already assigned, email matches nobody, several contacts without an externalId share it, the only contact with the email already carries a different id — is a named skip, never a merge. Re-running the same pairs skips harmlessly.

CSV import

The same import as Profiles → Import in the app, for files you would rather send than upload. The CSV travels as text inside a JSON body, comma-separated with a header row, up to 10MB and 50,000 data rows. Both endpoints need an operator's key.

POST/contacts/import/preview
{ "csv": "Kundennummer,E-Mail,Vorname
cus_42,ada@example.com,Ada" }

Writes nothing. Returns the headers, the rowCount, the first five rows as sample, the fields a column can be mapped to, and a suggestedMapping that recognises common header names in English and German (Email, Kundennummer, Vorname, Newsletter…) and your own fields by key or label.

POST/contacts/import
{
  "csv": "Kundennummer,E-Mail,Vorname,Newsletter
cus_42,ada@example.com,Ada,ja",
  "mapping": {
    "externalId": "Kundennummer",
    "email": "E-Mail",
    "firstName": "Vorname",
    "consentStatus": "Newsletter"
  },
  "consentDefault": "unknown",
  "mode": "upsert"
}
mapping
object
Field key → the exact CSV header. Map at least email or externalId. Targets are the base fields (email, externalId, firstName, lastName, country, consentStatus) and your own manual attributes; computed or archived fields are a 400. The import never creates a field: create it first (see Attributes). Unmapped columns are ignored and listed in ignoredColumns.
consentDefault
opted_in | opted_out | unknown
Default opted_in. The consent of contacts this file CREATES when no consent column is mapped. Existing contacts keep theirs.
mode
upsert | enrich
As on /ingest/contacts: enrich only updates contacts that already exist.
  • Rows match contacts exactly like /ingest/contacts: by externalId when the row has one, otherwise by email, exactly one match or a named skip. The import never attaches an externalId to an existing contact; that is /contacts/identify.
  • A mapped consent column sets consent on every row, existing contacts included. It reads opted_in/yes/true/ja, opted_out/no/false/nein/unsubscribed and unknown; an empty cell, or one without any letter a–z (1, 0, -), counts as unknown and replaces the stored consent, so turn 1/0 columns into yes/no first. Any other value skips the row.
  • Blank cells never erase a stored value (consent is the exception above). A value that doesn't fit its attribute is reported in fieldErrors and the row still imports. If the same identity appears twice in the file, the last row wins.
  • The result is { total, inserted, updated, skipped, ignoredColumns, fieldErrors, fieldsWritten, attributeChanges }; skipped and fieldErrors list at most 100 entries, each with its row number and reason. Re-running the same file is safe: it updates the same contacts.

Finding contacts

GET/contacts
GET /contacts?search=ada&limit=200&offset=0

# 200 →
{
  "rows": [
    {
      "id": "3f2a…", "externalId": "cus_42", "email": "ada@example.com",
      "firstName": "Ada", "lastName": "Lovelace", "country": "DE",
      "consentStatus": "opted_in", "randomBucket": 417,
      "createdAt": "2026-11-02T09:14:00.000Z",
      "custom": { "company": "Acme GmbH" },
      "suppression": null
    }
  ],
  "total": 1
}
search
string
Optional. Case-insensitive part of the email, first name, last name or externalId.
sort
email | country | createdAt
Default createdAt.
dir
asc | desc
Default desc: newest first.
limit
1–200
Default 50.
offset
integer
Default 0. Paging is stable: no row repeats or goes missing between pages.

total counts every match, so page until offset reaches it. suppression is { reason, since } when the address is on your suppression list (see Transactional email), otherwise null.

POST/contacts/search
{
  "definition": {
    "groups": [{ "logic": "AND", "conditions": [
      { "field": "country", "operator": "equals", "value": "DE" },
      { "field": "consentStatus", "operator": "equals", "value": "opted_in" }
    ] }]
  },
  "limit": 100, "offset": 0, "sort": "createdAt", "dir": "desc"
}

# 200 → { "count": 1840, "sample": [ { "id": "3f2a…", "email": "…", … } ], "explanation": [ … ] }

Finds contacts by any condition a segment can express, including your own attributes and events. The definition format is on Segments; leave it out to match everyone. count is the full number of matches and sample one page of them (limit 1–100, default 20), so page with offset. sort takes any field key, your own attributes included; an unknown one is a 400 listing the valid keys. Without sort the order is by your first pinned number attribute, highest first, and by createdAt only when there is none, so pass sort to rely on an order. Sample rows carry id, email, names, country, consentStatus, randomBucket and custom, but not externalId.

Addressing a single contact

Everywhere a contact id appears in a path you can use either the OpenHouse uuid or ext: + your externalId — no id-lookup round trip needed:

GET /contacts/ext:cus_42          # the contact, by your id
GET /contacts/ext:cus_42/events   # their event timeline

An unknown externalId is a 404, exactly like an unknown uuid.

What a contact is in

GET/contacts/ext:cus_42/segments
{ "segments": [ { "id": "…", "name": "VIP", "kind": "dynamic" } ], "unchecked": [] }

The active segments the contact belongs to right now, by name. A segment whose definition could not be evaluated is listed under unchecked with its reason instead of being silently left out. Membership ignores consent: being in a segment does not mean a campaign may mail them.

GET/contacts/ext:cus_42/enrollments
[ { "automationId": "…", "enrollmentId": "…", "automation": "Welcome series",
    "status": "active", "simulated": false, "currentNodeId": "wait-2",
    "enteredAt": "…", "finishedAt": null, "wakeAt": "…" } ]

The automations the contact entered, newest first, at most 20.

Erasure and export

Both require an administrator's key and accept either address form.

GET/contacts/ext:cus_42/export

Everything OpenHouse holds about one person as a single JSON bundle — the contact, their custom field values, their events and their email engagement — for access and portability requests.

DELETE/contacts/ext:cus_42
DELETE /contacts/ext:cus_42          # by your externalId
DELETE /contacts/3f2a…-…               # or by the OpenHouse id

# 200 → { "ok": true }     # 404 for an unknown id, 403 without an administrator's key

A hard delete: the contact, their field values, events and automation enrollments go with the row, and campaign statistics keep only anonymous counts. The action is written to your audit log with the contact's id only — never the email. Nothing remembers the erasure — a list of "people we deleted" would itself store what they asked us to remove — so re-ingesting the same person afterwards creates a brand-new contact with fresh consent. Keeping erased people out of future batches is your system's job, at the source.