OpenPolicy
Reference

terms.config.ts

Reference for the TermsOfServiceConfig type

A terms of service config file exports a defineTermsOfService() call as its default export. The function is a typed identity — it returns the config unchanged, but TypeScript uses it to validate the shape and provide autocomplete.

// terms.config.ts
import { defineTermsOfService } from "@openpolicy/sdk";

export default defineTermsOfService({ ... });

TermsOfServiceConfig

type TermsOfServiceConfig = {
  // Required
  effectiveDate: string;
  company: { name: string; legalName: string; address: string; contact: string };
  acceptance: { methods: string[] };
  governingLaw: { jurisdiction: string };

  // Optional sections
  eligibility?: { minimumAge: number; jurisdictionRestrictions?: string[] };
  accounts?: {
    registrationRequired: boolean;
    userResponsibleForCredentials: boolean;
    companyCanTerminate: boolean;
  };
  prohibitedUses?: string[];
  userContent?: {
    usersOwnContent: boolean;
    licenseGrantedToCompany: boolean;
    licenseDescription?: string;
    companyCanRemoveContent: boolean;
  };
  intellectualProperty?: { companyOwnsService: boolean; usersMayNotCopy: boolean };
  payments?: {
    hasPaidFeatures: boolean;
    refundPolicy?: string;
    priceChangesNotice?: string;
  };
  availability?: { noUptimeGuarantee: boolean; maintenanceWindows?: string };
  termination?: {
    companyCanTerminate: boolean;
    userCanTerminate: boolean;
    effectOfTermination?: string;
  };
  disclaimers?: { serviceProvidedAsIs: boolean; noWarranties: boolean };
  limitationOfLiability?: { excludesIndirectDamages: boolean; liabilityCap?: string };
  indemnification?: { userIndemnifiesCompany: boolean; scope?: string };
  thirdPartyServices?: { name: string; purpose: string }[];
  disputeResolution?: {
    method: "arbitration" | "litigation" | "mediation";
    venue?: string;
    classActionWaiver?: boolean;
  };
  changesPolicy?: { noticeMethod: string; noticePeriodDays?: number };
  privacyPolicyUrl?: string;
};

Required fields

effectiveDate

Type: string

ISO 8601 date string for when this version of the terms takes effect.

effectiveDate: "2026-01-01"

company

Type: object

Your organization's details as they appear in the generated document.

FieldDescription
nameDisplay name (e.g. "Acme Inc.")
legalNameFull legal entity name (e.g. "Acme Corporation")
addressRegistered business address
contactLegal contact email address

acceptance

Type: { methods: string[] }

Lists the actions by which a user accepts the terms. Rendered as a bullet list in the Acceptance section.

acceptance: {
  methods: ["using the service", "creating an account", "clicking 'I Agree'"],
}

governingLaw

Type: { jurisdiction: string }

The jurisdiction whose laws govern the agreement.

governingLaw: { jurisdiction: "Delaware, USA" }

Optional sections

Optional fields produce a section in the output when present and omit the section entirely when absent.

eligibility

Minimum age requirement and any jurisdiction restrictions.

eligibility: {
  minimumAge: 13,
  jurisdictionRestrictions: ["Cuba", "Iran", "North Korea"],
}

accounts

Covers account registration, credential responsibility, and company termination rights.

accounts: {
  registrationRequired: false,
  userResponsibleForCredentials: true,
  companyCanTerminate: true,
}

prohibitedUses

A list of forbidden activities. Each string becomes a bullet point.

prohibitedUses: [
  "Violating any applicable laws or regulations",
  "Infringing on intellectual property rights",
]

userContent

License and moderation terms for user-submitted content.

userContent: {
  usersOwnContent: true,
  licenseGrantedToCompany: true,
  licenseDescription: "a worldwide, royalty-free license to host and display your content",
  companyCanRemoveContent: true,
}

intellectualProperty

Ownership of the service and restrictions on copying.

intellectualProperty: {
  companyOwnsService: true,
  usersMayNotCopy: true,
}

payments

Included only when hasPaidFeatures: true. Omitted entirely when hasPaidFeatures: false.

payments: {
  hasPaidFeatures: true,
  refundPolicy: "30-day money-back guarantee",
  priceChangesNotice: "30 days notice via email",
}

availability

Uptime disclaimers and maintenance window information.

availability: {
  noUptimeGuarantee: true,
  maintenanceWindows: "Scheduled maintenance occurs Sundays 2–4 AM UTC",
}

termination

Who can end the relationship and what happens when they do.

termination: {
  companyCanTerminate: true,
  userCanTerminate: true,
  effectOfTermination: "Upon termination, your right to use the services ceases immediately.",
}

disclaimers

Disclaimer of warranties. Strongly recommended for all agreements.

disclaimers: {
  serviceProvidedAsIs: true,
  noWarranties: true,
}

limitationOfLiability

Caps and exclusions on company liability. Strongly recommended for all agreements.

limitationOfLiability: {
  excludesIndirectDamages: true,
  liabilityCap: "Our total liability shall not exceed the amount you paid us in the past 12 months.",
}

indemnification

User obligation to indemnify the company.

indemnification: {
  userIndemnifiesCompany: true,
  scope: "claims arising from your violation of these Terms or your use of the services",
}

thirdPartyServices

Third-party integrations referenced in the terms. Each entry produces a bullet in the Third-Party Services section.

thirdPartyServices: [
  { name: "Stripe", purpose: "Payment processing" },
  { name: "SendGrid", purpose: "Transactional email" },
]

disputeResolution

How disputes are handled. method is required when this field is present.

disputeResolution: {
  method: "arbitration",   // "arbitration" | "litigation" | "mediation"
  venue: "San Francisco, California",
  classActionWaiver: true,
}

changesPolicy

How users are notified of updates to the terms.

changesPolicy: {
  noticeMethod: "email or prominent notice on our website",
  noticePeriodDays: 30,
}

privacyPolicyUrl

If provided, the introduction section links to your privacy policy.

privacyPolicyUrl: "/privacy"

Generated sections

Config fieldSection titleAlways present
(always)Terms of ServiceYes
acceptanceAcceptance of TermsYes
eligibilityEligibilityNo
accountsAccountsNo
prohibitedUsesProhibited UsesNo
userContentUser ContentNo
intellectualPropertyIntellectual PropertyNo
payments (when hasPaidFeatures: true)Payments and BillingNo
availabilityService AvailabilityNo
terminationTerminationNo
disclaimersDisclaimer of WarrantiesNo
limitationOfLiabilityLimitation of LiabilityNo
indemnificationIndemnificationNo
thirdPartyServicesThird-Party ServicesNo
disputeResolutionDispute ResolutionNo
governingLawGoverning LawYes
changesPolicyChanges to These TermsNo
(always)Contact UsYes

Validation

validateTermsOfService(config) from @openpolicy/core checks:

Errors (non-zero exit, blocks generation):

  • effectiveDate is required
  • company.name, company.legalName, company.address, company.contact are required
  • governingLaw.jurisdiction is required

Warnings (printed, do not block generation):

  • disclaimers missing — consider adding a disclaimer of warranties
  • limitationOfLiability missing — consider adding a limitation of liability clause
  • acceptance.methods empty — consider listing how users accept the terms

On this page