---
schema_version: "1"
id: 5f84637042c4d53953c562a8105deac046b7ee3da10b7b03dacb78892ab4a6e3
title: Step 3. Develop the API
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/general/api-led-develop.md
canonical_url: https://docs.mulesoft.com/general/api-led-develop
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 7a626fa4b0a7287dc5ca6ad4b75188794b0cdef5e2314d6f47baa08062b2a3c5
description: MuleSoft Documentation Site
latest: true
---
---
product: Getting Started
keywords: api-led connectivity, implementation project, scaffolded structure, hello world, mulesoft development, anypoint studio, api implementation
---

# Step 3. Develop the API

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Now that you’ve created an API spec, you’ll turn it into a working Mule application. Anypoint Code
Builder includes an embedded Mule runtime for local testing. Later, you’ll deploy your application
to [CloudHub 2.0](https://docs.mulesoft.com/cloudhub-2/ch2-deploy), where it runs on Mule runtime in the cloud.

## Step 3.1: Create the Implementation Project

1.  Open your API spec file in the editor, then click ![](/mulesoft/current/en-us/general/_images/icon-implement-api.png)
    (**Implement this local API**) in the activity bar.

    > [!NOTE] The icon and command are only available when your API spec file is open and active in
    > the editor.

    Alternatively, open the Command Palette and select `MuleSoft: Implement this Local API`.

    Show me how

    - Use the keyboard shortcuts:

      - Mac: Cmd+Shift+p

      - Windows: Ctrl+Shift+p

    - In the desktop IDE, select **View** > **Command Palette**.

    > [!IMPORTANT] Don’t select `MuleSoft: Implement an API Specification`. That command is for
    > specs published to Anypoint Exchange, not local specs.

2.  At the prompt, click **OK**.

    ![Implement API specification dialog prompting to create a workspace to keep API spec and Mule project in sync](/mulesoft/current/en-us/general/_images/api-tutorial-implement-prompt.png)

3.  When prompted to save a `.code-workspace` file, navigate to your home directory and click
    **Save**.

    > [!IMPORTANT] Don’t accept the default location. The default saves the `.code-workspace` file
    > inside your `hello-world-api` spec folder, which causes errors. You must save it one level up
    > — in your home directory — so it sits alongside (not inside) your projects.

    For example, if you created your API spec in `~/hello-world-api/`, navigate up to `~` (your home
    directory) and save the file there. Your folder structure should look like this:

    ~/ (home directory) ├── hello-world-api/ <- your API spec project │ └── hello-world-api.yaml └──
    hello-world.code-workspace <- save the file HERE

4.  When prompted, provide project configuration details:

    1.  Provide a name for your Mule project, for example, `hello-world-impl`.

        ![The prompt to provide a project name for the API implementation project](/mulesoft/current/en-us/general/_images/api-tutorial-api-impl-provide-project-name-prompt.png)

    2.  When prompted to select a target folder, navigate to your home directory (`~`) and click
        **Select target folder**.

        This is where Anypoint Code Builder creates the `hello-world-impl` project folder. Selecting
        your home directory places both projects side by side:

        ~/ (home directory) ├── hello-world-api/ <- API spec project │ └── hello-world-api.yaml ├──
        hello-world-impl/ <- implementation project (created here) └── hello-world.code-workspace

    3.  Select a Mule runtime version for the project.

    4.  Select a Java version for the project.

        Anypoint Code Builder scaffolds your local API spec into a new Mule project. Both the API
        spec and the implementation project open together in your IDE in a multi-root workspace.

5.  Confirm the implementation file opened correctly:

    1.  In the Explorer view on the left, you’ll see two projects listed: `hello-world-api` and
        `hello-world-impl`.

    2.  Expand `hello-world-impl > src > main > mule` and open `hello-world-api.xml`.

        This is the Mule configuration XML, scaffolded from your API spec. It contains your flows,
        HTTP Listener, and APIkit Router. The canvas opens automatically.

## Step 3.2: Understand the Scaffolded Structure

The canvas shows your scaffolded flows, including:

- **hello-world-api-main**

  HTTP Listener that receives requests on port 8081

- **get:\\greeting:hello-world-api-config**

  Your GET endpoint implementation

- Error handling flows

Click the **Listener** component, then select **Edit Connection** (![](/mulesoft/current/en-us/general/_images/icon-gear.png)) to
review the connection configuration, including:

- **Path**: `/api/*` (receives all API requests)

- **Host**: `0.0.0.0` (listens to all interfaces)

- **Port**: `8081` (local development port)

  ![Anypoint Code Builder canvas with Listener component highlighted and an arrow pointing to the Edit Connection icon](/mulesoft/current/en-us/general/_images/api-tutorial-listener-component.png)

## Step 3.3: Implement the Hello World Logic

Now add the logic to return your greeting.

1.  Navigate to the **get:\\greeting:hello-world-api-config** flow in the canvas.

    ![The get:\\greeting:hello-world-api-config flow highlighted in the flow list](/mulesoft/current/en-us/general/_images/api-tutorial-api-config-flow-acb.png)

    The flow contains a **Logger** component by default. You’ll add a **Transform** component after
    it to return your greeting.

2.  Click ![](/mulesoft/current/en-us/general/_images/icon-plus.png) (**Add component**) after the Logger component in the flow.

3.  In the **Add Component** panel, search for `Transform` and select **Transform** from the
    results.

4.  Click the **Transform** component to open the DataWeave editor.

5.  In the DataWeave editor that opens, replace the default script with:

    ```dataweave
    %dw 2.0
    output application/json
    ---
    {
      message: "Hello, " ++ attributes.queryParams.name ++ "!"
    }
    ```

    ![The Transform component with the DataWeave script inserted](/mulesoft/current/en-us/general/_images/api-tutorial-transform-component-acb.png)

    This DataWeave script reads the `name` query parameter and returns a personalized greeting.

6.  Save your changes (Cmd+S on Mac, Ctrl+S on Windows/Linux).

That’s it! Your API is implemented and ready to test.

## What You Learned

You scaffolded a Mule project from your API spec using Anypoint Code Builder, which generated the
HTTP Listener, APIkit Router, and flow structure automatically. You then implemented the greeting
logic by adding a **Transform** component and writing a DataWeave script to read the `name` query
parameter and return a JSON response.

## Developer Deep Dive

Explore advanced implementation techniques:

- [DataWeave Language Reference](https://docs.mulesoft.com/mule-runtime/latest/dataweave)

- [Error Handling in Mule 4](https://docs.mulesoft.com/mule-runtime/latest/error-handling)

- [Understanding Flows and Subflows](https://docs.mulesoft.com/mule-runtime/latest/about-flows)

## What’s Next

Your API is implemented. Next, you’ll test it locally using debugging tools, add validation, and
inspect the data flow.

[Step 2. Design an API Specification](https://docs.mulesoft.com/general/api-led-design) [Step 4. Test the API](https://docs.mulesoft.com/general/api-led-test)
