Skip to main content

Quick start

Register an app, download its service key and make your first SDK call. About five minutes.

1. Register an app​

In Scenid Cloud, open Admin → Security → OAuth apps and register a new app. Then generate a service key on the app card and download it as service-key.json.

The Create an app page walks through every screen.

Keep the key secret

service-key.json contains your client secret. Treat it like a password: never commit it, never ship it to a browser.

2. Install the SDK​

mkdir scenid-hello && cd scenid-hello
yarn init -y
yarn add @scenid/cloud-sdk

Set "type": "module" in your package.json so you can use import and top-level await. See Installation for CommonJS and other options.

3. Make your first call​

Put service-key.json next to a new file index.mjs:

index.mjs
import sdk, { initScenid } from '@scenid/cloud-sdk'

import serviceKey from './service-key.json' with { type: 'json' }

initScenid(serviceKey)

const customers = sdk.asAdmin().Customers()

const { status, result } = await customers.Entities.list({
entityTypes: ['ou'],
fields: ['data.name', 'data.city']
})

console.log(status)
console.log(result)

Run it:

node index.mjs
Output
200
[
{ entityType: 'ou', id: '…', humanId: 'SC-ZW2VEG', data: { name: 'Nordlicht Holding GmbH' }, score: 0 }
]
The SDK does not throw on HTTP errors

Every call resolves to { status, result }, like fetch. Always check status. See Error handling.

4. Create something​

const { result: company } = await customers.OU.create(
{ data: { ouType: 'ou', name: 'Hello Cloud GmbH', legalForm: 'gmbh' } },
{ return: true }
)

console.log(company.humanId) // e.g. "SC-ZW2VEG"

return: true makes the API answer with the created entity instead of a plain { result: 'ok' }. You need the humanId for almost everything that follows.

Next steps​