Skip to main content

ComplyAI Data Dictionary

Complete reference for all data entities, fields, and definitions


Table of Contents

  1. Customer Domain
  2. Ad Account Domain
  3. Ad Content Domain
  4. Compliance Domain
  5. Operational Domain
  6. Junction Tables

1. Customer Domain

1.1 Users

Table Name: users
Service: complyai-core
Description: Individual users who access the ComplyAI platform

FieldTypeNullableDescriptionExamplePII
idINTEGERNoPrimary key, auto-increment42No
sub_idVARCHAR(100)YesAuth0/OAuth subject ID`auth0123abc`
emailVARCHAR(255)NoUser's email address (unique)jane@company.com✅ Yes
nameVARCHAR(200)YesUser's display nameJane Smith✅ Yes
avatarVARCHAR(200)YesURL to profile picturehttps://cdn.../avatar.jpgNo
email_verifiedBOOLEANNoEmail verification statustrueNo
paidBOOLEANNoLegacy payment statusfalseNo
linked_accountsBOOLEANNoHas linked Facebook accountstrueNo
reviewedBOOLEANYesAccount has been reviewed by admintrueNo
subscribedBOOLEANNoHas active subscriptiontrueNo
stripe_customer_idVARCHAR(50)YesStripe customer identifiercus_ABC123No
user_access_tokenVARCHAR(300)YesFacebook user access token (legacy)EAAG...🔐 Sensitive
_encrypted_user_access_tokenBINARYYesEncrypted Facebook token[binary]🔐 Sensitive
terms_acceptedBOOLEANNoUser accepted terms of servicetrueNo
fs_uniquifierVARCHAR(64)NoFlask-Security unique IDabc123...No
activeBOOLEANNoAccount active statustrueNo
confirmed_atTIMESTAMPYesEmail confirmation time2024-01-15 10:30:00No

Relationships:

  • Has many ActivityEvents
  • Has many FacebookPages
  • Belongs to many Organizations (via user_organizations)
  • Has many Roles (via Flask-Security)

1.2 Organizations

Table Name: organizations
Service: complyai-core
Description: Client companies using ComplyAI platform

FieldTypeNullableDescriptionExamplePII
idINTEGERNoPrimary key15No
nameVARCHAR(100)NoOrganization nameAcme AdvertisingNo
contact_personVARCHAR(100)YesPrimary contact nameJohn Director✅ Yes
subscription_planVARCHAR(25)YesCurrent plan tierprofessionalNo
subscription_start_dateTIMESTAMPYesPlan start date2024-01-01 00:00:00No
subscription_end_dateTIMESTAMPYesPlan end date2024-12-31 23:59:59No
calendly_meeting_start_datetimeTIMESTAMPYesOnboarding call start2024-01-05 14:00:00No
calendly_meeting_end_datetimeTIMESTAMPYesOnboarding call end2024-01-05 15:00:00No
vipBOOLEANNoVIP customer flagfalseNo
stripe_planVARCHAR(50)YesStripe price IDprice_ABC123No
trial_daysINTEGERYesTrial period length14No
stripe_subscription_idVARCHAR(50)YesStripe subscription IDsub_ABC123No
activeBOOLEANYesOrganization is activetrueNo
average_scoreFLOATYesAverage ad compliance score85.5No
average_text_scoreFLOATYesAverage text analysis score88.2No
average_media_scoreFLOATYesAverage media analysis score82.8No
created_timeTIMESTAMPNoRecord creation time2024-01-01 10:00:00No
updated_timeTIMESTAMPNoLast update time2024-06-15 14:30:00No

Relationships:

  • Has many Users (via user_organizations)
  • Has many OrgBusinessAccounts
  • Has many Notifications

Computed Properties:

  • user_names: List of all user names in organization
  • user_emails: List of all user emails in organization

1.3 Roles

Table Name: roles
Service: complyai-core
Description: User permission roles (Flask-Security)

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key1
nameVARCHAR(80)NoRole nameadmin
descriptionVARCHAR(255)YesRole descriptionSystem administrator
permissionsTEXTYesJSON permission set["read","write"]

