Package Exports
- @aurastride/sdk
Readme
@aurastride/sdk
Official JavaScript SDK for the aurastride headless CMS/CRM platform.
Works in Node.js 18+ with full CommonJS, ESM, and TypeScript support.
Zero runtime dependencies - uses the native fetch API.
| SDK version | Supported API version | Default API version |
|---|---|---|
0.1.x |
v4 |
v4 |
Table of Contents
- Installation
- Quick Start
- Configuration
- Authentication
- Services Overview
- System Configuration
- CRM
- Content
- Digital Asset Management
- Features
- Notification
- Integration
- MarketPlace App
- Pagination
- Caching
- Interceptors
- Error Handling
- TypeScript Usage
- Constants Reference
Installation
npm install @aurastride/sdkRequirements: Node.js 18 or higher.
Quick Start
// CommonJS
const { aurastrideClient } = require('@aurastride/sdk');
// ES Module / TypeScript
import { aurastrideClient } from '@aurastride/sdk';
const client = new aurastrideClient({
apiKey: 'YOUR_X_API_KEY',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
redirectUri: 'https://your-domain.aurastride.com',
});
// Step 1 – exchange auth code for tokens
await client.auth.exchangeCode('AUTH_CODE');
// Step 2 – all services are now available
const leads = await client.lead.read({ pagination: { page: 1, limit: 20 } });
console.log(leads);Configuration
Pass a config object to aurastrideClient. apiKey, clientId, clientSecret, and redirectUri are all required.
| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
required | Your x-api-key HTTP header value |
clientId |
string |
required | OAuth2 client ID |
clientSecret |
string |
required | OAuth2 client secret |
redirectUri |
string |
required | aurastride customer domain |
environment |
string |
'production' |
Target environment: 'production' or 'staging' |
autoRefresh |
boolean |
true |
Silently refresh the access token 60 s before expiry |
maxRetries |
number |
3 |
Max retry attempts on network errors / 5xx / rate limits |
retryBaseDelayMs |
number |
300 |
Base delay (ms) for exponential backoff with jitter |
apiVersion |
string |
'v4' |
API version to target (appended to the base URL, e.g. 'v3', 'v4') |
Environment Selection
Pass the environment option to the client config to select the API endpoint. This is managed the same way as apiKey - no environment variable is read by the SDK.
The API version defaults to v4 and is appended to the base URL automatically. You can override it with the apiVersion config option.
environment |
Base URL |
|---|---|
'production' (default) |
https://api.aurastride.com/webapi |
'staging' |
https://betaapi.aurastride.com/webapi |
The resolved URL becomes <base>/<apiVersion>, e.g. https://api.aurastride.com/webapi/v4.
// Staging
const client = new aurastrideClient({
apiKey: 'xak_...',
clientId: 'cid_...',
clientSecret: 'cs_...',
redirectUri: 'https://your-domain.aurastride.com',
environment: 'staging', // omit or set to 'production' for production
});const client = new aurastrideClient({
apiKey: 'xak_...',
clientId: 'cid_...',
clientSecret: 'cs_...',
redirectUri: 'https://your-domain.aurastride.com',
environment: 'production', // optional - defaults to 'production'
autoRefresh: true,
maxRetries: 5,
retryBaseDelayMs: 500,
apiVersion: 'v4', // optional - defaults to 'v4'
});Authentication
aurastride uses OAuth2. You obtain an authorization code through a customer portal under the OAuth Tokens section of Manage Token entry, then exchange it for access + refresh tokens once.
After that, the SDK handles all token injection (via Authorization: Bearer header) and silent refresh automatically.
Exchange Authorization Code
Sends grant_type: "authorization_code" to the token endpoint.
// The `code` query parameter from the OAuth2 callback URL is the only required argument.
// clientId, clientSecret and redirectUri come from the constructor config.
const tokens = await client.auth.exchangeCode('AUTH_CODE');
// tokens.data.access_token – injected as Authorization: Bearer <token> on every subsequent request
// tokens.data.refresh_token – stored and used for auto-refreshTo override credentials at call time:
const tokens = await client.auth.exchangeCode('AUTH_CODE', {
clientId: 'other-client-id',
clientSecret: 'other-secret',
redirectUri: 'https://your-domain.aurastride.com',
});Manual Token Refresh
Sends grant_type: "refresh_token" to get a new access token.
By default autoRefresh: true handles this automatically. To refresh manually (if autoRefresh: false):
const tokens = await client.auth.refreshToken();
// tokens.data.access_token – the new access tokenVerify Token
Sends grant_type: "verify_token" with the current access token in the Authorization: Bearer header.
const result = await client.auth.verifyToken();
// result.status === true → token is still validAccess the Raw Token Set
const tokenSet = client.tokenManager.getTokenSet();
// { access_token, refresh_token, expires_at }Services Overview
All services are available as properties on the client instance.
| Property | Service | Operations |
|---|---|---|
client.user |
UserService | read |
client.language |
LanguageService | read |
client.currency |
CurrencyService | read |
client.systemCategory |
SystemCategoryService | create, read, update, delete |
client.systemVariable |
SystemVariableService | create, read, update, delete |
client.lead |
LeadService | create, read, update, delete |
client.contact |
ContactService | create, read, update, delete, readByModule, apply |
client.organization |
OrganizationService | create, read, update, delete |
client.contentModel |
ContentModelService | create, read, update, delete |
client.contentField |
ContentFieldService | create, read, update, updateMeta |
client.contentHub |
ContentHubService | create, read, update, delete, verifyPassword |
client.mediaDirectory |
MediaDirectoryService | create, read, update, delete |
client.mediaRepository |
MediaRepositoryService | create, read, update, delete |
client.activity |
ActivityService | create, read, update, delete |
client.status |
StatusService | create, read, update, apply, readByModule |
client.labelGroup |
LabelGroupService | create, read, update, delete |
client.label |
LabelService | create, read, update, delete, readByModule, apply, removeApplied |
client.note |
NoteService | create, read |
client.document |
DocumentService | read, delete |
client.pricing |
PricingService | create, read |
client.manageFeature |
ManageFeatureService | manageContent, manageApp |
client.notification |
NotificationService | create |
client.timeline |
TimelineService | create |
client.webhook |
WebhookService | create, read, update, delete |
client.sso |
SsoService | generateToken |
client.marketplace |
MarketplaceService | read, readAppFeatures, readInstalledApps |
System Configuration
User
// Read system users
const users = await client.user.read({
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 10, sort: 'name', order: 'asc' },
});Language
// Read languages
const languages = await client.language.read({
pagination: { page: 1, limit: 50, sort: 'name', order: 'asc' },
});Currency
// Read currencies
const currencies = await client.currency.read({
pagination: { page: 1, limit: 50, sort: 'name', order: 'asc' },
});System Category
// Create a system category (settings group)
await client.systemCategory.create({
name: 'Test Settings Group',
description: 'Created via SDK',
});
// Read system categories
const categories = await client.systemCategory.read({
filter: { added_on: { from: '2026-04-01', to: '2026-04-30' } },
pagination: { page: 1, limit: 20, sort: 'name', order: 'asc' },
});
// Update a category
await client.systemCategory.update('SYSTEM_CATEGORY_ID', {
name: 'Updated Settings Group',
description: 'Updated via SDK',
});
// Delete a category
await client.systemCategory.delete('SYSTEM_CATEGORY_ID');System Variable
// Create a variable under a category
await client.systemVariable.create('SYSTEM_CATEGORY_ID', {
variable: {
code: 'IMGHI',
name: 'Image Height',
description: 'Used to set the height of an image.',
type: 'IN',
value: 100,
allow_modification: true,
},
});
// Read system variables
const vars = await client.systemVariable.read({
filter: { system_category_id: ['SYSTEM_CATEGORY_ID'], type: ['IN'] },
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});
// Update a variable
await client.systemVariable.update('SYSTEM_CATEGORY_ID', 'SYSTEM_VARIABLE_ID', {
variable: {
code: 'IMGHI',
name: 'Image Height - Updated',
description: 'Updated description.',
type: 'IN',
value: 300,
allow_modification: true,
},
});
// Delete a variable
await client.systemVariable.delete('SYSTEM_VARIABLE_ID');CRM
Lead
// Create
await client.lead.create({
data: {
name: 'Test Lead',
received_on: '2026-04-07',
contact: {
title: 'MR',
first_name: 'John',
middle_name: 'due',
last_name: '',
email: {
default: { meta: '', value: 'test@example.com' },
},
},
organization: {
name: 'Test Org',
number: 9876543213,
email: 'test@example.com',
},
features: {
status: { meta: 'OK', due_on: '2026-04-23', note: 'Note from SDK' },
visibility: { owner: 1, assigned_to: 1, shared_with: [1] },
labels: { values: ['medium', 'low', 'high'] },
},
meta: {},
},
});
// Read with filter + pagination
const result = await client.lead.read({
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 10, sort: 'added_on', order: 'desc' },
});
// Update
await client.lead.update('LEAD_ID', {
data: { name: 'Updated Lead Name', received_on: '2026-04-10' },
});
// Delete
await client.lead.delete('LEAD_ID');Contact
// Create
await client.contact.create({
data: {
contact: {
title: 'MR',
first_name: 'John',
middle_name: '',
last_name: 'Doe',
email: {
default: { meta: 'WK', value: 'test@example.com' },
other: [{ meta: 'HM', value: 'home@example.com' }],
},
number: {
default: { meta: 'WK', value: '+1234567893' },
other: [{ meta: 'WK', value: '9638527415' }],
},
organization: {
name: 'Test Organization',
number: 9876543213,
email: 'organization@example.com',
},
},
features: {
labels: { values: ['grade_labels', 'informative_labels'] },
visibility: { type: 'PB' },
},
meta: {
designation: 'Manager',
department: 'Sales',
website: 'www.example.com',
address: '26, Caroline',
city: 'London',
zip_code: 'SW19 3QL',
country: 'UK',
date_of_birth: '1993-04-16',
},
},
});
// Read with filter + pagination
const contacts = await client.contact.read({
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 10, sort: 'added_on', order: 'desc' },
});
// Update
await client.contact.update('CONTACT_ID', {
data: {
contact: { title: 'Mr', first_name: 'John', middle_name: 'Spy', last_name: 'Doe' },
},
});
// Delete
await client.contact.delete('CONTACT_ID');
// Read contacts linked to a specific lead
await client.contact.readByModule({
filter: { lead_id: 'LEAD_ID' },
pagination: { page: 1, limit: 100, sort: 'added_on', order: 'desc' },
});
// Link a contact to a lead
await client.contact.apply('LEAD_ID', 'CONTACT_ID');Organization
// Create
await client.organization.create({
data: {
name: 'Acme Corp',
number: '+19638527410',
email: 'acme@example.com',
website: 'https://acme.example.com',
address: '26, Caroline, London, SW19 3QL',
features: {
labels: { values: ['organelle', 'organs'] },
visibility: { type: 'PB' },
},
meta: { city: 'London', zip_code: 'SW19 3QL', country: 'United Kingdom' },
},
});
// Read
await client.organization.read({
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 10, sort: 'added_on', order: 'desc' },
});
// Update
await client.organization.update('ORGANIZATION_ID', {
data: {
name: 'Acme Corp Updated',
number: '+17418529635',
email: 'acme@example.com',
website: 'https://acme.example.com',
address: '24, Caroline, London, SW19 3QL',
},
});
// Delete
await client.organization.delete('ORGANIZATION_ID');Content
Content Model
A content model (form) defines the structure of a custom content type.
// Create a form
await client.contentModel.create({
data: {
name: 'Test Module',
meta: 'form_meta',
description: 'Created via SDK',
type: 'MF',
features: {
activity: true,
note: true,
document: true,
audit_trail: true,
import_excel: false,
export_excel: true,
language_meta: ['EN'],
status: true,
label: true,
pricing: true,
content_visibility: false,
aurastride_form: false,
seo: false,
ai_content: false,
},
},
});
// Read forms
const models = await client.contentModel.read({
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 100, sort: 'added_on', order: 'asc' },
});
// Update a form
await client.contentModel.update('form_meta', {
data: {
name: 'Updated Module Name',
description: 'Updated via SDK',
features: { aurastride_form: false, SEO: false, content_visibility: false },
},
});
// Delete a form
await client.contentModel.delete('form_meta');Content Field
Custom fields (tabs, groups, fields) define the schema of a content model.
// Create tabs, groups, and fields
await client.contentField.create('form_meta', {
tab: [
{ meta: 'overview_sdk', name: 'Overview', note: 'Overview tab' },
],
group: [
{
meta: 'primary_grp',
name: 'Primary Details',
note: 'Primary Details group',
hierarchy: { tab: { meta: 'overview_sdk' } },
},
],
field: [
{
meta: 'prname_fld',
name: 'Name',
type: 'TB',
note: 'Name field',
required: true,
unique: true,
hierarchy: { group: { meta: 'primary_grp' } },
},
],
});
// Read field definitions
const fields = await client.contentField.read('form_meta', {
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 50, sort: 'added_on', order: 'desc' },
});
// Update field definitions
await client.contentField.update('form_meta', {
field: [
{ meta: 'prname_fld', name: 'Name Updated' },
],
});
// Rename a field's meta key
await client.contentField.updateMeta('form_meta', {
field: [
{ index: 1, old: 'name', new: 'prmname_fld' },
],
});Field Type Complete Content Field Example
The following example demonstrates how to create tabs, groups, and every supported field type in a single contentField.create call.
Field Types Quick Reference
Text & Input
| Code | Name | Description |
|---|---|---|
TB |
Single Line | Basic input for short, unformatted text. Use when the data does not require paragraphs or special formatting. |
TB-NM |
Number | Captures numerical (mathematical) data only — no letters or symbols. |
TB-SL |
Slug | Generates a URL-safe string from text (e.g. my-first-post). |
TA |
Multi Line | Multi-line plain-text input for medium-to-long content without formatting. |
EM |
Captures and validates internet email addresses. | |
PH |
Phone Number | Captures, formats, and validates international telephone numbers. |
// TB - Single Line
{ meta: 'title', name: 'Title', type: 'TB', required: true, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// TB-NM - Number
{ meta: 'price', name: 'Price', type: 'TB-NM', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// TB-SL - Slug
{ meta: 'slug', name: 'Slug', type: 'TB-SL', required: true, unique: true,
hierarchy: { group: { meta: 'my_group' } }, dependencies: { slug_meta: ''} }
// TA - Multi Line
{ meta: 'description', name: 'Description', type: 'TA', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// EM - Email
{ meta: 'email', name: 'Email', type: 'EM', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// PH - Phone Number
{ meta: 'phone', name: 'Phone Number', type: 'PH', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
Selection & Choice
All choice-based fields (
DD,DM,CK,RB) require avaluesarray to define the available options.
Each option has three properties:
meta— unique key for the option (used internally by the API)name— display label shown to content authorsdefault—trueto pre-select this option,falseotherwise
BL(Boolean) does not usevalues— it always storestrueorfalse.
| Code | Name | Description |
|---|---|---|
DD |
Single Selection | Dropdown that allows selecting exactly one option from a predefined list. |
DM |
Multiple Selection | Dropdown that allows selecting one or more options at the same time. |
CK |
Checkbox | Binary Yes/No toggle, or a visible group for multi-choice selections. |
RB |
Radio Button | Presents a small set of mutually exclusive options — selecting one deselects the rest. |
BL |
Boolean | Stores a strict true / false value (saved as 1 or 0 in the database). |
// DD - Single Selection
{ meta: 'status', name: 'Status', type: 'DD', required: true, unique: false,
hierarchy: { group: { meta: 'my_group' } },
values: [
{ meta: 'draft', name: 'Draft', default: true },
{ meta: 'published', name: 'Published', default: false },
]
}
// DM - Multiple Selection
{ meta: 'tags', name: 'Tags', type: 'DM', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
values: [
{ meta: 'tag_news', name: 'News', default: false },
{ meta: 'tag_blog', name: 'Blog', default: true },
{ meta: 'tag_video', name: 'Video', default: false },
]
}
// CK - Checkbox
{ meta: 'features', name: 'Features', type: 'CK', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
values: [
{ meta: 'wifi', name: 'WiFi', default: true },
{ meta: 'parking', name: 'Parking', default: false },
{ meta: 'pool', name: 'Pool', default: false },
]
}
// RB - Radio Button
{ meta: 'priority', name: 'Priority', type: 'RB', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
values: [
{ meta: 'low', name: 'Low', default: false },
{ meta: 'medium', name: 'Medium', default: true },
{ meta: 'high', name: 'High', default: false },
]
}
// BL - Boolean
{ meta: 'is_active', name: 'Is Active', type: 'BL', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Date & Time
| Code | Name | Description |
|---|---|---|
DP |
Date Picker | Captures a specific calendar date and time. Enables scheduling and sorting. |
DR |
Date Range | Dual-input capturing a start date and an end date together. |
TP |
Time Picker | Captures a specific time of day independently of a calendar date. |
TR |
Time Range | Dual-input capturing a start time and end time within a single day. |
// DP - Date Picker
{ meta: 'published_on', name: 'Published On', type: 'DP', required: true, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// DR - Date Range
{ meta: 'event_dates', name: 'Event Dates', type: 'DR', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// TP - Time Picker
{ meta: 'open_time', name: 'Opening Time', type: 'TP', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// TR - Time Range
{ meta: 'shift_hours', name: 'Shift Hours', type: 'TR', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Rich Content & Media
| Code | Name | Description |
|---|---|---|
ED |
Editor (Rich Text) | WYSIWYG field for long-form formatted content (bold, headers, bullet points, links, media). |
FL-PB |
Public Asset File | Stores files accessible via a public URL or CDN — anyone can view or download. |
FL-PV |
Private Asset File | Stores files behind authentication/signed tokens — not accessible by the public. |
// ED - Editor
{ meta: 'body', name: 'Body', type: 'ED', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// FL-PB - Public Asset File
{ meta: 'cover_image', name: 'Cover Image', type: 'FL-PB', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// FL-PV - Private Asset File
{ meta: 'contract_pdf', name: 'Contract PDF', type: 'FL-PV', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Special
| Code | Name | Description |
|---|---|---|
LC |
Location | Captures latitude, longitude, and a human-readable address for map pinning and distance calculations. |
HF |
Hidden Field | Stores system-generated data not visible to content authors (e.g. tracking IDs, computed values). |
JN |
JSON | Stores a free-form JSON object or array. Use when the data has a flexible or nested structure that does not fit any other field type. |
// LC - Location
{ meta: 'office_location', name: 'Office Location', type: 'LC', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// HF - Hidden Field
{ meta: 'tracking_id', name: 'Tracking ID', type: 'HF', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// JN - JSON
{ meta: 'json_data', name: 'JSON Data', type: 'JN', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Relation - Entities
How it works — two steps
Step 1 — Point to the target Content Model
Setdependencies.form_metato themetaof the content model you want to link to.
Ensure that this target content model already exists before creating the field.Step 2 — Select records at content entry time
Once the field is created, authors can use it while creating or editing a content entry. They will be able to search for and select records from the linked content model.
The field stores the selected record's identifier:
- One-to-One (
OT): stores a singlecontent_id- One-to-Many (
OM): stores an array ofcontent_idvaluesImportant notes
- Self-referencing is not supported. You cannot use the same content model's
metaas the target.dependencies.form_metamust always point to a different content model.- When mapping related entities, ensure that the required data is first created in the target model. Only after that should you link it by storing its
content_idin this field.
| Code | Name | Description |
|---|---|---|
OT |
Related Entities (One to One) | Links a content entry to exactly one entry in the target content model. |
OM |
Related Entities (One to Many) | Links a content entry to multiple entries in the target content model. |
// OT - Related Entity (One to One)
// Set dependencies.form_meta to the meta of the target content model
{ meta: 'author', name: 'Author', type: 'OT', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
dependencies: { form_meta: 'target_content_model_meta' } }
// OM - Related Entity (One to Many)
// Set dependencies.form_meta to the meta of the target content model
{ meta: 'related_products', name: 'Related Products', type: 'OM', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
dependencies: { form_meta: 'target_content_model_meta' } }Relation - System Users
The selectable users for
OUandMUfields are pulled directly from your System Users list — these are the internal team members, administrators, and staff accounts registered in your aurastride platform (accessible viaclient.user.read()).
No extra configuration is needed; the field automatically presents the system user list when authors fill in a content entry.
| Code | Name | Description |
|---|---|---|
OU |
System User (One to One) | Links a content entry to exactly one authenticated system user (team member, admin). |
MU |
System User (One to Many) | Links a content entry to multiple authenticated system users for collaboration or access control. |
// OU - System User (One to One)
{ meta: 'assigned_to', name: 'Assigned To', type: 'OU', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// MU - System User (One to Many)
{ meta: 'reviewers', name: 'Reviewers', type: 'MU', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Relation - CRM Contacts
CMS use only. These fields are available exclusively inside CMS content models — they are not used within the CRM module itself.
They let a CMS content entry reference one or more existing CRM Contact records, creating a bridge between your content and your customer data.
The selectable contacts come from your CRM Contacts list (accessible viaclient.contact.read()).
| Code | Name | Description |
|---|---|---|
OC |
Contacts (One to One) | Links a content entry to exactly one CRM contact profile. |
MC |
Contacts (One to Many) | Links a content entry to multiple CRM contact profiles. |
// OC - Contact (One to One)
{ meta: 'primary_contact', name: 'Primary Contact', type: 'OC', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// MC - Contact (One to Many)
{ meta: 'attendees', name: 'Attendees', type: 'MC', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Relation - CRM Leads
CMS use only. These fields are available exclusively inside CMS content models — they are not used within the CRM module itself.
They let a CMS content entry reference one or more existing CRM Lead records, creating a bridge between your content and your sales pipeline data.
The selectable leads come from your CRM Leads list (accessible viaclient.lead.read()).
| Code | Name | Description |
|---|---|---|
OL |
Leads (One to One) | Links a content entry to exactly one CRM lead (prospective customer not yet converted). |
ML |
Leads (One to Many) | Links a content entry to multiple CRM leads (e.g. a campaign targeting multiple prospects). |
// OL - Lead (One to One)
{ meta: 'quote_lead', name: 'Quote Lead', type: 'OL', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }
// ML - Lead (One to Many)
{ meta: 'campaign_leads', name: 'Campaign Leads', type: 'ML', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } }Repeaters (CMS Only)
| Code | Name | fields shape |
Description |
|---|---|---|---|
SR |
Single Repeater | single object | Dynamic list with exactly one repeating field type (e.g. a list of text entries). |
GR |
Group Repeater | array of objects | Dynamic list where each row contains multiple field types bundled as a cohesive block. |
Supported child field types for both SR and GR:
TBTAEDTB-NMEMPHDDDMFL-PBFL-PVRBCKDPDRTPTROUOMLC
// SR - Single Repeater (one child field type only)
{ meta: 'image_gallery', name: 'Image Gallery', type: 'SR', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
fields: {
meta: 'gallery_image', name: 'Image', type: 'FL-PB', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
} }
// GR - Group Repeater (multiple field types per row)
{ meta: 'faq_list', name: 'FAQ List', type: 'GR', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } },
fields: [
{ meta: 'faq_question', name: 'Question', type: 'TB', required: true, unique: false,
hierarchy: { group: { meta: 'my_group' } } },
{ meta: 'faq_answer', name: 'Answer', type: 'TA', required: false, unique: false,
hierarchy: { group: { meta: 'my_group' } } },
] }Full Example
Runnable file:
examples/aurastride-sdk/content-field/create-full-example.js
Creates all tabs, groups, and every field type in one call.
To create a matching content entry with values for every field, seeexamples/aurastride-sdk/content-hub/create-full-example.js.
await client.contentField.create('22052', {
// --- Tabs ---
tab: [
{
meta: 'overview',
name: 'Overview',
note: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nSed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
},
{
meta: 'basic_element',
name: 'Basic Element',
note: 'This is Tab you can choose which ever you want',
},
{
meta: 'date_time_tab',
name: 'Date Time Tab',
note: 'This is Date and Time Tab',
},
{
meta: 'other_tab',
name: 'Other Tab',
note: 'This is sample Other Tab',
},
],
// --- Groups ---
group: [
{
meta: 'primary_details',
name: 'Primary Details',
note: '',
hierarchy: { tab: { meta: 'overview' } },
},
{
meta: 'basic_element_group',
name: 'Basic Element Group',
note: 'This is Tab wise group you need to change base of your need',
hierarchy: { tab: { meta: 'basic_element' } },
},
{
meta: 'date_time_element_group',
name: 'Date & Time Element',
note: 'This is Group for Date and Time Group',
hierarchy: { tab: { meta: 'date_time_tab' } },
},
{
meta: 'other_group',
name: 'Other Group',
note: 'This is Sample Other Group data',
hierarchy: { tab: { meta: 'other_tab' } },
},
],
// --- Fields ---
field: [
// TEXT & INPUT
// TB - Single-line text
{
meta: 'text_box', name: 'Text Box', type: 'TB',
note: 'A Text Box (TB) CMS field is a basic input field used to capture short, unformatted text.',
required: true, unique: true,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// TB-NM - Number
{
meta: 'number_field', name: 'Number Field', type: 'TB-NM',
note: 'A Number (TB-NM) field captures numerical data.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// TB-SL - Slug
{
meta: 'slug_field', name: 'Slug', type: 'TB-SL',
note: 'A Slug (TB-SL) field generates a URL-safe string from text.',
required: true, unique: true,
hierarchy: { group: { meta: 'basic_element_group' } },
dependencies: { slug_meta: '' },
},
// TA - Multi-line text
{
meta: 'textarea_field', name: 'Text Area', type: 'TA',
note: 'A Text Area (TA) CMS field is a multi-line plain-text input.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// EM - Email
{
meta: 'email', name: 'Email', type: 'EM',
note: 'A Email (EM) CMS field captures and validates email addresses.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// PH - Phone Number
{
meta: 'phone_number', name: 'Phone Number', type: 'PH',
note: 'A Phone Number (PH) CMS field captures international telephone numbers.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// SELECTION & CHOICE
// DD - Single Selection / Dropdown
{
meta: 'single_selection', name: 'Single Selection', type: 'DD',
note: 'A Single Selection / Dropdown (DD) CMS field selects exactly one option from a list.',
required: true, unique: true,
hierarchy: { group: { meta: 'basic_element_group' } },
values: [
{ meta: 'options_1', name: 'Option 1', default: false },
{ meta: 'option_2', name: 'Option 2', default: true },
{ meta: 'options_3', name: 'Option 3', default: false },
],
},
// DM - Multi Selection / Dropdown Multiple
{
meta: 'multi_selection', name: 'Multi Selection', type: 'DM',
note: 'A Multi-Selection / Dropdown Multiple (DM) CMS field selects one or more options.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
values: [
{ meta: 'mutli_selection_1', name: 'Multi Selection 1', default: false },
{ meta: 'mutli_selection_2', name: 'Multi Selection 2', default: true },
{ meta: 'mutli_selection_3', name: 'Multi Selection 3', default: false },
{ meta: 'mutli_selection_4', name: 'Multi Selection 4', default: true },
],
},
// CK - Checkbox
{
meta: 'checkbox', name: 'Checkbox', type: 'CK',
note: 'A Checkbox (CK) CMS field acts as a binary switch or a visible multi-choice group.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
values: [
{ meta: 'checkbox_1', name: 'Checkbox 1', default: false },
{ meta: 'checkbox_2', name: 'Checkbox 2', default: true },
{ meta: 'checkbox_3', name: 'Checkbox 3', default: false },
{ meta: 'checkbox_5', name: 'Checkbox 5', default: true },
],
},
// RB - Radio Button
{
meta: 'radio_button', name: 'Radio Button', type: 'RB',
note: 'A Radio Button (RB) CMS field presents mutually exclusive options.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
values: [
{ meta: 'radio_button1', name: 'Radio Button 1', default: false },
{ meta: 'radio_button2', name: 'Radio Button 2', default: true },
{ meta: 'radio_button3', name: 'Radio Button 3', default: false },
],
},
// BL - Boolean
{
meta: 'boolean', name: 'Boolean', type: 'BL',
note: 'A Boolean (BL) CMS field stores a strict true / false value.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// DATE & TIME
// DP - Date Picker
{
meta: 'date_picker', name: 'Date Picker', type: 'DP',
note: 'A Date Picker (DP) CMS field captures a specific calendar date.',
required: true, unique: true,
hierarchy: { group: { meta: 'date_time_element_group' } },
},
// DR - Date Range Picker
{
meta: 'date_range_picker', name: 'Date Range Picker', type: 'DR',
note: 'A Date Range Picker (DR) CMS field captures a start date and end date.',
required: false, unique: false,
hierarchy: { group: { meta: 'date_time_element_group' } },
},
// TP - Time Picker
{
meta: 'time_picker', name: 'Time Picker', type: 'TP',
note: 'A Time Picker (TP) CMS field captures a specific time of day.',
required: false, unique: false,
hierarchy: { group: { meta: 'date_time_element_group' } },
},
// TR - Time Range Picker
{
meta: 'time_range_picker', name: 'Time Range Picker', type: 'TR',
note: 'A Time Range Picker (TR) CMS field captures a start time and end time.',
required: false, unique: false,
hierarchy: { group: { meta: 'date_time_element_group' } },
},
// RICH CONTENT & MEDIA
// ED - Rich Text Editor
{
meta: 'editor', name: 'Editor', type: 'ED',
note: 'An Editor (ED) CMS field is a rich text / WYSIWYG field for long-form content.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// FL-PB - Public Asset File
{
meta: 'public_file_field', name: 'Public Asset File', type: 'FL-PB',
note: 'A Public Asset File (FL-PB) CMS field stores files served via public URL / CDN.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// FL-PV - Private Asset File
{
meta: 'private_file_field', name: 'Private Asset File', type: 'FL-PV',
note: 'A Private Asset File (FL-PV) CMS field stores files behind signed / authenticated URLs.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
// SPECIAL
// LC - Location
{
meta: 'location', name: 'Location', type: 'LC',
note: 'A Location (LC) CMS field captures latitude, longitude, and a human-readable address.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// HF - Hidden Field
{
meta: 'hidden_field', name: 'Hidden Field', type: 'HF',
note: 'A Hidden Field (HF) CMS field stores system-generated data not visible to authors.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// JN - JSON
{
meta: 'json_data', name: 'JSON Data', type: 'JN',
note: 'A JSON (JN) CMS field stores a free-form JSON object or array for flexible or nested data structures.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// RELATION - ENTITIES
// OT - Related Entity (One-to-One)
{
meta: 'related_entity_one_to_one', name: 'Related Entity (One-to-One)', type: 'OT',
note: 'A Related Entity One-to-One (OT) CMS field links to exactly one entry in another content model.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
dependencies: { form_meta: '#form_meta' },
},
// OM - Related Entity (One-to-Many)
{
meta: 'related_entity_one_many', name: 'Related Entity (One-to-Many)', type: 'OM',
note: 'A Related Entity One-to-Many (OM) CMS field links to multiple entries in another content model.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
dependencies: { form_meta: '2525252' },
},
// RELATION - SYSTEM USERS
// OU - System User (One-to-One)
{
meta: 'system_user', name: 'System User (One-to-One)', type: 'OU',
note: 'A System User One-to-One (OU) CMS field links to exactly one system user account.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// MU - System User (One-to-Many)
{
meta: 'system_user_one_to_many', name: 'System User (One-to-Many)', type: 'MU',
note: 'A System User One-to-Many (MU) CMS field links to multiple system user accounts.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// RELATION - CRM CONTACTS
// OC - Contact (One-to-One)
{
meta: 'contact_one_to_one', name: 'Contact (One-to-One)', type: 'OC',
note: 'A Contact One-to-One (OC) CMS field links to exactly one CRM contact.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// MC - Contact (One-to-Many)
{
meta: 'contact_one_to_many', name: 'Contact (One-to-Many)', type: 'MC',
note: 'A Contact One-to-Many (MC) CMS field links to multiple CRM contacts.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// RELATION - CRM LEADS
// OL - Lead (One-to-One)
{
meta: 'lead_one_to_one', name: 'Lead (One-to-One)', type: 'OL',
note: 'A Lead One-to-One (OL) CMS field links to exactly one CRM lead.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// ML - Lead (One-to-Many)
{
meta: 'lead_one_to_many', name: 'Lead (One-to-Many)', type: 'ML',
note: 'A Lead One-to-Many (ML) CMS field links to multiple CRM leads.',
required: false, unique: false,
hierarchy: { group: { meta: 'other_group' } },
},
// REPEATERS (CMS ONLY)
// SR - Single Repeater
// `fields` is a single object - only one child field type is allowed per SR.
{
meta: 'single_repeater', name: 'Single Repeater', type: 'SR',
note: 'A Single Repeater (SR) CMS field creates a dynamic list with one repeating field type.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
fields: {
meta: 'sr_text_item', name: 'Text Item', type: 'TB',
note: 'Repeating text entry.',
required: true, unique: true,
hierarchy: { group: { meta: 'basic_element_group' } },
},
},
// GR - Group Repeater
// `fields` is an array - each row repeats the entire set of child fields.
{
meta: 'group_repeater', name: 'Group Repeater', type: 'GR',
note: 'A Group Repeater (GR) CMS field creates a dynamic list where each row contains multiple field types.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
fields: [
{
meta: 'gr_text_item', name: 'Text Item', type: 'TB',
note: 'Text column in repeater row.',
required: true, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
{
meta: 'gr_date_item', name: 'Date Item', type: 'DP',
note: 'Date column in repeater row.',
required: false, unique: false,
hierarchy: { group: { meta: 'basic_element_group' } },
},
],
},
],
});Content Hub
Content hub stores the actual records for any content model.
Full field type example: See
examples/aurastride-sdk/content-hub/create-full-example.jsfor a completecontentHub.createcall that covers every supported field type (text, selection, date/time, rich content, location, all relation types, and repeaters).
The companion content field definition lives inexamples/aurastride-sdk/content-field/create-full-example.js.
// Create a content entry
const entry = await client.contentHub.create('form_meta', {
meta: {
title: 'My Entry',
shared_with: [1, 2],
pname_field: 'SDK test',
},
});
// Read entries with filtering and pagination
const entries = await client.contentHub.read('form_meta', {
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 10, sort: 'added_on', order: 'desc' },
});
// Update an entry
await client.contentHub.update('form_meta', 'CONTENT_ID', {
meta: { title: 'My Entry - Updated', pname_field: 'SDK test - Updated' },
});
// Delete an entry
await client.contentHub.delete('form_meta', 'CONTENT_ID');
// Verify a password-type field value
const ok = await client.contentHub.verifyPassword(
'form_meta', 'CONTENT_ID', 'PASSWORD_FIELD_META', '123456'
);Content Hub Full Field Type Example
A complete contentHub.create call that covers every supported field type in a single payload.
The content model (tabs, groups, and fields) this example targets is created by the Full Example in the Field Type reference above, and its standalone runnable version is at examples/aurastride-sdk/content-hub/create-full-example.js.
How to set Relation (Entity) field values
For
OT,OM,OU,MU,OC,MC,OL, andMLfields, you do not pass raw data — you pass the identifier(s) of records that already exist in the linked source.
Field type What to pass How to get the value OT— Related Entity (One-to-One)A single content_idstringclient.contentHub.read('target_model_meta')→ pick a record'scontent_idOM— Related Entity (One-to-Many)An array of content_idstringsSame as above, collect multiple OU— System User (One-to-One)A single user ID (integer) client.user.read()→ pick a record'sidMU— System User (One-to-Many)An array of user IDs Same as above, collect multiple OC— CRM Contact (One-to-One)A single contact_idstringclient.contact.read()→ pick a record'scontact_idMC— CRM Contact (One-to-Many)An array of contact_idstringsSame as above, collect multiple OL— CRM Lead (One-to-One)A single lead_idstringclient.lead.read()→ pick a record'slead_idML— CRM Lead (One-to-Many)An array of lead_idstringsSame as above, collect multiple Prerequisite: the linked records must exist before you create or update the content entry that references them.
await client.contentHub.create('22052', {
meta: {
// TEXT & INPUT
text_box: 'Sample single-line text',
number_field: 42,
slug_field: 'sample-single-line-text',
textarea_field: 'This is a longer multi-line text.\nLine two of the text area.',
email: 'user@example.com',
phone_number: '+1234567890',
// SELECTION & CHOICE
single_selection: 'option_2', // DD: single option meta
multi_selection: ['mutli_selection_2', 'mutli_selection_4'], // DM: array of option metas
checkbox: ['checkbox_2', 'checkbox_5'], // CK: array of option metas
radio_button: 'radio_button2', // RB: single option meta
boolean: true, // BL: true or false
// DATE & TIME
date_picker: '2026-05-15',
date_range_picker: { from: '2026-05-01', to: '2026-05-31' },
time_picker: '09:00',
time_range_picker: { from: '09:00', to: '17:00' },
// RICH CONTENT & MEDIA
editor: '<p>This is <strong>rich text</strong> content created via SDK.</p>',
public_file_field: 'BASE64_ENCODED_FILE_DATA',
private_file_field: 'BASE64_ENCODED_FILE_DATA',
// SPECIAL
location: { lat: 51.5074, lng: -0.1278, address: '10 Downing Street, London, UK' },
hidden_field: 'system-generated-value',
json_data: { key: 'value', tags: ['a', 'b'], nested: { count: 3 } }, // JN: any valid JSON
// RELATION - ENTITIES
related_entity_one_to_one: 'TARGET_CONTENT_ID', // OT: single content_id
related_entity_one_many: ['TARGET_CONTENT_ID_1', 'TARGET_CONTENT_ID_2'], // OM: array of content_ids
// RELATION - SYSTEM USERS
system_user: 1, // OU: single user ID
system_user_one_to_many: [1, 2], // MU: array of user IDs
// RELATION - CRM CONTACTS
contact_one_to_one: 'CONTACT_ID', // OC: single contact_id
contact_one_to_many: ['CONTACT_ID_1', 'CONTACT_ID_2'], // MC: array of contact_ids
// RELATION - CRM LEADS
lead_one_to_one: 'LEAD_ID', // OL: single lead_id
lead_one_to_many: ['LEAD_ID_1', 'LEAD_ID_2'], // ML: array of lead_ids
// REPEATERS
// SR - array of row objects; each row has one key matching the child field meta
single_repeater: [
{ sr_text_item: 'First repeating text' },
{ sr_text_item: 'Second repeating text' },
{ sr_text_item: 'Third repeating text' },
],
// GR - array of row objects; each row has keys for every child field meta
group_repeater: [
{ gr_text_item: 'What is aurastride?', gr_date_item: '2026-05-01' },
{ gr_text_item: 'How does the SDK work?', gr_date_item: '2026-05-10' },
],
},
});Digital Asset Management
Media Directory
// Create a directory (empty string = root)
await client.mediaDirectory.create({
directory_id: '', // '' or parent directory ID to nest
name: 'Test SDK Folder',
});
// Read directories
const dirs = await client.mediaDirectory.read({
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});
// Update a directory name
await client.mediaDirectory.update('DIRECTORY_ID', { name: 'Updated SDK Folder' });
// Delete a directory
await client.mediaDirectory.delete('DIRECTORY_ID');Media
// Upload a file (base64) to a directory
await client.mediaRepository.create('DIRECTORY_ID', {
documents: [
{ name: 'example.png', data: 'BASE64_STRING' },
],
features: { labels: { values: ['1_star'] } },
});
// Read media files
const files = await client.mediaRepository.read({
filter: { added_on: { from: '2026-04-01', to: '2026-04-07' } },
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});
// Update a file's data and advanced metadata
await client.mediaRepository.update('MEDIA_ID', {
document: { name: 'example.png', data: 'BASE64_STRING' },
advanced: { title: 'example.png', alternativetext: 'example file' },
});
// Delete a file
await client.mediaRepository.delete('MEDIA_ID');Features
Activity
Activities are events: meetings (MET), calls (CAL), emails (EML), tasks (TSK).
// Create an activity
await client.activity.create({
name: 'SDK Meeting',
description: 'Activity for SDK meeting.',
category: 'CAL',
start: { date: '2026-04-01', time: '01:00' },
end: { date: '2026-04-07', time: '02:00' },
priority: 'LW',
status: 'P',
linked_to: { form_meta: 'form_meta', reference_id: 'CONTENT_ID' },
features: {
labels: { values: ['3_star', '4_star'] },
visibility: { assigned_by: [1], assigned_to: [1] },
documents: [{ name: 'file.png', data: 'BASE64_STRING' }],
},
});
// Read activities
const activities = await client.activity.read({
filter: { search_by: 'ALL', search: '' },
pagination: { page: 1, limit: 10, sort: 'added_on', order: 'desc' },
});
// Update an activity
await client.activity.update('ACTIVITY_ID', {
name: 'SDK Meeting Updated',
description: 'Updated description.',
category: 'CAL',
start: { date: '2026-04-01', time: '01:00' },
end: { date: '2026-04-07', time: '02:00' },
priority: 'LW',
status: 'P',
linked_to: { form_meta: 'form_meta', reference_id: 'CONTENT_ID' },
features: {
labels: { values: ['3_star', '4_star'] },
visibility: { assigned_by: [1], assigned_to: [1] },
},
});
// Delete an activity
await client.activity.delete('ACTIVITY_ID');Status
// Create a status
await client.status.create('form_meta', {
name: 'Success',
default: true,
note_required: false,
bg_color: '#116b18',
fg_color: '#ffffff',
});
// Read statuses for a form
const statuses = await client.status.read('form_meta', {
filter: { added_on: { from: '2026-04-01', to: '2026-04-30' } },
pagination: { page: 1, limit: 20, sort: 'name', order: 'asc' },
});
// Read statuses applied to specific content records
const appliedStatuses = await client.status.readByModule('form_meta', {
filter: {
content_id: ['CONTENT_ID'],
added_on: { from: '2026-04-01', to: '2026-04-30' },
added_by: [],
},
pagination: { page: 1, limit: 100, sort: 'added_on', order: 'desc' },
});
// Update a status
await client.status.update('form_meta', 'STATUS_META', {
name: 'In Review (Updated)',
color: '#FF8C00',
});
// Apply status to a content record
await client.status.apply('form_meta', 'CONTENT_ID', {
status_meta: 'STATUS_META',
note: 'Status applied via SDK',
due_date: '2026-05-01',
});Label Group
// Create label groups for a form/module
await client.labelGroup.create('form_meta', {
group: [{ name: 'Priority' }],
});
// Read label groups
const groups = await client.labelGroup.read({
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});
// Update a label group (provide meta key from dropdown)
await client.labelGroup.update('form_meta', 'EN', {
group: [{ meta: 'priority', name: 'Priority Level' }],
});
// Delete a label group
await client.labelGroup.delete('form_meta', { meta: 'priority' });Label
Labels are tags that can be attached to content records.
// Create a label group with labels
await client.label.create('form_meta', {
group: [{ name: 'Star' }],
label: [
{ meta: '1star', name: '1 Star' },
{ meta: '2star', name: '2 Star' },
{ meta: '3star', name: '3 Star' },
{ meta: '4star', name: '4 Star' },
{ meta: '5star', name: '5 Star' },
],
});
// Read labels
const labels = await client.label.read('form_meta', {
hierarchy: true,
pagination: { page: 1, limit: 20, sort: 'name', order: 'asc' },
});
// Read labels available for a specific module / content record
const moduleLabels = await client.label.readByModule('form_meta', {
filter: {
content_id: 'CONTENT_ID',
added_on: { from: '2026-04-01', to: '2026-04-30' },
},
pagination: { page: 1, limit: 100, sort: 'labels.values.name', order: 'desc' },
});
// Update a label group and labels
await client.label.update('form_meta', {
group: [{ meta: 'LABEL_GROUP_META', name: 'Stars' }],
label: [
{ meta: '1_star', name: '1 Star (*)' },
{ meta: '2_star', name: '2 Stars (**)' },
],
});
// Delete a label by its meta
await client.label.delete('form_meta', { label_meta: 'LABEL_META' });
// Assign labels to a content record
await client.label.apply('form_meta', 'CONTENT_ID', ['1_star', '2_star']);
// Remove assigned labels
await client.label.removeApplied('form_meta', 'CONTENT_ID', ['1_star']);Notes
// Create a note with optional file attachments
await client.note.create('form_meta', 'CONTENT_ID', {
note: 'This is a test note created via the SDK.',
documents: {
documents: [{ name: 'example.png', data: 'BASE64_STRING' }],
},
});
// Read notes
const notes = await client.note.read('form_meta', {
filter: { content_id: 'CONTENT_ID' },
pagination: { page: 1, limit: 10, sort: 'added_on', order: 'desc' },
});Documents
// Read documents attached to a content record
const docs = await client.document.read('form_meta', 'CONTENT_ID', {
filter: { added_on: { from: '2026-04-01', to: '2026-04-08' } },
pagination: { page: 1, limit: 20, sort: 'LTS', order: 'desc' },
});
// Delete a specific document
await client.document.delete('form_meta', 'CONTENT_ID', 'DOCUMENT_ID');Pricing
// Create a pricing entry
await client.pricing.create('form_meta', 'CONTENT_ID', {
currency: { meta: 'USD', cost: '99.99' },
note: 'Pricing entry created via SDK',
});
// Read pricing records
const prices = await client.pricing.read('form_meta', {
filter: { content_id: ['CONTENT_ID'] },
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});Manage Feature
// Enable / update a feature on a content record
await client.manageFeature.manageContent('form_meta', 'CONTENT_ID', {
feature: {
code: 'LABEL',
data: { count: 1, value: '120', other: {} },
},
});
// Update a feature configuration for a marketplace app
await client.manageFeature.manageApp('APP_ID', 'form_meta', 'CONTENT_ID', {
feature: {
data: { count: 1, value: '120', other: {} },
},
});Notification
Announcement
// Send an in-platform notification to users
await client.notification.create({
title: 'Hello!',
user_ids: [5, 27],
content: '<p>Welcome to the platform!</p>',
from_date: '2026-04-20',
type: 'SUCES', // SUCES | INFO | WARN | DANGE
display_type: 'DASH',
});
Timeline
// Create a timeline / notification entry
await client.timeline.create(
'form_meta',
'CONTENT_ID',
'USER_ID',
'Timeline entry created via SDK.',
);Integration
Webhook
// Create a webhook
await client.webhook.create({
title: 'CMS Record Creation Hook',
description: 'Webhook created from SDK.',
action: {
event: 'form_meta.CREATE',
triggeredon: '',
method: 'GET',
requesturl: 'https://webhook.example.com/receive',
},
headers: {
basic_auth: { username: 'admin', password: 'password123' },
custom_data: { key: 'x-api-key', value: 'YOUR_API_KEY' },
},
});
// Read webhooks
const hooks = await client.webhook.read({
filter: { added_on: { from: '2026-02-01', to: '2026-04-30' } },
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});
// Update a webhook
await client.webhook.update('WEBHOOK_ID', {
title: 'CMS Record Creation Hook - Updated',
description: 'Webhook updated via SDK.',
action: {
event: 'form_meta.CREATE',
triggeredon: '',
method: 'GET',
requesturl: 'https://webhook.example.com/updated-receive',
},
headers: {
basic_auth: { username: 'admin', password: 'password123' },
custom_data: { key: 'x-api-key', value: 'YOUR_API_KEY' },
},
});
// Delete a webhook
await client.webhook.delete('WEBHOOK_ID');SSO Token
Generate an SSO token with granular CRUD permissions.
const result = await client.sso.generateToken(
'form_meta',
'CONTENT_ID',
'LIST', // use_case identifier
{
email: 'customer@example.com',
name: 'Customer Name',
access: { view: true, add: false, edit: true, delete: false },
},
);
// result.token - use as the authentication token in your SSO integrationMarketplace APP
Manage APP Counts & Info
App Feature Management
// Read stored feature data for a specific app and form
const features = await client.marketplace.readAppFeatures('APP_ID', 'form_meta', {
filter: {
content_id: [],
added_on: { from: null, to: null },
modified_on: { from: null, to: null },
},
pagination: { page: 1, limit: 100, sort: 'content_id', order: 'asc' },
});
Read App Feature Data
// Read stored feature data for a specific app and form
const features = await client.marketplace.readAppFeatures('APP_ID', 'form_meta', {
filter: {
content_id: [],
added_on: { from: null, to: null },
modified_on: { from: null, to: null },
},
pagination: { page: 1, limit: 100, sort: 'content_id', order: 'asc' },
});
Read Installed APP Data
Read Installed Apps
// Read available marketplace apps
const apps = await client.marketplace.read({
filter: { app_id: [] },
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});
Read Installed APP Models
// Read installed APP records
const installed = await client.marketplace.readInstalledApps({
pagination: { page: 1, limit: 20, sort: 'added_on', order: 'desc' },
});Default Filter & Pagination
Every read method automatically includes the following defaults so you don't have to pass them on every call:
{
"filter": {
"search_by": "ALL",
"search": ""
},
"pagination": {
"page": 1,
"limit": 20,
"sort": "field",
"order": "desc/asc"
}
}You only need to supply the values you want to override:
// No params - full defaults are sent automatically
const all = await client.lead.read();
// Override only page and limit; all other defaults apply
const page2 = await client.lead.read({
pagination: { page: 2, limit: 50 },
});
// Narrow by search term, keep default pagination
const found = await client.lead.read({
filter: { search_by: 'email', search: 'john@example.com' },
});Default values reference
| Parameter | Key | Default |
|---|---|---|
filter |
search_by |
'ALL' |
filter |
search |
'' |
pagination |
page |
1 |
pagination |
limit |
20 |
pagination |
sort |
'' |
pagination |
order |
'desc' |
Pagination
Use the built-in paginate() async generator to iterate over all pages automatically. The read-method defaults (page: 1, limit: 20) still apply per page unless explicitly overridden in the paginate options.
import { paginate } from '@aurastride/sdk';
// Iterate all leads page by page
for await (const page of paginate(
(pg) => client.lead.read({ pagination: pg }),
{ limit: 50, sort: 'created_at', order: 'desc' }
)) {
console.log('Page records:', page.data);
}paginate(fetchFn, options) options:
| Option | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Starting page number |
limit |
number |
20 |
Records per page |
sort |
string |
'' |
Field to sort by |
order |
string |
'desc' |
'asc' or 'desc' |
The generator stops when a page returns fewer records than limit.
Caching
Pass cacheTtl (milliseconds) on any read call to cache the response in memory.
// Cache this response for 30 seconds
const result = await client.contentHub.read('form_meta', {}, {
cacheTtl: 30_000,
cacheKey: 'products-page-1', // optional; auto-generated if omitted
});
// Second call within 30 s returns cached data without a network request
const same = await client.contentHub.read('form_meta', {}, {
cacheTtl: 30_000,
cacheKey: 'products-page-1',
});Cache is per-client-instance, held in memory, and automatically expires. Useful for read-heavy scenarios like listing languages or currencies.
Interceptors
Intercept and modify every request config or response, similar to Axios interceptors.
Request Interceptor
// Add a custom header to every request
const id = client.interceptors.request.use((config) => {
config.headers['x-correlation-id'] = crypto.randomUUID();
return config;
});
// Remove the interceptor later
client.interceptors.request.eject(id);Response Interceptor
// Log every response
client.interceptors.response.use(
(response) => {
console.log('[SDK response]', response);
return response;
},
(error) => {
console.error('[SDK error]', error.message);
throw error;
}
);Error Handling
All SDK errors are instances of aurastrideError. Use instanceof to branch by type.
import {
aurastrideError,
AuthError,
ApiError,
NetworkError,
RateLimitError,
} from '@aurastride/sdk';
try {
await client.lead.read();
} catch (err) {
if (err instanceof RateLimitError) {
// Wait retryAfterMs before trying again
await new Promise(r => setTimeout(r, err.retryAfterMs ?? 1000));
} else if (err instanceof AuthError) {
// Token expired / invalid - re-authenticate
console.error('Auth failed:', err.message, err.statusCode);
} else if (err instanceof ApiError) {
// Non-2xx API response
console.error(`API error ${err.statusCode} on ${err.action}:`, err.message);
console.error('Response body:', err.responseBody);
} else if (err instanceof NetworkError) {
// DNS failure, connection refused, etc.
console.error('Network error:', err.message, err.cause);
} else if (err instanceof aurastrideError) {
// Catch-all for other SDK errors
console.error(err.code, err.message);
}
}Error Class Reference
| Class | Code | Extends | Extra properties |
|---|---|---|---|
aurastrideError |
aurastride_error |
Error |
code |
AuthError |
AUTH_ERROR |
aurastrideError |
statusCode |
ApiError |
API_ERROR |
aurastrideError |
statusCode, action, responseBody |
NetworkError |
NETWORK_ERROR |
aurastrideError |
cause (original fetch error) |
RateLimitError |
RATE_LIMIT_ERROR |
ApiError |
retryAfterMs |
TypeScript Usage
The package ships .d.ts declaration files generated from JSDoc annotations.
No separate @types/ package is required - types work out of the box.
1. Prerequisites
Minimum tsconfig.json:
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ES2022",
"strict": true
}
}For CommonJS projects use
"module": "CommonJS"and"moduleResolution": "Node".
2. Install
npm install @aurastride/sdkNo @types/... package needed.
3. Client Setup
import { aurastrideClient } from '@aurastride/sdk';
const client = new aurastrideClient({
apiKey: process.env.AURASTRIDE_API_KEY!,
clientId: process.env.AURASTRIDE_CLIENT_ID!,
clientSecret: process.env.AURASTRIDE_CLIENT_SECRET!,
redirectUri: process.env.AURASTRIDE_REDIRECT_URI!,
autoRefresh: true, // silently refreshes token 60 s before expiry
maxRetries: 3,
retryBaseDelayMs: 300,
});4. Authentication
// Call once after the OAuth2 redirect hands you the code.
// redirectUri is taken from the constructor config automatically.
const tokens = await client.auth.exchangeCode(authCode);
// tokens.access_token / tokens.refresh_token stored automatically
// All subsequent requests inject the token - no extra work needed
// Override redirectUri (and optionally credentials) at call time:
const tokens2 = await client.auth.exchangeCode(authCode, {
redirectUri: 'https://your-domain.aurastride.com',
});5. Reading Data
const result = await client.lead.read({
filter: { name: 'Acme' },
pagination: { page: 1, limit: 25, sort: 'created_at', order: 'desc' },
});6. Creating Records
// CRM lead
await client.lead.create({
data: {
name: 'New Lead',
received_date: '2026-04-01',
contact: { first_name: 'Jane', last_name: 'Doe', email: 'jane@example.com' },
},
});
// Content hub entry
await client.contentHub.create('products', {
meta: { title: 'Widget Pro', price: '49.99' },
});7. Updating and Deleting
await client.lead.update('LEAD_ID', { data: { name: 'Updated Name' } });
await client.lead.delete('LEAD_ID');
await client.contentHub.update('products', 'CONTENT_ID', { meta: { price: '39.99' } });
await client.contentHub.delete('products', 'CONTENT_ID');8. Pagination
import { aurastrideClient, paginate } from '@aurastride/sdk';
for await (const page of paginate(
(pg) => client.contentHub.read('products', { pagination: pg }),
{ limit: 50, sort: 'created_at', order: 'desc' }
)) {
const records = page.data ?? [];
records.forEach((r: any) => console.log(r));
}9. Caching
// Cache language list for 60 seconds (rarely changes)
const languages = await client.language.read({}, {
cacheTtl: 60_000,
cacheKey: 'languages',
});10. Interceptors
// Attach a correlation ID to every outgoing request
client.interceptors.request.use((config) => {
config.headers['x-request-id'] = crypto.randomUUID();
return config;
});
// Log all responses and errors
client.interceptors.response.use(
(response) => { console.log('[sdk]', response); return response; },
(error) => { console.error('[sdk error]', error); throw error; }
);11. Error Handling
import {
aurastrideError,
AuthError,
ApiError,
NetworkError,
RateLimitError,
} from '@aurastride/sdk';
async function fetchLeads(): Promise<void> {
try {
const result = await client.lead.read({ pagination: { page: 1, limit: 20 } });
console.log(result);
} catch (err) {
if (err instanceof RateLimitError) {
const waitMs = err.retryAfterMs ?? 2000;
await new Promise((r) => setTimeout(r, waitMs));
} else if (err instanceof AuthError) {
// Token expired - re-authenticate
console.error('Auth error:', err.statusCode, err.message);
} else if (err instanceof ApiError) {
console.error(`API ${err.statusCode} [${err.action}]:`, err.message);
console.error('Response body:', err.responseBody);
} else if (err instanceof NetworkError) {
console.error('Network failure:', err.message, err.cause);
} else if (err instanceof aurastrideError) {
console.error(err.code, err.message);
}
}
}12. SSO Token
const sso = await client.sso.generateToken(
'form_meta', 'CONTENT_ID', 'admin_portal',
{ email: 'admin@example.com', name: 'Admin', access: { view: true, add: true, edit: true, delete: false } }
);
console.log(sso.token);13. Environment Variables
# .env - production
AURASTRIDE_API_KEY=xak_...
AURASTRIDE_CLIENT_ID=cid_...
AURASTRIDE_CLIENT_SECRET=cs_...
AURASTRIDE_REDIRECT_URI=https://your-domain.aurastride.com
AURASTRIDE_ENV=production
# .env - staging
AURASTRIDE_API_KEY=xak_...
AURASTRIDE_CLIENT_ID=cid_...
AURASTRIDE_CLIENT_SECRET=cs_...
AURASTRIDE_REDIRECT_URI=https://your-domain.aurastride.com
AURASTRIDE_ENV=staging| Variable | Description |
|---|---|
AURASTRIDE_API_KEY |
Your x-api-key value |
AURASTRIDE_CLIENT_ID |
OAuth2 client ID |
AURASTRIDE_CLIENT_SECRET |
OAuth2 client secret |
AURASTRIDE_REDIRECT_URI |
OAuth2 redirect URI sent during token exchange. Required |
AURASTRIDE_ENV |
production (default) or staging - passed as environment to the client config |
const client = new aurastrideClient({
apiKey: process.env.AURASTRIDE_API_KEY!,
clientId: process.env.AURASTRIDE_CLIENT_ID!,
clientSecret: process.env.AURASTRIDE_CLIENT_SECRET!,
redirectUri: process.env.AURASTRIDE_REDIRECT_URI!,
environment: process.env.AURASTRIDE_ENV, // 'production' or 'staging'
});15. Full End-to-End Example
import { aurastrideClient, ApiError, paginate } from '@aurastride/sdk';
const client = new aurastrideClient({
apiKey: process.env.AURASTRIDE_API_KEY!,
clientId: process.env.AURASTRIDE_CLIENT_ID!,
clientSecret: process.env.AURASTRIDE_CLIENT_SECRET!,
redirectUri: process.env.AURASTRIDE_REDIRECT_URI!,
environment: process.env.AURASTRIDE_ENV, // 'production' or 'staging'
});
async function main(): Promise<void> {
// 1. Authenticate once
await client.auth.exchangeCode(process.env.AURASTRIDE_AUTH_CODE!);
// 2. Create a content entry
const created = await client.contentHub.create('products', {
meta: { product_name: 'Widget Pro', price: '49.99' },
});
const id: string = created.content_id;
// 3. Read it back
const entry = await client.contentHub.read('products', {
filter: { content_id: id },
pagination: { page: 1, limit: 1 },
});
console.log(entry);
// 4. Paginate all products
for await (const page of paginate(
(pg) => client.contentHub.read('products', { pagination: pg }),
{ limit: 50 }
)) {
console.log('page:', page.data?.length);
}
// 5. Update then delete
await client.contentHub.update('products', id, { meta: { price: '39.99' } });
await client.contentHub.delete('products', id);
}
main().catch((err) => {
if (err instanceof ApiError) {
console.error(`API ${err.statusCode}: ${err.message}`);
} else {
console.error(err);
}
});Constants Reference
For advanced use or SDK extension, the raw constants are exported:
import { ENDPOINTS, ACTIONS, BASE_URL, DEFAULT_API_VERSION } from '@aurastride/sdk';
// ENDPOINTS.lead.create → { path: '/lead/create', method: 'POST' }
// ACTIONS.lead.CREATE → 'CRM.LEAD.CREATE'
// BASE_URL → 'https://api.aurastride.com/webapi'
// DEFAULT_API_VERSION → 'v4'These let you build custom requests or extend services without modifying the SDK source.
License
ISC