Apex Reference Guide
Summer '26 (API version 67.0)
Spring '26 (API version 66.0)
Winter '26 (API version 65.0)
Summer '25 (API version 64.0)
Spring '25 (API version 63.0)
Winter '25 (API version 62.0)
Summer '24 (API version 61.0)
Spring '24 (API version 60.0)
Winter '24 (API version 59.0)
Summer '23 (API version 58.0)
Spring '23 (API version 57.0)
Winter '23 (API version 56.0)
Summer '22 (API version 55.0)
Spring '22 (API version 54.0)
Winter '22 (API version 53.0)
Summer '21 (API version 52.0)
Release Notes
ExternalService Namespace
Newer Version Available
Apex Reference Guide
Apex is a strongly typed, object-oriented programming language that allows developers
to execute flow and transaction control statements on the Salesforce Platform server, in
conjunction with calls to the API. This reference guide includes built-in Apex classes,
interfaces, enums, and exceptions, grouped by namespace. It also includes Apex DML
statements to insert, update, merge, delete, and restore data in Salesforce.
For information on the Apex development process, see Apex Developer Guide.
In API version 51.0 and earlier, Apex Reference information was included in the Apex Developer Guide in the Apex Language Reference section.
Note
-
Apex Release Notes
Use the Salesforce Release Notes to learn about the most recent updates and changes to Apex. -
Apex DML Operations
You can perform DML operations using the Apex DML statements or the methods of the Database class. For lead conversion, use the convertLead method of the Database class. There is no DML counterpart for it. -
ApexPages Namespace
The ApexPages namespace provides classes used in Visualforce controllers. -
AppLauncher Namespace
The AppLauncher namespace provides methods for managing the appearance of apps in the App Launcher, including their visibility and sort order. -
Approval Namespace
The Approval namespace provides classes and methods for approval processes. -
Auth Namespace
The Auth namespace provides an interface and classes for single sign-on into Salesforce and session security management. -
Cache Namespace
The Cache namespace contains methods for managing the platform cache. -
Canvas Namespace
The Canvas namespace provides an interface and classes for canvas apps in Salesforce. -
ChatterAnswers Namespace
The ChatterAnswers namespace provides an interface for creating Account records. -
CommercePayments Namespace
Use the CommercePayments namespace to provide a safe and customizable platform for managing customer payments and refunds. -
ConnectApi Namespace
The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce. -
Database Namespace
The Database namespace provides classes used with DML operations. -
Datacloud Namespace
The Datacloud namespace provides classes and methods for retrieving information about duplicate rules. Duplicate rules let you control whether and when users can save duplicate records within Salesforce. -
DataSource Namespace
The DataSource namespace provides the classes for the Apex Connector Framework. Use the Apex Connector Framework to develop a custom adapter for Salesforce Connect. Then connect your Salesforce organization to any data anywhere via the Salesforce Connect custom adapter. -
DataWeave Namespace
The DataWeave namespace provides classes and methods to support the invocation of DataWeave scripts from Apex. -
Dom Namespace
The Dom namespace provides classes and methods for parsing and creating XML content. -
EventBus Namespace
The EventBus namespace provides classes and methods for platform events and Change Data Capture events. -
ExternalService Namespace
The ExternalService namespace provides dynamically generated Apex service interfaces and Apex classes for complex object data types. -
Flow Namespace
The Flow namespace provides a class for advanced Visualforce controller access to flows. -
Functions Namespace
The Functions namespace provides classes and methods used to invoke and manage Salesforce Functions. -
Invocable Namespace
The Invocable namespace provides classes for calling invocable actions from Apex. -
KbManagement Namespace
The KbManagement namespace provides a class for managing knowledge articles. -
LxScheduler Namespace
The LxScheduler namespace provides an interface and classes for integrating Salesforce Scheduler with external calendars. -
Messaging Namespace
The Messaging namespace provides classes and methods for Salesforce outbound and inbound email functionality. -
Metadata Namespace
The Metadata namespace provides classes and methods for working with custom metadata in Salesforce -
Pref_center Namespace
The Pref_center namespace provides an interface, classes, and methods to create and retrieve data in forms in Preference Manager. Preference Manager, previously called Preference Center, is a feature within the Privacy Center app. -
Process Namespace
The Process namespace provides an interface and classes for passing data between your organization and a flow. -
QuickAction Namespace
The QuickAction namespace provides classes and methods for quick actions. -
Reports Namespace
The Reports namespace provides classes for accessing the same data as is available in the Salesforce Reports and Dashboards REST API. -
RichMessaging Namespace
Provides objects and methods for handling content in enhanced Messaging channels. -
Schema Namespace
The Schema namespace provides classes and methods for schema metadata information. -
Search Namespace
The Search namespace provides classes for getting search results and suggestion results. -
Sfc Namespace
The Sfc namespace contains classes used in Salesforce Files. -
Sfdc_Checkout Namespace
The Sfdc_Checkout namespace provides an interface and classes for B2B Commerce apps in Salesforce. -
sfdc_surveys Namespace
The sfdc_surveys namespace provides an interface for shortening survey invitations. -
Site Namespace
The Site namespace provides an interface for rewriting Sites URLs. -
Support Namespace
The Support namespace provides an interface used for Case Feed. -
System Namespace
The System namespace provides classes and methods for core Apex functionality. -
TerritoryMgmt Namespace
The TerritoryMgmt namespace provides an interface used for territory management. -
TxnSecurity Namespace
The TxnSecurity namespace provides an interface used for transaction security. -
UserProvisioning Namespace
The UserProvisioning namespace provides methods for monitoring outbound user provisioning requests. -
VisualEditor Namespace
The VisualEditor namespace provides classes and methods for interacting with the Lightning App Builder. The classes and methods in this namespace operate on Lightning components, which include Lightning web components and Aura components. -
Wave Namespace
The classes in the Wave namespace are part of the CRM Analytics Analytics SDK, designed to facilitate querying CRM Analytics data from Apex code. -
Appendices