This article has been curated by the MuleSoft Success Guides team at Salesforce. If you’re interested in speaking with a Success Guide on this topic and are a MuleSoft customer, consider opening an API Development Expert Coaching Session.
MuleSoft follows a composability approach. Every piece of functionality is broken into a building block called an API, and each block can fit into any puzzle. Teams assemble new products, channels, and processes by reusing existing blocks instead of building each integration from scratch. This article explains how to design those building blocks so they stay reusable and easy to maintain.
MuleSoft customers generally work with three types of APIs, called layers: system, process, and experience APIs. Together they form API-led connectivity. Each layer has one responsibility and can change independently of the others.
Layer |
Purpose |
Example |
| Experience API | Shapes data for one channel or consumer | An API for a mobile app or partner portal |
| Process API | Combines data and business logic from several system APIs | An order fulfillment API that combines inventory, billing, and shipping |
| System API | Exposes a system of record and hides its complexity | Customer data from an ERP or CRM system |
API-led connectivity is a guideline, not a strict rule. Not every enterprise needs all three layers, and a smaller or simpler landscape can combine or skip a layer. Most enterprises do end up using all three, because separating system access, business orchestration, and channel-specific delivery makes each API easier to reuse and change. Use the layers that fit your landscape, and add the others as it grows.
Every MuleSoft API layer requires a design. Start by writing the API specification in the latest supported version of RAML (RESTful API Modeling Language) or OAS (OpenAPI Specification), and share it with consumers for feedback before you build the implementation. You can write the specification in two ways.
Use Design Center in Anypoint Platform to write the specification in the browser. This option works well for quick edits and for teams that already manage their specifications there.
Use Anypoint Code Builder (ACB), the MuleSoft development environment, with MuleSoft Vibes, the AI-assisted development capability. Describe the API in plain language, and Vibes drafts the RAML or OAS specification for you. Review and refine the draft, then build and test the implementation in the same tool. This approach speeds up design, keeps the specification and the code together, and makes it easier to apply the same naming and error response conventions across every layer.
Before you start, confirm that your Anypoint Platform administrator has enabled Einstein in Access Management and has given you the Mule Developer Generative AI User and ACB Developer permissions. Then open ACB, sign in with your Anypoint Platform account, and open MuleSoft Vibes from the toolbar.
The most effective prompt describes the whole specification in one message, so Vibes can generate and validate it in one pass. Include the following details:
Here is an example prompt for an experience API:
"Create an OpenAPI 3.0 specification for a "Customer Orders Experience API", version 1.0.0, that lets a mobile app view a customer's orders. Use OAuth 2.0 for security. Add a GET /customers/{customerId}/orders resource with an optional query parameter "status" (string) and a required header "X-Correlation-ID" (string). Return 200 with a list of orders (order ID, status, total, and order date) and an example. Also return 400, 401, 404, and 500 with the same error body: status code, error code, message, and correlation ID."
To improve the result:
Plan for errors when you design the API, not after you build it. Define the error responses in the API specification with a consistent structure: status and error code, message, and correlation ID.
In the Mule application, a global default error handler gives every flow the same error behavior. On Error Continue handles the error and returns a normal response. On Error Propagate handles the error and passes it to the caller or parent flow. For retries, dead-letter queues, and detailed patterns, see the Mule error handling documentation.
Anypoint Exchange is the MuleSoft catalog for sharing APIs and other assets. Well-published assets are found and reused, while poorly published assets are duplicated.
If you want to learn more about what you can do with MuleSoft, request an Expert Coaching Session (ECS). An ECS is a one-on-one session with a MuleSoft subject matter expert who can help you apply these best practices to your own integrations: Request an Expert Coaching Individual Session.
005465274

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.