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.
| Field | Description |
|---|---|
name | Display name (e.g. "Acme Inc.") |
legalName | Full legal entity name (e.g. "Acme Corporation") |
address | Registered business address |
contact | Legal 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 field | Section title | Always present |
|---|---|---|
| (always) | Terms of Service | Yes |
acceptance | Acceptance of Terms | Yes |
eligibility | Eligibility | No |
accounts | Accounts | No |
prohibitedUses | Prohibited Uses | No |
userContent | User Content | No |
intellectualProperty | Intellectual Property | No |
payments (when hasPaidFeatures: true) | Payments and Billing | No |
availability | Service Availability | No |
termination | Termination | No |
disclaimers | Disclaimer of Warranties | No |
limitationOfLiability | Limitation of Liability | No |
indemnification | Indemnification | No |
thirdPartyServices | Third-Party Services | No |
disputeResolution | Dispute Resolution | No |
governingLaw | Governing Law | Yes |
changesPolicy | Changes to These Terms | No |
| (always) | Contact Us | Yes |
Validation
validateTermsOfService(config) from @openpolicy/core checks:
Errors (non-zero exit, blocks generation):
effectiveDateis requiredcompany.name,company.legalName,company.address,company.contactare requiredgoverningLaw.jurisdictionis required
Warnings (printed, do not block generation):
disclaimersmissing — consider adding a disclaimer of warrantieslimitationOfLiabilitymissing — consider adding a limitation of liability clauseacceptance.methodsempty — consider listing how users accept the terms