Skip to main content

Concepts

A short tour of the ideas the rest of the docs rely on.

Tenant​

Everything in Scenid Cloud lives in a tenant: your organisation's isolated space with its own users, customers, data sources and files. An app belongs to exactly one tenant, so every token it gets is bound to that tenant. You never pass a tenant ID in requests.

Services and URLs​

Each service has its own host, derived from your cloud domain:

ServiceHostWhat it does
Authauth.<domain>Tokens, users, profile, OAuth apps
Customerscrm-service.<domain>Companies, people, groups, journal
Insightsinsights-service.<domain>Sources and documents
Filesfile-service.<domain>File upload

The SDK computes these hosts from your service key. With the REST API you build them yourself, see REST overview.

Apps, service keys and tokens​

Your app authenticates with its client ID and secret and receives a short-lived access token (a JWT, one hour). The SDK requests and caches these tokens automatically. There are two ways to act:

SDK entryActs asUse for
sdk.asAdmin() (alias sdk.asApp())The app itselfBackend jobs, syncs, integrations. No user involved
sdk.asUser(idToken)A signed-in userWeb apps where each person should only see what they are allowed to see
your server ──client_id + secret──▶ auth.<domain>/oauth/token ──▶ access token
│
└── Authorization: Bearer <token> ──▶ crm-service / insights-service / file-service
Service tokens are not user tokens

A service token (token_type: "service") has tenant-wide access to Customers and Insights and no user identity. A journal entry written with it shows the author SYSTEM. If you need per-user permissions and authorship, use asUser.

Customers model​

EntityentityTypeDescription
Company / organisation unitouA company or a department. OUs form a tree via parent
PersonpersonAn individual
GroupgroupA named collection of OUs and people, manual or filter

Companies and people are linked by employments: a person works at an OU with one or more roles, each with a status (active, paused, separated, retired, inactive).

Every entity has:

  • id, an internal UUID;
  • humanId, a short readable identifier such as SC-ZW2VEG. This is what you use in every API call;
  • entityType;
  • data, the fields you set (name, address, contacts, …). data.active says whether the entity is active.
Creating gives you a humanId

create answers with { result: 'ok' } by default. Pass { return: true } to get the whole entity back, including its humanId. Do this whenever you need to link the entity afterwards.

Insights model​

An Insights source is a typed collection of documents, like a table. A source has:

  • a type that says how data gets in: store (you write and edit entries, by hand, by API and by file upload), push (your systems send data), rabbitmq (Scenid consumes your queue), bigquery, and more. See Source types;
  • field types: string, integer, float, boolean, date-iso, geo-point, …;
  • duplicate control, so that re-sending the same data updates instead of creating copies.

Customers entities are available as a source too. Read more in One connected platform.

You read a source with aggregate (filters, sorting, aggregations, pagination) and write with Doc.create, Doc.batchInsert or push. Sources are referenced by name. The SDK resolves names to IDs for you.

Response shape​

Every SDK call resolves to:

{ status: 200, result: /* parsed JSON, or undefined for 204 */ }

HTTP errors do not throw. See Error handling.

Glossary​

TermMeaning
humanIdReadable entity ID, used in all Customers calls
OUOrganisation unit: a company or one of its departments
EmploymentLink person ↔ OU with roles
Service keyJSON file with client credentials and endpoints
SourceInsights collection of typed documents