Standard Roles:

IDNameDescription
1adminFull system access
2clientStandard customer user
3developerDevelopment team access
4viewerRead-only access

2. Ad Account Domain

2.1 OrgBusinessAccounts

Table Name: org_business_accounts
Service: complyai-core
Description: Meta Business Manager accounts linked to organizations

FieldTypeNullableDescriptionExamplePII
idINTEGERNoPrimary key100No
facebook_idVARCHAR(100)NoMeta Business Manager ID123456789012345No
nameVARCHAR(200)NoBusiness Manager nameAcme BMNo
roleVARCHAR(25)YesUser's role in BMADMINNo
user_nameVARCHAR(50)YesAssociated user nameJane Smith✅ Yes
user_idINTEGERYesFK to users table42No
organization_idINTEGERNoFK to organizations15No
client_bm_su_access_tokenVARCHAR(300)YesSystem user token (legacy)EAAG...🔐 Sensitive
_encrypted_client_bm_su_access_tokenBINARYYesEncrypted system user token[binary]🔐 Sensitive
system_user_idVARCHAR(50)YesMeta system user ID12345678901234567No
average_scoreFLOATYesAverage compliance score86.7No
average_text_scoreFLOATYesAverage text score89.1No
average_media_scoreFLOATYesAverage media score84.3No
created_timeTIMESTAMPNoRecord creation2024-02-01 09:00:00No
updated_timeTIMESTAMPNoLast update2024-06-20 11:30:00No

Relationships:

  • Belongs to Organization
  • Has many OrgAdAccounts

2.2 OrgAdAccounts

Table Name: org_ad_accounts
Service: complyai-core
Description: Facebook Ad Accounts linked to business managers

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key500
nameVARCHAR(200)NoAd account nameAcme - US Market
facebook_idVARCHAR(100)NoAd account ID with prefixact_123456789
org_business_account_idINTEGERYesFK to business account100
average_scoreFLOATYesAverage compliance score87.2
average_text_scoreFLOATYesAverage text score90.0
average_media_scoreFLOATYesAverage media score84.4
currencyVARCHAR(50)YesAccount currencyUSD
account_statusINTEGERYesMeta account status code1
account_status_updated_timeTIMESTAMPYesStatus last checked2024-06-25 08:00:00
funding_source_typeINTEGERYesPayment method type1
funding_source_display_stringVARCHAR(100)YesPayment display textVisa ****1234
cai_statusVARCHAR(50)YesComplyAI tracking statusactive
cai_status_updated_timeTIMESTAMPYesCAI status update time2024-06-25 08:00:00
created_timeTIMESTAMPNoRecord creation2024-02-15 10:00:00
updated_timeTIMESTAMPNoLast update2024-06-25 08:00:00

Account Status Codes:

CodeMeaning
1Active
2Disabled
3Unsettled
7Pending Review
8Pending Closure
9In Grace Period
100Pending Risk Review
101Pending Settlement
201Any Active
202Any Closed

Relationships:

  • Belongs to OrgBusinessAccounts
  • Has many OrgAds

2.3 AdAccounts (API Service)

