---
schema_version: "1"
id: 73492c928fe510c938565da05aa01ac60a8f20e4f422536d540687f4f43b9915
title: Design and Publish the American Flights API Specification
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/anypoint-code-builder/tut-flights-design-api.md
canonical_url: https://docs.mulesoft.com/anypoint-code-builder/tut-flights-design-api
source_site: docs.mulesoft.com
content_type: documentation
content_hash: fcc257caeda124eb1fa62f6122f1dd1e3ccf319b92a9884ae56c272360cecb65
description: MuleSoft Documentation Site
latest: true
---
---
product: Anypoint Code Builder
version: master
---

# Design and Publish the American Flights API Specification

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

Design the American Flights API specification in Anypoint Code Builder, test it with the built-in
mocking service, and publish it to Anypoint Exchange so other team members can find and implement
it.

Before you begin, complete the setup in
[Build an API from Start to Finish with Anypoint Code Builder](https://docs.mulesoft.com/anypoint-code-builder/tut-flights-api-tutorial).

## Create the API Specification

Start creating the American Flights API spec:

1.  In the activity bar, click the ![](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-ms-logo.png) (**Anypoint Code Builder**) icon.

    ![Anypoint Code Builder icon in the VS Code activity bar](/mulesoft/current/en-us/anypoint-code-builder/_images/tut-flights-acb-activity-bar-icon.png)

2.  From **Create**, click **Design an API**.

3.  Configure your API spec project using these values:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field Name</th><th>Field Value</th></tr></thead><tbody><tr><td><div><div><p><strong>Enable this API for Topics and Actions</strong></p></div></div></td><td><div><div><p>Select this checkbox to add the applicable agent topic metadata and apply centralized governance rulesets to the project. See <a href="https://docs.mulesoft.com/anypoint-code-builder/ai-enabling-api-project-topic-center">Enabling an API Project for Topics and Agent Actions</a> for more information.</p></div></div></td></tr><tr><td><div><div><p><strong>Project Name</strong></p></div></div></td><td><div><div><p><code>American Flights API</code></p></div></div></td></tr><tr><td><div><div><p><strong>Project Location</strong></p></div></div></td><td><div><div><p>Your home directory is selected by default. This is the root folder of your project, which acts as your workspace. Don’t select a different project directory for this API spec. See <a href="https://docs.mulesoft.com/anypoint-code-builder/start-add-folders">Adding Folders to Your Home Directory</a> for more information.</p></div></div></td></tr><tr><td><div><div><p><strong>API Type</strong></p></div></div></td><td><div><div><p><strong>REST API</strong></p></div></div></td></tr><tr><td><div><div><p><strong>API Specification Language</strong></p></div></div></td><td><div><div><p><strong>OAS 3.0 (YAML)</strong></p></div></div></td></tr><tr><td><div><div><p><strong>Business Group</strong></p></div></div></td><td><div><div><p>Select the business group to use for this project.</p></div></div></td></tr></tbody></table>

4.  Click **Create Project** to generate the American Flights API project file:
    `american-flights-api.yaml`.

    The file name is based on the project name you provide.

5.  Configure the agent topic metadata and instructions by setting these values:

    <table><colgroup><col> <col></colgroup><thead><tr><th>Field Name</th><th>Field Value</th></tr></thead><tbody><tr><td><div><div><p><strong>Topic Label</strong></p></div></div></td><td><div><div><p>American Flights API</p></div></div></td></tr><tr><td><div><div><p><strong>Classification Description</strong></p></div></div></td><td><div><div><p>Use the API description.</p></div></div></td></tr><tr><td><div><div><p><strong>Scope</strong></p></div></div></td><td><div><div><p>Your job is only to book, update, or retrieve flight information.</p></div></div></td></tr><tr><td><div><div><p><strong>Instruction</strong></p></div></div></td><td><div><div><p>If a user asks to retrieve flight details, use the get flight operation to retrieve information using the booking ID.</p></div></div></td></tr></tbody></table>

    If you don’t see the **Agent Topics** after creating the project, you must trust the workspace
    folder. You can do so by clicking **Manage** then **Trust** from the notification that shows.

    ![The workspace trust notification with Manage and Trust options](/mulesoft/current/en-us/anypoint-code-builder/_images/tut-flights-restricted-banner.png)

    > [!TIP] If you closed the notification, or it doesn’t show, see:
    > [Trusting a workspace](https://code.visualstudio.com/docs/editing/workspaces/workspace-trust#_trusting-a-workspace)
    > for instructions.

6.  Click **Apply** to save your changes.

7.  In the activity bar, click the MuleSoft Vibes icon.

    ![MuleSoft Vibes icon in the activity bar](/mulesoft/current/en-us/anypoint-code-builder/_images/tut-flights-open-vibes.png)

8.  Enable auto-approve by clicking the **Auto-approve** section at the end of the MuleSoft Vibes
    window, and then select:

    - **Read project files**

    - **Edit project files**

    - **Execute safe commands**

    - **Use MCP Servers**

      ![Auto-approve panel with Read project files, Edit project files, Execute safe commands, and Use MCP servers checkboxes selected](/mulesoft/current/en-us/anypoint-code-builder/_images/tut-flights-vibes-auto-approve.png)

      With auto-approve enabled, MuleSoft Vibes automatically applies changes to your project
      without prompting you for confirmation. See
      [MuleSoft Vibes for Anypoint Code Builder](https://docs.mulesoft.com/anypoint-code-builder/vibes-get-started) for more information.

9.  Enter this prompt, and then send your message:

    ```command
    Create an OAS 3.0 API specification example for the American Flights API that returns flight information from a MySQL database. The API must define:
    1. A GET /flights endpoint that retrieves all flights.
    2. A GET /flights/(flightId) endpoint that retrieves a single flight by its flightId path parameter. The flightId must match the pattern ^[A-Z]{2}[0-9]{1,4}$.
    3. Both endpoints must return flight objects with this exact structure: ID (integer), code (string), price (number), departureDate (string), origin (string), destination (string), emptySeats (integer), and a nested plane object with type (string) and totalSeats (integer).
    ```

    MuleSoft Vibes generates the spec and saves it to your file.

    ![The american-flights-api.yaml file open in the editor showing the generated OAS 3.0 specification](/mulesoft/current/en-us/anypoint-code-builder/_images/tut-flights-generated-spec.png)

    > [!TIP] If you get an `API streaming failed` error, click **Resume Task** to retry creating the
    > spec.  
    > If you see this message: `The model has determined this command requires explicit approval.`,
    > click **Run Command**.

## Mock and Test the API

Next, use MuleSoft Vibes and the built-in mocking service in the API Console to test the API before
you publish it.

Send this message to MuleSoft Vibes:

```command
Test the API using the built-in mocking service in API console.
```

Alternatively, you can open the API Console and manually test the endpoints:

1.  In the project explorer, open your API spec YAML file.

2.  Open the Command Palette.

    Show me how

    - Use the keyboard shortcuts:

      - Mac: Cmd+Shift+p

      - Windows: Ctrl+Shift+p

    - Select **View** > **Command Palette**.

3.  Provide this command:

    ```command
    MuleSoft: Show API Console
    ```

4.  Click **GET** in any of the endpoints.

    ![The american-flights-api.yaml file next to the API Console showing the Get all flights and Get a flight by ID endpoints](/mulesoft/current/en-us/anypoint-code-builder/_images/tut-flights-api-console.png)

5.  Click **Try it** and then **Send**.

    The API Console shows an example response.

Your API spec is now ready to publish to Anypoint Exchange.

## Publish the API Spec to Exchange

Publish the American Flights API spec to Exchange so that other team members can find and implement
it.

Send this message to MuleSoft Vibes:

```command
Publish the American Flights API specification to Exchange with asset version 1.0.0, API version v1, and asset ID american-flights-api.
```

If prompted, sign in to Anypoint Platform and select a business group. When asked to implement the
API now, select **No** to avoid scaffolding the American Flights API spec into your integration. You
scaffold the API in [Implement the American Flights API](https://docs.mulesoft.com/anypoint-code-builder/tut-flights-implement-api).

### Manually Publish the API Spec to Exchange

If you prefer not to use MuleSoft Vibes, publish the spec manually:

1.  In the project explorer, open your API spec YAML file.

2.  Click **Publish API Project to Exchange**.

    ![Publish API Project to Exchange icon](/mulesoft/current/en-us/anypoint-code-builder/_images/icon-publish-to-exchange.png)

    - You can also provide this command in the command palette:

      ```command
      MuleSoft: Publish API Project to Exchange
      ```

3.  If prompted, click **Allow**, and follow the prompts to sign in to Anypoint Platform.

4.  If you haven’t selected a business group, select one now in **Select a Business Group**.

5.  Enter the asset version: `1.0.0`.

6.  Enter the API version: `v1`.

7.  Confirm the asset ID in the project metadata: `american-flights-api`.

8.  Click **Publish**.

    The status bar shows the progress after the API is published successfully to Exchange.

9.  When prompted to implement the API now, select **No** to avoid scaffolding the American Flights
    API spec into your integration.

    Selecting **Yes** scaffolds the API spec into your project. Instead of scaffolding now, you
    scaffold the API in [Implement the American Flights API](https://docs.mulesoft.com/anypoint-code-builder/tut-flights-implement-api).

## Locate Your API in Exchange

After publishing your API spec, you can find it in Anypoint Exchange:

1.  Navigate to Anypoint Exchange.

    Show me how

    - US cloud (non-EU host): [Exchange (US)](https://anypoint.mulesoft.com/exchange/)

    - EU cloud (EU host): [Exchange (EU)](https://eu1.anypoint.mulesoft.com/exchange/)

2.  Type `american` in the search bar and press Enter.

3.  Notice that your API spec is listed as an asset.

    You can select the API, navigate through its summary, and see all the endpoints you defined in
    the previous tasks.

[Build an API from Start to Finish with Anypoint Code Builder](https://docs.mulesoft.com/anypoint-code-builder/tut-flights-api-tutorial)
[Implement the American Flights API](https://docs.mulesoft.com/anypoint-code-builder/tut-flights-implement-api)
