Concepts
This page explains the model behind every Kennra call. Read it once before you build: most API behaviour follows from these few ideas.
Workspaces
A workspace holds one customer memory: its companies, people, deals, settings, members and apps. All data is separated per workspace.
Each workspace has two names:
| Name | Example | Use |
|---|---|---|
identifier | fjellsport-demo | The name you use in headers, the CLI and URLs. Lowercase letters, digits and hyphens, 3–40 characters. It never changes once created |
id | k7m2q9x4c8vt3hpa | Internal. You see it in some responses, but you never need to send it |
One login can belong to several workspaces. With a sign-in token, you name the workspace in the kennra-workspace header (see Authentication). Agent tokens and app tokens are bound to one workspace.
A workspace has an environment: production, staging, development, demo, test or hobby. A project groups the workspaces of one customer, for example a production workspace with its staging and development workspaces. A hobby is a project with one workspace and real customer data, made for the free tier: it never gets staging or development. Design partners start in a test or demo workspace.
The environment changes a few rules. In test, development and demo workspaces, Kennra publishes schema proposals from agents and apps at once and asks nobody to confirm agent writes. Staging, production and hobby wait for a person.
IDs
Every Kennra id is a lowercase ULID without a type prefix, for example 01jd3k9q7xw2m8c4v6t5hpa1rz. The type comes from the field or operation you pass it to.
If you pass an id of the wrong Kind, for example a deal id as organizationId, the API returns ValidationFailed with the problem code WRONG_KIND.
Kinds and traits
Kinds
A Kind is a type of record with fixed meaning and core fields that every workspace shares:
| Kind | What it is |
|---|---|
| Person | A contact or a consumer customer |
| Organization | A company: lifecycle stage, organization types, and its parent company in a group |
| Deal | A sales opportunity in a pipeline, with stages, amount and owner |
| Interaction | A meeting, call, email or visit that has happened |
| Task | Work to do, including promises made to a customer |
| Note | Markdown text linked to people, companies or deals |
Programs and their enrollments cover non-revenue work such as press outreach or event follow-up. Mirrored facts, described below, hold orders, quotes and subscriptions.
The kinds query lists the Kinds in your workspace with their core fields and record counts.
Traits
You extend a Kind with traits. A trait is a named group of fields on one Kind, with a type, a PII class and allowed purposes per field. Trait names have a namespace:
| Namespace | Owner | Example |
|---|---|---|
kennra | Built in | kennra.profile, kennra.firmographics |
custom | Your workspace | custom.erp_terms |
| An app's namespace | The app that declared it | crystallize.* |
You read traits with the traits(names: [...]) field and write values with the setTraitValues mutation. Only the owning app can write to an app's namespace; anyone else gets TRAIT_OWNED_BY_APP. Trait definitions are versioned, and fields can be deprecated but never renamed.
Companies, people and deals have types, such as customer, partner or training deal, and a trait can apply to some types only. Reference fields link records with a time span. See Data model for types, your own type options, trait scopes and links.
Custom Kinds
When the fixed Kinds don't fit, a workspace can define a custom Kind, for example the machines a customer owns. Custom Kinds hold data and relations with a time span, such as owner history. Define one with defineCustomKind and create records with createRecord.
Custom Kinds have guardrails:
- No personal data on the record itself: trait fields have PII class
none. A person is reached only through a relation. - At least one relation to a company, a person or a deal.
- No pipelines, merges or consent.
- At most 10 custom Kinds per workspace (
TOO_MANY_KINDS).
Custom Kinds can link to each other, and their relations can limit what they link to. See Links between records.
Purposes and withheld
Every request runs under exactly one purpose, such as organization.management, sales.b2b or service.support. The purpose says why you read the data, and Kennra uses it to decide which fields you get.
A field comes back only when the purpose is in your grant, the field allows the purpose, and your PII level covers the field. Otherwise the field is null, and extensions.kennra.withheld lists its path and a reason:
{
"extensions": {
"kennra": {
"purpose": "sales.b2b",
"withheld": [{ "path": "person.phone", "reason": "pii_level" }]
}
}
}Common reasons are purpose_not_allowed, purpose_not_granted, pii_level, field_group, special_category and share_level. Show withheld fields as withheld, not as empty, so people know the value exists.
Each persisted operation lists the purposes it may run under. The Viewer query returns the purposes your token holds. See GraphQL API for the kennra-purpose header.
PII levels and classes
Fields that hold personal data carry a PII class, for example PROFILE (names, title), CONTACT (email, phone) or CONTENT (notes, meeting summaries). Each class needs a minimum PII level.
Your grant has one PII level. From lowest to highest: none, pseudonymous, contact_basic, full. For example, a person's name and title need contact_basic, and their email, phone and notes need full. The schema marks each personal field with the @pii(class, level) directive, so you can check what a field needs.
A note can be marked sensitive when its text holds special category data, such as health. Its text then needs PII level full and the field group special_category. Everyone else sees that the note exists, who wrote it and when.
Your PII level comes from your roles. An agent's level is never higher than the person it acts for, and an app's level is the one an admin approved at install.
Record visibility
Purposes and PII levels decide which fields you get. Record visibility decides which records you see at all. Each role has a visibility preset per workspace:
| Preset | You see |
|---|---|
| All | Every record |
| Own | Records you own or are on the account team of |
| Own and team | Also records owned by anyone in your teams |
| Region | Also records in your regions |
| Manager subtree | Also records owned by anyone in the teams you manage |
| Attribute rule | Companies with a given organization type or lifecycle stage, for example only customers |
Deals, interactions, tasks and notes follow the company they belong to. A person is visible when one of their companies is. Lists, search, counts and single reads use the same rule, and a record you may not see answers like an unknown id. A denied write says outside_visibility.
Agents and apps acting for a person see what that person sees, never more.
Company groups and org charts
A company can have a parent company, so a workspace holds whole groups (konsern). Set the parent with setOrganizationParent; a parent that would make a loop is refused with HierarchyCycle.
Organization.parent,ancestorsandchildrenwalk the tree.organizationGroupreturns the whole group in one read.organizationRollupsums deals, interactions, open tasks and orders for a company, alone or with every subsidiary, with a breakdown per company.orgChartshows who reports to whom at a company, and withincludeSubsidiariesacross the group. Set a line withsetReportingLine: one solid manager per position, plus dotted lines. WithasOf, you see the chart as it held at that time.
Companies you may not see stay in the tree as hidden members, and rollups count only what you may see.
Logos and photos
A company's logo and a person's photo are kept by Kennra, scaled to fit 500 × 500 and stored without metadata. Read them as Organization.logo and Person.image, and show them with url(size:): a signed link to Kennra's own API, valid for about an hour, at 64, 128 or 256 pixels. No third party sees who looks at whom, and an erased person's photo stops answering at once.
A contact’s photo can come from an installed photo app, such as Gravatar, when the data protection officer or an admin turns on profile pictures for contacts. Kennra sends the app a SHA-256 hash of the email address, never the address, and keeps the picture like any photo.
A member’s photo comes from the account they connect in an app, such as their Google account, and shows to the workspace’s people as Member.photo.
A company gets its logo automatically when it has a domain: from an installed app that answers organization.logo, else from the company's own website (its touch icon, sized icons, web app manifest or favicon, the largest square of at least 64 pixels, never SVG). Kennra looks again at most once a month. A logo someone sets with setPartyImage is never replaced. removePartyImage with keepEmpty: true means No logo: Kennra stops looking until someone sets one or calls refreshOrganizationLogo.
Duplicates and merges
When two companies or two people are the same, a person merges them. mergeParties merges the loserId into the winnerId. Reads follow the merge, so the contacts, roles, deals, orders, conversations, notes, documents, tasks and related records of both show on the record kept. Segments are evaluated again for it. Party.mergeImpact counts what moves before you merge, and survivorship picks a field's value from the other record.
A merge can be undone: unmergeParties with the mergeId gives everything back. declareNeverMerge marks a pair as not the same, so it isn't proposed again.
Agents and apps never merge. They propose a merge with proposeMerge, or propose_merge in MCP, and a person compares the two and decides. A pair marked as not the same is refused with MERGE_BLOCKED. Kennra also finds duplicate companies by name.
Company names
A company has one name, its legalName, and can have other names it goes by: a former name, a brand or another spelling. Read them as Organization.alternativeNames, and add one with setTraitValues on kennra.firmographics. Kennra matches alternative names like the name, in search, findParties, email signatures and the duplicate finder. A name search also matches æ, ø and å written as ae, o and a.
Rename a company with renameOrganization, or update_organization with name in MCP. Kennra never renames a company on its own.
Archived records
Archiving a company or person with archiveParty takes it out of search, lists and segments. It stays readable by id, and you restore it with archived: false. Archiving is not erasure.
An archived company or person is read-only. A write to it, or one that attaches something new to it, returns PartyArchived. Writes the law or a source system requires still go through: consent withdrawal and objections, data subject requests, and commerce facts and meetings captured by an app.
Consent
Consent is kept per person, purpose and channel as a history: each row is valid for a period and recorded for a period, and a correction adds a row instead of overwriting one. A withdrawal wins over a consent with the same time.
A consent can come from another tool. When an app moves a newsletter list to Kennra, it imports earlier opt-ins with proof: the tool, and how and when the person opted in (form, page, IP address, double opt-in). The consent is valid from the opt-in, and the person's consent history says where it came from, for example "Imported from List Tool · opted in 12 Mar 2024 via form “Newsletter” · double opt-in 12 Mar 2024". The IP address is encrypted with the person's key and is only in a data subject export. An import never overrides a later withdrawal, and only apps an admin approved for kennra:consent:import can import. Agents never can. See Sending tools.
Events, history and asOf
Kennra stores every change as an immutable event with a source, an actor and two times:
- Valid time (
occurredAt): when it happened in the world. - Transaction time (
recordedAt): when Kennra recorded it.
Nothing is overwritten. Read models give you the current state, and many fields and queries take asOf (valid time) and knownAt (transaction time) to look back. For example, dealStage(dealId, asOf, knownAt) answers "which stage was this deal in on 1 October, as we knew it then?", and timeline(entityId, asOf, knownAt) returns the history of a record.
query DealStageAsOf($dealId: ID!, $asOf: DateTime!, $knownAt: DateTime) {
dealStage(dealId: $dealId, asOf: $asOf, knownAt: $knownAt) {
stage { id name }
status
validFrom
validTo
}
}Personal data in events is encrypted with a key per person. When a person is erased, Kennra destroys that key, so the history stays intact without the personal data.
Mirrored facts and owned data
Kennra keeps two kinds of data apart:
- Owned data is data Kennra is the source of truth for: contacts, companies, deals, tasks, notes, interactions and your traits. You change it with commands.
- Mirrored facts are copies of records that another system owns, such as orders, quotes and subscriptions from a commerce platform. An app writes them with the
recordMirroredFactingest command. They are not editable in Kennra, and each carries its source system and source version.
A mirrored fact with an older source version than the stored one is kept as history and doesn't change the current state. Facts attach to a person or company when one of their identifiers resolves. You read them with commerceFacts and commerceFact.
Kennra stores a fact at reference level: amounts, SKUs and quantities, not product names or images. A line that books something for a period, such as a rental, carries booking { start end unitId }, and hasBooking says whether a fact has one. The rest comes live from the app that owns the fact: CommerceFact.details asks the app, and falls back to the stored copy with a reason when the app doesn't answer. See Live lookups.
Identifiers tie records to other systems. Core identifier types are email, phone, org_number, auth_subject and external. An external identifier has an issuer and a scheme registered by an app, for example the Crystallize app's customer scheme.
An org_number is a company registration number from any country: country (ISO 3166-1 alpha-2), scheme (national by default, or lei, vat, duns, ein) and value. Kennra checks the number strictly where it knows the format, for example NO, SE, DK, FI, GB, FR, NL and LEI. It stores numbers from other countries as written and marks them validated: false. Without a country, Kennra reads the number as Norwegian. That default is deprecated, so send the country.
Money
Every amount in Kennra is one string: an ISO 4217 currency code, a space and the amount. "NOK 499.00", "ISK 4990", "JPY 1200", "KWD 1.250", "NOK -3.81". It is the same format the group's payment service uses, so an amount reads the same in every system. GraphQL calls it the Money scalar. Events, webhooks, MCP, the SDK and the CLI use it too.
- Output has exactly the currency's decimals: two for NOK, none for JPY or ISK, three for KWD, four for CLF. No thousands separators,
.as the decimal mark, and the minus sign right before the digits. - Input may have fewer decimals:
"NOK 499"is"NOK 499.00". Extra zeros are fine too:"ISK 4990.00"is"ISK 4990". A non-zero digit past the currency's decimals is an error, never rounded:"NOK 4.999"is refused. So is an unknown currency. - The decimals come from one versioned ISO 4217 table, taken from the list SIX publishes.
- No floats. Kennra calculates on exact whole numbers. A result is rounded once, where it becomes an amount, half away from zero unless a field says otherwise.
- Rates and unit prices with more decimals than the currency, such as a usage price of
"NOK 0.0035"or an exchange rate, are their own types and become an amount in one place. Splitting an amount never loses or adds an øre: NOK 100 in three parts is 33.34, 33.33 and 33.33. - The object form, for systems that want integers:
{ "currency": "NOK", "value": "499.00", "minor": 49900 }.
The library behind it is open source (MIT): @newnormal/money.
Money in several currencies
Kennra never adds amounts in different currencies, and never compares them either: a filter on an amount in NOK never matches an amount in SEK. A report or sum that spans several currencies gives you one amount per currency.
- Per-currency lists. Aggregates have a list of
Money, one per currency, sorted by currency code:MrrReport.byCurrencyandcurrentMrrByCurrency,OrganizationRevenue.mrrByCurrency,PipelineReport.openAmounts,weightedAmountsandwonAmounts,DealSearch.amounts, and the team reports'openAmountsandwonAmounts. - Single amounts. Fields such as
currentMrr,mrr,arrandopenAmounthold the amount when the figures are in one currency, or when you pass acurrencyargument. They arenullwhen the figures span several currencies. - Converted totals. Fields ending in
Convertedgive a total in the workspace's reporting currency, with the rates and the day they are for. Show it with itsnote, for example "converted to NOK at ECB rates of 20 Nov 2026". Kennra converts when you read and never stores the result. The field isnullwhen every amount is already in the reporting currency, or when a rate is missing.
mrrReport {
currentMrrByCurrency # ["EUR 1200.00", "NOK 48000.00"]
currentMrrConverted { amount source rateDate note rates { currency rate } }
}The reporting currency is the one the workspace set (SetReportingCurrency), else the currency of the workspace country (SetWorkspaceCountry), else NOK. Kennra fetches the euro reference rates from the European Central Bank once a day and keeps them as exact decimals. A rate in rates is a currency pair: "SEK/NOK 1.0268" is 1.0268 NOK for one SEK. You can set rates by hand with SetExchangeRates, as decimal strings; they are used when they cover every currency in a total. ReportingSettings shows the currency and the rates in use.
Suggestions from email
When a member connects their mailbox, Kennra makes two kinds of suggestions from their own email. Only that member sees them, and only they decide.
- Suggested contacts are people the member emailed both ways with, or met, who are not in Kennra yet. Read them with
contactProposals, and decide withapproveContactProposalorrejectContactProposal. - Field proposals are updates Kennra read in the signature of an email from a known contact: a new title, a phone or mobile number, a profile page, a website domain or a company address. Kennra proposes a value only when the field is empty or differs. Read them with
fieldProposals, and decide withacceptFieldProposalorrejectFieldProposal.
query {
fieldProposals(first: 20) {
id
field
displayValue
previous
person { displayName }
source { sentAt }
}
}Accepting writes the value with the member's own access, and the email becomes its source. A company name in a signature is proposed only when it differs from the company's name and its alternative names, ignoring case, punctuation and a legal form such as AS or AB. You accept it by confirming the new name, which you can edit first: acceptFieldProposal with value. Or you keep it as an alternative name with asAlternativeName: true. Kennra never renames a company without your confirmation.
Kennra reads only the sender's own signature. It cuts the quoted part of a reply or forward first, in HTML and in text, and skips a signature block that names someone else. A signature that carries one of the workspace's own values gives no proposal at all: your own domains, your members' phone numbers or your own companies' addresses. So a reply thread never puts your details on a customer. Kennra reads the signature while it summarizes the email and doesn't store the message. An undecided proposal expires after 90 days, and a rejected value isn't proposed again.
People on a deal
A deal has a buying committee: the people on it, each with a role on the deal and at most one primary contact. The roles are the same words as roles at a company: decision maker, economic buyer, champion, influencer, user, technical, procurement, billing and blocker. Add someone with addDealPerson, change their role, primary contact or note with updateDealPerson, and take them off with removeDealPerson.
Someone with a role at the deal's company or a company in its group joins as is. Anyone else, such as a consultant, joins with a note that says why, and DealPerson.atOrganization is false. Without the note, the API returns ValidationFailed with the problem code NOT_AT_ORGANIZATION.
Deal.people and Person.deals read the committee. History stays: validFrom and validTo say when someone was on the deal, and includeRemoved: true lists the people who left. You see a person on a deal only when you may see both.
query DealPeople($id: ID!) {
deal(id: $id) {
name
people { role isPrimary atOrganization validFrom person { displayName } }
}
}From deal to revenue
A deal shows what it turned into: the orders and subscriptions linked to it through a quote, or directly. Link one directly with linkDealCommerce when there was no quote, for example an enterprise contract set up by hand. It must belong to the deal's company or a company in its group.
Kennra also suggests links. When an order or subscription appears for a company with an open deal, or a deal won in the last 60 days, Kennra compares company and group, timing, amount and plan. A strong match becomes a suggestion for the deal owner in For you and on the deal. Read them with dealLinkProposals, and decide with acceptDealLinkProposal or rejectDealLinkProposal. Accepting links the fact and, while the deal is open, wins it with the actual value. Kennra doesn't suggest a rejected pair again, and agents can't decide.
query {
deal(id: "01j…") {
actualValue {
mrr
value
expected
variance
}
}
}actualValue reads a subscription's MRR as a deal value by the workspace setting: ARR (MRR × 12, the default), MRR, or the contract term. When a deal is won with the actual value, its earlier amount stays as the expected value.
Renewals become deals too. Before a subscription renews, by default 90 days ahead, Kennra suggests a renewal deal to the company owner, once per renewal. A subscription from a deal always counts; others from a monthly amount the workspace sets. Accepting opens a deal of type renewal with the subscription's value and the renewal date as its close date. When a customer cancels or lowers a subscription with an open renewal deal, the owner gets a suggested task and a suggestion to mark the renewal lost. When a signed contract linked to the subscription has a notice period, the 90 days count back from the notice deadline instead. An agent or a member can suggest a renewal deal earlier with proposeRenewal; it is the same suggestion for the owner. Read them with renewalProposals, and decide with acceptRenewalProposal or rejectRenewalProposal. A person decides, never an agent.
Documents and contract terms
A document is a link to a file that lives somewhere else: a signed contract in a file store, a proposal, an agreement. Kennra keeps the link, the title, the kind (CONTRACT, PROPOSAL or OTHER) and the records it's about. It never stores the file.
Link one by its https address with linkDocument. If an installed app declares the link's host, the document shows as that app's. An app with a picker lets a member pick files in the app instead (documentPickerUrl), and then Kennra can show a preview and details live from the app.
mutation {
linkDocument(
input: { links: ["<company id>"], url: "https://files.example.com/contract.pdf", title: "Enterprise agreement", kind: CONTRACT }
idempotencyKey: "link-1"
) {
... on DocumentChanged { documentId }
}
}A contract has typed terms, all optional: signing date, signatories, start and end date or the term in months, automatic renewal, notice period and value. Set them with setContractTerms. Kennra works out renewalDate and noticeDeadline from them, and an auto-renewing contract moves to its next renewal by itself. Organization.nextContractRenewal gives the company's next renewal across its contracts and deals.
When an app passes a contract's text on, Kennra reads suggested terms from it and drops the text. Nothing changes until a person accepts them with decideSuggestedTerms.
Who sees a document: everyone who sees one of its records, or only the person who linked it when it's PRIVATE. The contract value needs the commercial field group.
Next steps
- Authentication: where your grant comes from.
- GraphQL API: headers, errors and pagination.