Table Name: ad_accounts
Service: complyai-api
Description: Detailed ad account data synced from Meta

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key1000
account_idVARCHAR(50)NoMeta account ID (no prefix)123456789
account_nameVARCHAR(200)YesAccount display nameAcme Campaigns
ownerVARCHAR(200)YesAccount owner infoAcme Inc
account_statusINTEGERYesStatus code (see above)1
disable_reasonVARCHAR(200)YesReason if disabledPolicy violation
amount_spentBIGINTYesTotal spend (in cents)1500000
balanceBIGINTYesCurrent balance50000
currencyVARCHAR(25)YesCurrency codeUSD
business_cityVARCHAR(25)YesBusiness citySan Francisco
business_country_codeVARCHAR(50)YesCountry codeUS
business_nameVARCHAR(200)YesRegistered business nameAcme Inc
business_streetVARCHAR(200)YesStreet address123 Market St
business_street2VARCHAR(200)YesAddress line 2Suite 100
business_zipVARCHAR(40)YesPostal code94102
fb_created_timeTIMESTAMPYesWhen created on Meta2023-01-15 00:00:00
timezone_nameVARCHAR(200)YesAccount timezoneAmerica/Los_Angeles
account_ageINTEGERYesAccount age in days540
funding_sourceVARCHAR(200)YesPayment source ID12345
funding_source_detailsJSONYesPayment details{"type":"credit_card"}
is_prepay_accountBOOLEANYesPrepaid account flagfalse
spend_capBIGINTYesSpending limit10000000
capabilitiesTEXT[]YesAccount capabilities["CUSTOM_AUDIENCES"]
min_campaign_group_spend_capINTEGERYesMin campaign budget100
min_daily_budgetINTEGERYesMin daily budget100
offsite_pixels_tos_acceptedBOOLEANYesPixel TOS acceptedtrue
has_migrated_permissionBOOLEANYesPermission migration statustrue
is_personalINTEGERYesPersonal account flag0
bmVARCHAR(50)YesBusiness Manager ID987654321
cai_statusVARCHAR(50)YesComplyAI statusmonitoring
cai_status_updated_timeTIMESTAMPYesStatus update time2024-06-25 08:00:00
tokenVARCHAR(25)YesToken identifierprimary
created_timeTIMESTAMPNoRecord creation2024-01-20 12:00:00
updated_timeTIMESTAMPNoLast update2024-06-25 08:00:00

2.4 AdAccountWebhookSubscriptions

Table Name: ad_account_webhook_subscriptions
Service: complyai-api
Description: Tracks webhook subscriptions per ad account

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key200
account_idVARCHAR(50)NoAd account ID123456789
webhook_subscriptionBOOLEANNoHas webhook subtrue
ad_rule_new_adBOOLEANNoNew ad rule activetrue
ad_rule_changes_on_ad_effective_statusBOOLEANNoStatus change ruletrue
created_timeTIMESTAMPNoRecord creation2024-03-01 09:00:00
updated_timeTIMESTAMPNoLast update2024-03-01 09:00:00

3. Ad Content Domain

3.1 OrgAds

Table Name: org_ads
Service: complyai-core
Description: Individual ads within ad accounts

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key5000
nameVARCHAR(200)NoAd nameSummer Sale Banner
facebook_idVARCHAR(100)NoMeta ad ID23849203842934
statusVARCHAR(50)YesAd statusACTIVE
effective_statusVARCHAR(50)YesEffective delivery statusACTIVE
account_idVARCHAR(50)YesParent account ID123456789
ad_account_idVARCHAR(50)YesAccount ID with prefixact_123456789
account_nameVARCHAR(100)YesAccount nameAcme Campaigns
account_currencyVARCHAR(50)YesCurrencyUSD
campaign_idVARCHAR(50)YesParent campaign ID23849000000
campaign_effective_statusVARCHAR(50)YesCampaign statusACTIVE
authorization_categoryVARCHAR(50)YesAd categoryNONE
effective_authorization_categoryVARCHAR(50)YesEffective categoryNONE
page_idVARCHAR(50)YesFacebook page ID987654321
page_nameVARCHAR(100)YesPage nameAcme Store
titleTEXTYesAd title/headline50% Off Summer Sale
textTEXTYesPrimary text copyShop our biggest...
descriptionTEXTYesAd descriptionLimited time offer
image_urlTEXTYesImage URLhttps://cdn.../img.jpg
image_hashVARCHAR(500)YesImage hashabc123def456
video_urlTEXTYesVideo URLhttps://cdn.../vid.mp4
video_idVARCHAR(100)YesVideo asset ID23849000001
call_to_action_typeVARCHAR(100)YesCTA button typeSHOP_NOW
destination_urlTEXTYesLanding page URLhttps://acme.com/sale
facebook_reason_for_disapprovedTEXTYesRejection reasonPolicy violation: ...
spendFLOATYesTotal spend1500.50
cpmFLOATYesCost per 1000 impressions12.50
cpcFLOATYesCost per click0.85
org_ad_account_idINTEGERYesFK to OrgAdAccounts500
created_timeTIMESTAMPNoRecord creation2024-04-01 10:00:00
updated_timeTIMESTAMPNoLast update2024-06-25 08:00:00

