HomeGuidesAPI Reference
Guides

spektr SDK

📦 JavaScript: client-sdk (npm)

  1. Get the npm repository endpoint:
export CODEARTIFACT_NPM_URL=$(aws codeartifact get-repository-endpoint \
  --domain spektr \
  --domain-owner {spektr-id} \
  --repository spektr-npm \
  --format npm \
  --query repositoryEndpoint \
  --output text)
  1. Authenticate npm:
aws codeartifact login \
  --tool npm \
  --domain spektr \
  --domain-owner {spektr-id} \
  --repository spektr-npm

This command automatically configures your .npmrc to use the CodeArtifact repo.

  1. Install the package:
npm install @spektr/client-sdk

✅ Notes

  • Your access is limited to read-only access to specific repositories.
  • The external ID is required when assuming the role, do not share it externally.
  • The token expires after 12 hours; you’ll need to refresh it using the above steps.

Conditional Fields unwrap

Usage:

The formEvaluation method unwraps the full form after evaluation of all the conditional fields and rules.

import SpektrSdk from '@spektr/client-sdk';

// example
const unwrappedForm = SpektrSdk.formEvaluation(form, {
  first_name: 'John',
  last_name: 'Doe',
  date_of_birth: '1747170000000',
  country_of_residence: 'DK',
});

Translation

Usage:

The translateFields method transforms all the field labels to the provided language passed as argument. This can also be used to generate all the options for static values such as NACE codes, Country codes, etc.

import SpektrSdk from '@spektr/client-sdk';

const translatedForm = await SpektrSdk.translateFields(
  response.node.form.fields,
  selectedLanguage
);

Form summary steps

When polling Fetch current step, the node may have type: "formSummary". That step is a read-only recap:

  • Render node.summary (heading, subtitle, blocks/fields, optional button labels).
  • Do not call translateFields on it — there is no node.form.
  • Continue by submitting an empty body ({}) to submitUrl. Sending any field values returns 400 with message Form summary continue does not accept field values.

Expired links

A client-facing link lives for 90 days. Once it lapses, execution.status on Fetch current step can be expired —
a new terminal value in the status enum, so treat any unrecognised status as terminal rather than as a reason to keep
polling:

  • Fetch current step answers 200 with execution.status: "expired", node: null and goBackAllowed: false.
    Render your expiry screen and stop polling; there is no step to show.
  • Submitting to submitUrl (or go-back, confirm, or file submission) answers 410 Gone with
    errorCode: "context_expired". The link is permanently dead — do not retry.
  • In the short window between the link lapsing and the platform recording it, the same calls answer 401. Treat 401
    and 410 the same way in the end-client UI; only 410 tells you the link expired for certain.

The lapse is also published as the process_expired webhook event, so a back office can react without polling. See the
webhook documentation.

Related-entity wait steps

When polling Fetch current step, the node may have type: "relatedEntitiesProcessWait" while the parent execution waits for related-entity subprocesses (for example UBO onboarding loops):

  • Render node.subprocesses as status cards. Each item includes optional identity fields (firstName, lastName, fullName, email), an optional formUrl for the child session, and a status of pending, complete, or failed.
  • Keep polling this endpoint to refresh subprocess status. When every subprocess is settled and the parent is ready to continue, the node type changes and the parent execution advances automatically.
  • While child executions are still being registered, the node may temporarily be type: "internal" — keep polling until subprocess cards appear or the execution completes or fails.
  • Direct end users to each child’s formUrl while its status is pending. Do not submit the parent submitUrl for this step.

Did this page help you?