Built-in APIs
Learning Content
Last updated: July 21, 2026
Built-in APIs in Apex
Salesforce Apex provides a rich collection of built-in APIs that allow developers to interact with Salesforce data, platform services, and external applications. These APIs eliminate the need to build common functionality from scratch, making application development faster, more secure, and easier to maintain.
Whether you need to call an external REST service, send an email, work with XML or JSON data, access metadata, or perform HTTP callouts, Apex includes built-in classes and libraries to simplify these tasks.
💡 LearnFrenzy Insight
Think of Apex APIs as a toolbox.
Instead of creating every tool yourself, Salesforce already provides ready-to-use tools for common development tasks.
Need to send an email?
Use the Email API.
Need to call another application?
Use the HTTP API.
Need to process JSON data?
Use the JSON API.
The right tool is already available.
Why Do We Need Built-in APIs?
Modern business applications rarely work in isolation. They often exchange information with payment gateways, ERP systems, banking applications, inventory systems, shipping providers, and many other external services.
Built-in APIs allow Apex developers to integrate these systems efficiently while reducing development effort and improving application reliability.
| Business Requirement | API Used |
|---|---|
| Call External REST Service | HTTP Classes |
| Send Email | Messaging Classes |
| Read JSON Response | JSON Class |
| Process XML Data | Dom Classes |
| Access Platform Metadata | Schema Classes |
Common Built-in APIs in Apex
| API | Purpose |
|---|---|
| HTTP | Connect with REST services. |
| JSON | Serialize and deserialize JSON data. |
| XML (DOM) | Read and generate XML documents. |
| Messaging | Send emails from Apex. |
| Schema | Access object and field metadata. |
| Crypto | Encryption and hashing. |
| EncodingUtil | Base64 encoding and decoding. |
Simple API Example
The following example converts an Apex object into JSON format using the built-in JSON class.
// Execute Anonymous Window
Account acc = new Account(
Name = 'LearnFrenzy'
);
String jsonData =
JSON.serialize(acc);
System.debug(jsonData);
Debug Log Output
USER_DEBUG [6]|DEBUG|
{"Name":"LearnFrenzy"}
The JSON.serialize() method converts an Apex object into a JSON string, making it easy to exchange data with external applications.
Real Business Scenario
🏢 Business Example
Suppose a customer places an order in Salesforce.
The application automatically performs several tasks using built-in APIs:
- Send the order to an ERP system using an HTTP callout.
- Convert Salesforce data into JSON format.
- Receive the ERP response.
- Send a confirmation email to the customer.
- Update Salesforce records based on the response.
All of these operations can be performed using Apex's built-in APIs.
Where Are Built-in APIs Used?
| Salesforce Feature | API |
|---|---|
| REST Integration | HTTP Classes |
| Email Automation | Messaging |
| Dynamic Apex | Schema |
| JSON Processing | JSON |
| File Encoding | EncodingUtil |
| Data Security | Crypto |
✅ Best Practice
Use Salesforce's built-in APIs whenever possible instead of creating custom implementations. These APIs are optimized for the Salesforce platform, regularly maintained, and follow platform best practices.
⚠️ Common Mistake
Many beginners attempt to manually parse JSON or XML using String operations. Instead, use Apex's built-in JSON and DOM classes to simplify development and improve reliability.
🎯 Interview Tip
Question: Why should developers use Apex built-in APIs?
Answer: Built-in APIs provide ready-to-use functionality for integrations, email services, metadata access, JSON and XML processing, encryption, and other common development tasks. They reduce development effort, improve reliability, and follow Salesforce best practices.
📚 Learn More
This section introduces the most commonly used built-in APIs available in Apex.
In later chapters, you'll learn each API in detail, including:
- HTTP Callouts
- REST and SOAP Integrations
- JSON Parsing and Serialization
- XML Processing
- Email Services
- Dynamic Apex (Schema API)
- Crypto and Security APIs
- Real Integration Projects
Practice What You've Learned
Test your understanding with these practice exercises