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:
| Service | Host | What it does |
|---|---|---|
| Auth | auth.<domain> | Tokens, users, profile, OAuth apps |
| Customers | crm-service.<domain> | Companies, people, groups, journal |
| Insights | insights-service.<domain> | Sources and documents |
| Files | file-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 entry | Acts as | Use for |
|---|---|---|
sdk.asAdmin() (alias sdk.asApp()) | The app itself | Backend jobs, syncs, integrations. No user involved |
sdk.asUser(idToken) | A signed-in user | Web 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
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
| Entity | entityType | Description |
|---|---|---|
| Company / organisation unit | ou | A company or a department. OUs form a tree via parent |
| Person | person | An individual |
| Group | group | A 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 asSC-ZW2VEG. This is what you use in every API call;entityType;data, the fields you set (name, address, contacts, …).data.activesays whether the entity is active.
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
| Term | Meaning |
|---|---|
| humanId | Readable entity ID, used in all Customers calls |
| OU | Organisation unit: a company or one of its departments |
| Employment | Link person ↔ OU with roles |
| Service key | JSON file with client credentials and endpoints |
| Source | Insights collection of typed documents |