Status Values:

StatusDescription
ACTIVEAd is running
PAUSEDAd paused by user
DELETEDAd deleted
ARCHIVEDAd archived
PENDING_REVIEWAwaiting Meta review
DISAPPROVEDRejected by Meta
PREAPPROVEDPre-approved (limited)
PENDING_BILLING_INFOAwaiting payment
CAMPAIGN_PAUSEDParent campaign paused
ADSET_PAUSEDParent ad set paused
IN_PROCESSBeing processed
WITH_ISSUESHas delivery issues

3.2 OrgAdsScore

Table Name: org_ads_score
Service: complyai-core
Description: AI-generated compliance scores for ads

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key10000
scoreFLOATYesOverall compliance score (0-100)85.5
text_scoreFLOATYesText analysis score (0-100)88.2
media_scoreFLOATYesMedia analysis score (0-100)82.8
db_ad_idINTEGERYesFK to OrgAds5000

Score Interpretation:

RangeRisk LevelAction
90-100LowLikely to pass
70-89MediumReview recommended
50-69HighChanges suggested
0-49CriticalMajor issues

3.3 FacebookPages

Table Name: facebook_pages
Service: complyai-core
Description: Facebook Pages for ad pre-check feature

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key50
user_idINTEGERNoFK to users42
page_nameVARCHAR(255)NoPage nameAcme Official
profile_photo_urlVARCHAR(512)NoProfile pic URLhttps://...
cover_photo_urlVARCHAR(512)NoCover photo URLhttps://...
websiteVARCHAR(255)YesPage websitehttps://acme.com
statusVARCHAR(50)NoVerification statusverified
task_idVARCHAR(255)YesAsync task IDcelery-task-123
messageTEXTYesStatus messageProcessing...
page_idVARCHAR(255)YesFacebook page ID111222333
created_timeTIMESTAMPNoRecord creation2024-05-01 12:00:00
updated_timeTIMESTAMPNoLast update2024-05-01 12:30:00

4. Compliance Domain

4.1 FacebookAdStatus

Table Name: facebook_ad_status
Service: complyai-core
Description: ComplyAI internal status tracking for ads

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key20000
ad_idVARCHAR(50)NoFacebook ad ID23849203842934
statusVARCHAR(50)YesComplyAI statusOpen
false_positiveBOOLEANNoMarked as false positivefalse
created_timeTIMESTAMPNoRecord creation2024-06-01 10:00:00
updated_timeTIMESTAMPNoLast update2024-06-25 14:00:00

ComplyAI Status Values:

StatusDescription
OpenNew disapproved ad, needs attention
Edit RequiredChanges needed before resubmission
AppealedAppeal submitted to Meta
Appeal WonAppeal successful, ad approved
Appeal LostAppeal rejected
Rejected ArchiveArchived rejected ad
IgnoredMarked to ignore

4.2 FacebookTotalAdDataFeedback

Table Name: facebook_total_ad_data_feedback
Service: complyai-core
Description: Admin and client feedback on ad reviews

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key300
ad_idVARCHAR(50)NoFacebook ad ID23849203842934
admin_idINTEGERYesFK to admin user5
admin_responseTEXTYesAdmin feedback textRecommend changing...
admin_response_timeTIMESTAMPYesWhen admin responded2024-06-20 09:00:00
client_idINTEGERYesFK to client user42
client_responseTEXTYesClient responseThanks, will update
client_response_timeTIMESTAMPYesWhen client responded2024-06-20 10:30:00
admin_readBOOLEANNoAdmin read client responsetrue
client_readBOOLEANNoClient read admin feedbacktrue
created_timeTIMESTAMPNoRecord creation2024-06-20 08:00:00
updated_timeTIMESTAMPNoLast update2024-06-20 10:30:00

4.3 AdAccountCase

Table Name: ad_account_case
Service: complyai-core
Description: Meta support case tracking

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key75
ad_account_idVARCHAR(50)NoAd account ID123456789
case_idVARCHAR(50)NoMeta case numberCS-123456
case_contactVARCHAR(50)NoMeta rep contactmeta-support@fb.com

5. Operational Domain

5.1 ActivityEvents

Table Name: activity_events
Service: complyai-core
Description: Audit log of user and system actions

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key100000
user_idINTEGERYesFK to users42
ip_addressVARCHAR(64)YesClient IP address192.168.1.1
actionVARCHAR(100)YesAction type/codeAD_STATUS_CHANGED
descriptionTEXTYesDetailed descriptionAd 123 changed from...
created_timeTIMESTAMPNoEvent timestamp2024-06-25 14:30:00

Common Action Types:

CodeDescription
1User Login
2User Logout
10Ad Submitted
11Ad Approved
12Ad Rejected
20Appeal Submitted
21Appeal Won
22Appeal Lost
26Ad Status Changed
27Case ID Added
28Case ID Updated
29Case Contact Added
30Case Contact Updated

5.2 Notifications

Table Name: notifications
Service: complyai-core
Description: System notifications for organizations

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key500
titleVARCHAR(300)YesNotification titleAppeal Won!
notification_typeVARCHAR(100)YesType categoryappeal_result
contentTEXTYesFull message contentYour ad 123 got...
readBOOLEANNoRead statusfalse
organization_idINTEGERYesFK to organizations15
created_timeTIMESTAMPNoCreation time2024-06-25 10:00:00
updated_timeTIMESTAMPNoLast update2024-06-25 10:00:00

5.3 Issues

Table Name: issues
Service: complyai-core
Description: Support tickets and feedback

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key25
user_idINTEGERYesFK to users42
nameVARCHAR(120)YesReporter nameJane Smith
emailTEXTYesContact emailjane@company.com
company_idINTEGERYesFK to organizations15
issueTEXTYesIssue descriptionCannot connect...
issue_typeVARCHAR(100)YesCategorybug_report
created_timeTIMESTAMPNoSubmitted time2024-06-20 11:00:00
updated_timeTIMESTAMPNoLast update2024-06-20 11:00:00

5.4 InviteCodes

Table Name: invite_codes
Service: complyai-core
Description: User invitation codes for onboarding

FieldTypeNullableDescriptionExample
idINTEGERNoPrimary key100
invite_codeVARCHAR(20)NoUnique invite codeABC123XYZ
company_idINTEGERNoTarget organization ID15
emailVARCHAR(255)NoInvited emailnewuser@company.com
roleVARCHAR(50)NoAssigned roleclient
usedBOOLEANNoCode used statusfalse
created_timeTIMESTAMPNoCode creation2024-06-01 09:00:00
updated_timeTIMESTAMPNoLast update2024-06-01 09:00:00

6. Junction Tables

6.1 user_organizations

Table Name: user_organizations
Description: Many-to-many relationship between users and organizations

FieldTypeDescription
user_idINTEGERFK to users
org_idINTEGERFK to organizations

6.2 roles_users

Table Name: roles_users
Description: Flask-Security role assignments

FieldTypeDescription
user_idINTEGERFK to users
role_idINTEGERFK to roles

6.3 PagePartners

Table Name: page_partners
Description: Associates users as partners on Facebook Pages

FieldTypeDescriptionExample
page_idINTEGERFK to facebook_pages50
user_idINTEGERFK to users42
statusVARCHAR(50)Partnership statusapproved
created_atTIMESTAMPCreation time2024-05-15 10:00:00

📝 Changelog

DateVersionChanges
2024-121.0.0Initial data dictionary created

👥 Ownership

DomainData StewardTechnical Owner
CustomerProduct TeamCore API Team
Ad AccountProduct TeamAPI Team
Ad ContentProduct TeamAPI Team
ComplianceCompliance TeamCore API Team
OperationalEngineeringPlatform Team