Skip to content

Data Collections ​

A reference map of the ~150 MongoDB (Mongoose) collections that back the Oktivo platform — grouped by domain, with why each exists, which UI section depends on it, and which code files read/write it.

How to read this doc. Every collection is a Mongoose model defined in backend/client_backend/src/models/*.ts (a few legacy ones live in backend/client_backend/src/legacy_models/*.ts). The Schema file column is the model file that declares the collection. The Touched by column lists the main route/controller/service/repository files that write it; follow the call chain routes → controllers → services → repositories → models (see the Developer Guide). The UI / feature column links to the dashboard doc that surfaces the data.

Jargon: a collection is MongoDB's equivalent of a SQL table; a Mongoose model is the TypeScript schema + query interface bound to one collection. Most collections are org/customer-scoped — rows carry a customerUID (and often organizationId) so one tenant never sees another's data.

Architecture Overview ​

How the dashboards map onto the domain groups below:


Identity & Org ​

Who the user is, which org/role they belong to, and the config that governs their tenant. These are read on almost every authenticated request. Primarily surfaced in the Org (Admin) Dashboard and Superadmin Dashboard; also underpin Customer → Account/Settings.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
UserEvery person who signs in (customer, admin, superadmin); holds role, org link, auth stateAccount / Settings, all loginsauth.routes.ts, team.routes.ts, auth.service.tsmodels/User.ts
OrganizationThe tenant that owns customers, numbers, credits and configOrg & Superadmin dashboardsadmin.routes.ts, superadmin.routes.ts, organization.service.tsmodels/Organization.ts
RoleNamed permission sets consumed by requireRole/requirePermissionTeam RBAC, Superadmin → Rolesrole.routes.ts, RBAC middlewaremodels/Role.ts
SystemConfigGlobal platform defaults (feature flags, provider toggles)Superadmin → System ConfigsystemConfig.routes.tsmodels/SystemConfig.ts
ConfigVersionVersioned snapshots of config changes for audit/rollbackAdmin → Config Managementconfig.routes.tsmodels/ConfigVersion.ts
OrgConfigReplicaPer-org cached copy of config the agent server readsConfig management, agent runtimeconfig.service.tsmodels/OrgConfigReplica.ts
OrgProviderEnablementWhich voice/LLM providers an org may useAdmin/Superadmin provider setupadmin-provisioning.routes.tsmodels/OrgProviderEnablement.ts
ApiTokenProgrammatic API keys for the public CRM APICustomer → Settings → API Docscrm-api.routes.ts, apiToken.service.tsmodels/ApiToken.ts
DeviceTokenPush-notification device registrationsNotificationscrmNotification.routes.tsmodels/DeviceToken.ts
EmailTokenShort-lived tokens for email verify / password resetAuth flowsauth.service.tsmodels/EmailToken.ts
KycKYC/onboarding verification records for an orgOnboarding / Adminadmin.service.tsmodels/Kyc.ts

CRM Core ​

The heart of the Customer → CRM section: leads, contacts, companies, deals, tasks and the fields/segments around them.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
CrmLeadThe central person/lead record; most CRM data hangs off leadIdCRM → Leads / My QueuecrmLead.routes.ts, crmLead.service.ts, crmLead.repository.tsmodels/CrmLead.ts
CrmLeadIdentitySource-specific identifiers (metaLeadId, formId) deduped onto a leadLead import / attributioncrmLeadImport.service.tsmodels/CrmLeadIdentity.ts
CrmLeadJourneyTimeline of a lead's stage/touch historyLead detail timelinecrmLead.service.tsmodels/CrmLeadJourney.ts
CrmLeadAttachmentFiles attached to a leadLead detailcrmLead.controller.tsmodels/CrmLeadAttachment.ts
CrmLeadImportOne CSV/API import batch + its statusCRM → Leads → ImportcrmLeadImport.routes.tsmodels/CrmLeadImport.ts, models/crmLeadImportShared.ts
ContactCommunication contact; joins to a lead via crmLeadIdCRM → Contactscontact.routes.ts, contact.service.tsmodels/Contact.ts
CrmCompanyB2B account a lead/deal belongs toCRM → CompaniescrmCompany.routes.tsmodels/CrmCompany.ts
CrmOpportunityA sales deal tied to a lead (and optionally a company)CRM → OpportunitiescrmOpportunity.routes.tsmodels/CrmOpportunity.ts
CrmTaskTo-do linked to a lead and/or dealCRM → TaskscrmTask.routes.tsmodels/CrmTask.ts
CrmReminderScheduled reminder on a leadCRM → Tasks / reminderscrmReminder.routes.tsmodels/CrmReminder.ts
CrmSegmentSaved filter definition over leadsCRM → SegmentscrmSegment.routes.tsmodels/CrmSegment.ts
CrmSegmentMemberMaterialised membership of a segmentSegment targetingcrmSegment.service.tsmodels/CrmSegmentMember.ts
CrmCustomFieldPer-org custom field definitions on leadsCRM settingscrmCustomField.service.tsmodels/CrmCustomField.ts
CrmFieldMapping / LeadFieldMappingMap external source fields → CRM fieldsImport / integrationscrmLeadImport.service.tsmodels/CrmFieldMapping.ts, models/LeadFieldMapping.ts
CrmColumnMerge / CrmColumnMigrationLedgerColumn merge/migration bookkeepingCRM admin opscrmColumn.service.tsmodels/CrmColumnMerge.ts, models/CrmColumnMigrationLedger.ts
CrmNotificationIn-app CRM notificationsMonitor → NotificationscrmNotification.routes.tsmodels/CrmNotification.ts
CrmOrgSettingsPer-org CRM behaviour settingsCRM settingscrmOrgSettings.service.tsmodels/CrmOrgSettings.ts
CrmCommunicationLogLog of calls/emails/messages against a leadLead activitycrmCommunicationLog.service.tsmodels/CrmCommunicationLog.ts
LeadSyncHistoryRecord of lead sync runs with external CRMsConnecter synccrmSyncLog.service.tsmodels/LeadSyncHistory.ts
CrmVisitorIndex / CrmWebEvent / CrmWebSessionWebsite visitor tracking tied back to leadsMarketing / web attributioncrmWebEvent.service.tsmodels/CrmVisitorIndex.ts, models/CrmWebEvent.ts, models/CrmWebSession.ts

CRM core relationships ​


Commerce ​

Backs Customer → Commerce: stores, inventory, orders and transactions synced from Shopify and friends.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
CrmStoreA connected storefront (e.g. Shopify)Commerce → StorescrmStore.routes.tsmodels/CrmStore.ts
CrmStoreStockPer-store stock levelsCommerce → InventorycrmStore.service.tsmodels/CrmStoreStock.ts
CrmInventoryProduct catalog / inventory itemsCommerce → InventorycrmInventory.routes.tsmodels/CrmInventory.ts
CrmOrderA commerce order linked to a lead/contactCommerce → OrderscrmOrder.routes.tsmodels/CrmOrder.ts
CrmTransactionPayment/transaction records for ordersCommerce → TransactionscrmTransaction.routes.tsmodels/CrmTransaction.ts
CrmAbandonedCheckoutAbandoned-cart events for follow-up callsCommerce / campaignscrmAbandonedCheckout.service.tsmodels/CrmAbandonedCheckout.ts
CrmCommerceSettingsPer-org commerce behaviour configCommerce settingscrmCommerceSettings.service.tsmodels/CrmCommerceSettings.ts
CrmCommerceCustomFieldCustom fields on commerce recordsCommerce settingscrmCommerceCustomField.service.tsmodels/CrmCommerceCustomField.ts
ShopifyConnectionConfigShopify store OAuth/connection detailsConnecter → CommercecrmStore.service.tsmodels/ShopifyConnectionConfig.ts

Voice / Calling ​

Backs Customer → Call and Chatbot plus phone-number & provider provisioning on the Org and Superadmin dashboards.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
AgentA voice/chatbot agent config (prompt, voice, tools)Call and Chatbot → Agentsagent.routes.ts, agent.service.tsmodels/Agent.ts
AgentPromptVersionVersion history of an agent's promptAgent editoragent.service.tsmodels/AgentPromptVersion.ts
CampaignA bulk outbound calling campaignBulk Callingcampaign.routes.ts, campaign.service.tsmodels/Campaign.ts
CampaignReportPer-campaign roll-up metricsCampaign reportcampaignAnalytics.service.tsmodels/CampaignReport.ts
CampaignAnalysisAI analysis results for a campaignCampaign analysiscampaignAnalysis.service.tsmodels/CampaignAnalysis.ts
CampaignWebhookPer-campaign webhook configCampaign settingscampaignWebhook.service.tsmodels/CampaignWebhook.ts
HumanCallHuman-handled / transferred call recordsCalls / Transfer to HumanhumanCall.service.tsmodels/HumanCall.ts
TestCall / TrustedTestNumberTest-call records and allow-listed test numbersAgent testingtestCall.service.tsmodels/TestCall.ts, models/TrustedTestNumber.ts
VoiceAvailable TTS voices catalogAgent voice pickervoice.service.tsmodels/Voice.ts
PhoneNumberA phone number owned/managed in the platformAccount → My Numberstelephony.routes.tsmodels/PhoneNumber.ts
PhoneNumberAssignmentNumber→agent/org assignmentNumber assignmenttelephony.service.tsmodels/PhoneNumberAssignment.ts
ProvisionedNumberNumbers provisioned from a carrierAdmin/Superadmin provisioningadmin-provisioning.routes.tsmodels/ProvisionedNumber.ts
SIPTrunkSIP trunk definitionsSuperadmin → SIP TrunkssipTrunk.service.tsmodels/SIPTrunk.ts
ProviderVoice/LLM/telephony provider recordsSuperadmin → Provider Registryprovider.service.tsmodels/Provider.ts
ProviderCapacityPer-provider capacity/limitsSuperadmin → Provider CapacityproviderCapacity.routes.tsmodels/ProviderCapacity.ts
ProviderModelRegistryCatalog of provider modelsSuperadmin → Provider RegistryproviderModelRegistry.routes.tsmodels/ProviderModelRegistry.ts
ProviderSubUserSub-accounts under a providerProvisioningprovisioning.service.tsmodels/ProviderSubUser.ts
ProvisioningAuditLog / ProvisioningIdempotencyKey / ProvisioningRateProvisioning audit, idempotency & rate recordsProvisioning opsadmin-provisioning.routes.tsmodels/ProvisioningAuditLog.ts, models/ProvisioningIdempotencyKey.ts, models/ProvisioningRate.ts
Conversations (legacy)Raw call/chat conversation transcriptsCall history / analysislegacy_models consumerslegacy_models/Conversations.ts

Analysis & Tools ​

Powers analysis schemas, benchmarks, dynamic tools and knowledge bases — surfaced under Call and Chatbot and Monitor → Analytics.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
AnalysisSchemaDefines the fields extracted from a call by AIAnalysis SchemasanalysisSchema.routes.tsmodels/AnalysisSchema.ts
Analysis (legacy)Stored per-call analysis resultsCall analysislegacy_models consumerslegacy_models/Analysis.ts
Benchmark / BenchmarkRunModel benchmark definitions and runsSuperadmin → Benchmarksbenchmark.routes.tsmodels/Benchmark.ts, models/BenchmarkRun.ts
DynamicTool / DynamicToolLogAgent-callable tools and their call logsConnecter → Client Toolsdynamic-tool.routes.tsmodels/DynamicTool.ts, models/DynamicToolLog.ts
SharedDynamicToolTools shared across orgsTool librarydynamicTool.service.tsmodels/SharedDynamicTool.ts
ApiAction / ApiActionLogTemplated outbound API actions + logsAutomation / API ActionsapiAction.service.tsmodels/ApiAction.ts, models/ApiActionLog.ts
McpIntegration / McpToolCallLogMCP server integrations and tool-call logsConnecter → MCPmcp-integration.routes.tsmodels/McpIntegration.ts, models/McpToolCallLog.ts
KnowledgeBase / KnowledgeBasePageAgent knowledge base + crawled pagesKnowledge Baseknowledge-base.routes.tsmodels/KnowledgeBase.ts, models/KnowledgeBasePage.ts
ContactObservabilityPer-contact observability/trace dataMonitor / debuggingcontactObservability.service.tsmodels/ContactObservability.ts

Billing & Credits ​

Backs Customer → Account (Credits/BYOK) and the billing screens on the Org / Superadmin dashboards.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
CreditTransactionLedger of credit debits/credits per orgAccount → Credits, Credit Mgmtcredit.routes.ts, credit.service.tsmodels/CreditTransaction.ts
Ledger (legacy)Legacy credit/billing ledgerBilling historylegacy_models/billing.controller.tslegacy_models/Ledger.ts
Purchase (legacy)Legacy purchase recordsBilling historylegacy_models/billing.routes.tslegacy_models/Purchase.ts
BillingDetailsOrg billing/invoice detailsBilling settingsbillingDetails.service.tsmodels/BillingDetails.ts
PaymentConfigPer-org payment gateway configAdmin → Payment Gatewaypayment.routes.tsmodels/PaymentConfig.ts
PaymentOrderA payment/checkout orderCredits purchasepayment.service.tsmodels/PaymentOrder.ts
ServicePricingPlatform service price listSuperadmin → PricingservicePricing.routes.tsmodels/ServicePricing.ts
CustomerAddonPricing / CustomerFeePricingPer-org add-on and fee overridesPer-Org Ratesadmin-provisioning.routes.tsmodels/CustomerAddonPricing.ts, models/CustomerFeePricing.ts
CustomerProviderCredentialOrg-scoped provider credentials (BYOK context)BYOKbyok.service.tsmodels/CustomerProviderCredential.ts
ByokKey / ByokAuditLogBring-Your-Own-Key secrets + auditAccount → BYOKbyok.routes.tsmodels/ByokKey.ts, models/ByokAuditLog.ts

Chatbot / WhatsApp / Marketing Channels ​

Backs Customer → Marketing, Automation and the chat/WhatsApp parts of Connecter.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
Chatbot / ChatbotConversation / ChatbotLeadAI chatbot config, chats, and captured leadsAI Chatbotchatbot.routes.tsmodels/Chatbot.ts, models/ChatbotConversation.ts, models/ChatbotLead.ts
WhatsAppConnection / WhatsAppOrgConfigWhatsApp Business account connection + org configConnecter → WhatsAppwhatsAppConnection.routes.tsmodels/WhatsAppConnection.ts, models/WhatsAppOrgConfig.ts
WhatsAppTemplate / WhatsAppBroadcastMessage templates and broadcast sendsWhatsApp marketingwhatsApp.service.tsmodels/WhatsAppTemplate.ts, models/WhatsAppBroadcast.ts
WhatsAppInboxMessageInbound/outbound WA inbox messagesWhatsApp inboxwhatsApp.service.tsmodels/WhatsAppInboxMessage.ts
WaCampaign / WaCampaignRecipientWhatsApp campaigns + recipientsWhatsApp campaignswaCampaign.service.tsmodels/WaCampaign.ts, models/WaCampaignRecipient.ts
WaAutomationDefinition / WaAutomationRunWhatsApp automation flows + runsWhatsApp AutomationwaAutomation.routes.tsmodels/WaAutomationDefinition.ts, models/WaAutomationRun.ts
WaFlowDefinition / WaFunnel / WaFunnelProgressFlow/funnel definitions and per-lead progressAutomation funnelswaAutomation.service.tsmodels/WaFlowDefinition.ts, models/WaFunnel.ts, models/WaFunnelProgress.ts
WaEngagementEvent / WaEngineState / WaOptOutWA engagement events, engine state, opt-outsAutomation / compliancewaAutomation.service.tsmodels/WaEngagementEvent.ts, models/WaEngineState.ts, models/WaOptOut.ts
MetaConnection / MetaPageSubscriptionMeta (Facebook) account connection + page subsConnecter → FacebookmetaConnection.routes.tsmodels/MetaConnection.ts, models/MetaPageSubscription.ts
MetaAdCampaign / MetaCustomAudience / MetaAudienceMember / MetaAudiencePushMeta ad campaigns and custom-audience syncMarketing → Meta AdsmetaAds.service.tsmodels/MetaAdCampaign.ts, models/MetaCustomAudience.ts, models/MetaAudienceMember.ts, models/MetaAudiencePush.ts
MetaCapiEventLogMeta Conversions API event logAttributionmetaCapi.service.tsmodels/MetaCapiEventLog.ts
GoogleAdsConnection / GoogleAdsOrgConfig / GoogleAdsAdCampaign / GoogleAdsAudience / GoogleAdsWebhookConfigGoogle Ads connection, config, campaigns & audiencesConnecter → Google AdsgoogleAdsConnection.routes.tsmodels/GoogleAds*.ts
Ga4ConnectionGoogle Analytics 4 connectionConnecter → Analyticsga4Connection.routes.tsmodels/Ga4Connection.ts
GmailConnection / GmailOrgConfigGmail connection + org configConnecter → Gmailgmail.routes.tsmodels/GmailConnection.ts, models/GmailOrgConfig.ts
GoogleSheetConfigGoogle Sheets sync configConnecter → SheetsgoogleSheetsConfig.routes.tsmodels/GoogleSheetConfig.ts
ApolloSavedSearchConfigApollo saved-search enrichment configConnecter → Apolloapollo.routes.tsmodels/ApolloSavedSearchConfig.ts
LandingLeadLeads captured from landing pagesMarketinglandingLead.service.tsmodels/LandingLead.ts

Tickets ​

Backs the Customer → Tickets section and the ticket views on the Org dashboard.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
TicketA support ticketTickets → Overviewticket.routes.ts, ticket.service.tsmodels/Ticket.ts
TicketMessageMessages/replies on a ticketTicket detailticket.service.tsmodels/TicketMessage.ts
TicketEventAudit/activity events on a ticketTicket timelineticket.service.tsmodels/TicketEvent.ts
TicketExternalLinkLinks to external systemsTicket integrationsticket.service.tsmodels/TicketExternalLink.ts
TicketMailboxEmail mailbox that feeds ticketsTickets → IntegrationsticketMailbox.service.tsmodels/TicketMailbox.ts
TicketProviderConfigPer-provider ticket integration configTickets → Integrationsticket.service.tsmodels/TicketProviderConfig.ts
TicketRoutingRuleRules that route tickets to agents/teamsTickets → Routingticket.service.tsmodels/TicketRoutingRule.ts
TicketSettingsPer-org ticket settingsTickets → Settingsticket.service.tsmodels/TicketSettings.ts
TicketSlaPolicySLA policies applied to ticketsTickets → SLAticket.service.tsmodels/TicketSlaPolicy.ts

Integrations / CRM Connect ​

Backs Customer → Connecter: external CRM sync, OAuth apps, email templates, workflows and webhooks.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
CrmConnectionA configured external CRM connectionConnectercrmConnection.service.tsmodels/CrmConnection.ts
CrmProviderApp / CrmProviderConnectionProvider app definitions and per-org connectionsConnectercrmProvider.service.tsmodels/CrmProviderApp.ts, models/CrmProviderConnection.ts
CrmOAuthClientOAuth client credentials for CRM connectSuperadmin → OAuth ClientscrmOAuth.service.tsmodels/CrmOAuthClient.ts
CrmSyncLog / CrmSheetSyncRun / CrmBackfillStateSync logs, sheet sync runs and backfill cursorsConnecter sync statuscrmSync.service.tsmodels/CrmSyncLog.ts, models/CrmSheetSyncRun.ts, models/CrmBackfillState.ts
CrmEmailTemplate / CrmEmailReadEmail templates and open/read trackingCRM emailcrmEmail.service.tsmodels/CrmEmailTemplate.ts, models/CrmEmailRead.ts
CrmAgenticSettingsConfig for agentic automation on leadsCRM → Agentic AutomationcrmAgenticSettings.routes.tsmodels/CrmAgenticSettings.ts
Workflow / WorkflowRunAutomation workflow definitions + executionsAutomation → Auto Workflowworkflow.routes.tsmodels/Workflow.ts, models/WorkflowRun.ts
WebhookEndpoint / WebhookDeliveryLogOutbound webhook endpoints and delivery logsConnecter → Webhookswebhook.routes.tsmodels/WebhookEndpoint.ts, models/WebhookDeliveryLog.ts

Ops / Misc ​

Cross-cutting operational collections not tied to one dashboard section.

CollectionWhy it existsUI / featureTouched by (main files)Schema file
Attendance / AttendanceConfig / AttendancePingAgent attendance tracking + heartbeatsMonitor / agent perfattendance.service.tsmodels/Attendance.ts, models/AttendanceConfig.ts, models/AttendancePing.ts
DndContactDo-Not-Disturb suppression listMonitor → DNDdndContact.routes.tsmodels/DndContact.ts
BugReportIn-app bug reportsSuperadmin → Bug Reportsbug-report.routes.tsmodels/BugReport.ts
EmailLogSent-email audit logNotifications / opsemailLog.service.tsmodels/EmailLog.ts

How to Test ​

Collections are verified indirectly through the features that write them. To confirm a collection is live:

  1. Perform the UI action in the linked dashboard section (e.g. create a lead in CRM → Leads).
  2. In MongoDB, query the collection named in the Schema file model registration (e.g. db.CrmLead.find().sort({createdAt:-1}).limit(1)).
  3. Confirm the new document carries the tenant scope fields (customerUID, and organizationId where applicable).

Troubleshooting ​

SymptomCauseFix
Data saved but not visible to another user in the same orgQuery not scoped to customerUID/organizationId, or user lacks role/permissionCheck the resolver/permission middleware (see Auth System / Team RBAC)
Collection name in Mongo differs from the model nameA few models pass an explicit collection name (e.g. CrmReminder uses collection: "CrmReminder")Open the model file and read the mongoose.model(name, schema, collection) call
Legacy collection not updatingLegacy models (Analysis, Conversations, Ledger, Purchase) live in legacy_models/ and are written by legacy controllersTrace the legacy controller, not a services/ file
New field not persistedField missing from the Mongoose schema (strict mode drops unknown keys)Add the field to the model in models/*.ts

Last updated: