Creating and Importing API Specifications | MuleSoft Documentation
# Creating and Importing API Specifications
Cloud IDE 
Desktop IDE 
**Open Beta Release** : The **cloud IDE is in open beta**. Any use of Anypoint Code Builder in its beta state is subject to the applicable beta services terms and conditions, available from the IDE.
Use Anypoint Code Builder to create, import, and test API specs before publishing to Anypoint Exchange:
  1. Create a API spec project in Anypoint Code Builder from the IDE or by importing the spec from MuleSoft VCS:
     * Create an API spec project from the IDE
     * Import an API spec from MuleSoft VCS
  2. Track progress in the output panel.
  3. Review your spec in the API console.
  4. Test your spec using the mocking service.


Use the `oas-example` API spec to explore the functionality of Anypoint Code Builder.
## Before You Begin
  * Set up and access the web or desktop IDE.
  * Understand the basics of designing API specs.
See the Tutorials for details.
  * Have some familiarity with business groups.
When you publish your API spec to Exchange from Anypoint Code Builder, the IDE requests the name of the business group. See Resource Organization and Access Control with Business Groups.


## Create a New API Specification Project
To create an API spec project in Anypoint Code Builder:
  1. In the activity bar of the IDE, click the (**Anypoint Code Builder**) icon.
  2. From **Quick Actions** , click **Design an API** :
  3. Complete the **API Specification** form:
Field Name | Field Value  
---|---  
**Project Name** |  Unique name for your project. This name is used as the API spec title in Exchange, the name of the spec file, and the name of the project’s root directory. For example, if the project name is _OAS Example_ , the spec file name is `oas-example`. To reuse an existing project name, you must delete the project that is already using the name first. See Deleting API Specs and Fragments.  
**Project Location** |  Your home directory or another directory you create. See Adding Folders to Your Home Directory. Don’t create the project within another project directory.  
The type of API spec to create. Available options are **REST API** and **AsyncAPI**. Select **REST API** to use the example in this procedure.  
**API Specification Language** |  See Supported OAS and RAML Versions. Select **OAS 3.0 (YAML)** to use the example in this procedure.  
  4. Click **Create Project**.
If prompted, trust the authors of the files in the folder.
When the project is ready for editing, the API project opens the spec in the Editor view, for example, this OAS 3.0 (YAML) spec:
  5. Continue designing your API spec.
As you enter elements, use auto-complete (or press Ctrl+Space) to display available options within the context.


## Import an API Specification from MuleSoft VCS
Import an API spec from MuleSoft VCS and use Git or another source-control management system compatible with VS Code in the desktop or cloud IDE to keep your project in sync. For more information, see Source Control for API Design Projects.
  1. Open the Command Palette.
Show me how
     * Use the keyboard shortcuts:
       * Mac: Cmd+Shift+p
       * Windows: Ctrl+Shift+p
     * In the desktop IDE, select **View** > **Command Palette**.
     * In the cloud IDE, click the (menu) icon, and select **View** > **Command Palette**.
  2. Provide the following command:
```
MuleSoft: Import API Specification from MuleSoft VCS
```

  3. If prompted, log in to Anypoint Platform through the IDE.
  4. Complete the import process:
    1. Select your business group from the **Select a Business Group** popup.
    2. Search for the API spec in the **APIs from MuleSoft VCS** field.
    3. Navigate to or create a folder for the spec, and click **Select target folder**.
If you receive an error that the import failed (**Importing project _a_project_name_ has failed**), check your target folder for a project with the same name. To address a duplicate naming issue before importing, you can import the design project to a different target folder or delete the project from your IDE (see Deleting API Specs and Fragments).
  5. Edit or continue designing your spec, as needed.
As you enter elements, use auto-complete (or press Ctrl+Space) to display available options within the context.
  6. You can sync your changes with MuleSoft VCS.
This feature is available only for API projects that you import from MuleSoft VCS. You can also store your work in another SCM. For SCM options, see Controlling Source Files.


## Track Progress in the Output Panel
To track the progress of internal processing as you design your API:
  1. Open the Output panel.
Show me how
     * Use the keyboard shortcuts:
       * Mac: Cmd+Shift+u
       * Windows: Ctrl+Shift+u
     * In the desktop IDE, select **View** > **Output**.
     * In the cloud IDE, click the (menu) icon, and select **View** > **Output**.
  2. Select **Mule DX Server** from the dropdown list:


To see scaffolding errors only, select **Mule DX Server: Scaffolding** from the list.
## Review Your Spec in the API Console
To display your spec in the console:
  1. Click your spec file in the editor.
  2. Click the (**API Console**) icon.
Alternatively, you can provide the command `MuleSoft: API Console` from the Command Palette.
  3. Wait for the endpoints to render in the API Console.
The API Console shows the endpoints for the spec in API Console, for example:
Click a method to view details.  
---  
Display the console menu.  
  4. Click methods in the console or select items from the menu to view different parts of your spec. For example, click **GET** :


## Test Your API Spec Using the Mocking Service
Use the Mocking Service in the API Console to check the request and responses that you configured in your API spec.
  1. In Anypoint Code Builder, open the spec for your API project, such as `oas-example`.
  2. Click the (**API Console**) icon to display your spec in the console.
  3. In the API Console, click a method, such as GET or POST.
  4. Confirm that the parameters that you’ve defined are correct and click **Send**.
  5. Verify that API console returns the response you defined, for example:
  6. Optionally, review your configured response examples when querying your mocked API endpoints.
## Test Your API Spec Using the Mocking Service
Use the Mocking Service in the API Console to check the request and responses that you configured in your API spec.
  1. In Anypoint Code Builder, open the spec for your API project, such as `oas-example`.
  2. Click the (**API Console**) icon to display your spec in the console.
  3. In the API Console, click a method, such as GET or POST.
  4. Confirm that the parameters that you’ve defined are correct and click **Send**.
  5. Verify that API console returns the response you defined, for example:
  6. Optionally, review your configured response examples when querying your mocked API endpoints.


## Example OAS 3.0 (YAML) API Specification
If you created an OAS 3.0 (YAML) project, you can replace the initial spec with following example code:
Example OAS 3.0 (YAML) API Specification
```
 openapi: "3.0.0"
 info:
  version: 1.0.0
  title: oas-example
 paths:
  /contacts:
   get:
    summary: Retrieve a list of contacts
    description: Returns a list of contacts.
    responses:
     '200':
      description: Successful response
      content:
       application/json:
        example:
         - id: 1
          firstName: John
          lastName: Doe
          company: Example Corp
         - id: 2
          firstName: Jane
          lastName: Smith
          company: Another Company
   post:
    summary: Create a new contact
    description: Creates a new contact.
    requestBody:
     description: Contact object to be created
     required: true
     content:
      application/json:
       schema:
        $ref: '#/components/schemas/Contact'
    responses:
     '201':
      description: Contact created successfully
      content:
       application/json:
        example:
         id: 3
         firstName: John
         lastName: Doe
         company: Example Corp
     '400':
      description: Invalid request
     '500':
      description: Internal server error
  '/contacts/{contactId}':
   put:
    summary: Update a contact
    description: Updates an existing contact based on the contact ID.
    parameters:
     - name: contactId
      in: path
      description: ID of the contact to update
      required: true
      schema:
       type: integer
       format: int64
    requestBody:
     description: Updated contact object
     required: true
     content:
      application/json:
       schema:
        $ref: '#/components/schemas/Contact'
    responses:
     '200':
      description: Contact updated successfully
      content:
       application/json:
        example:
         id: 3
         firstName: John
         lastName: Doe
         company: Updated Corp
     '400':
      description: Invalid request
     '404':
      description: Contact not found
     '500':
      description: Internal server error
 components:
  schemas:
   Contact:
    type: object
    properties:
     id:
      type: integer
      format: int64
     firstName:
      type: string
     lastName:
      type: string
     company:
      type: string
    required:
     - firstName
     - lastName
```

## See Also
  * Getting Started with Anypoint Code Builder
  * Resource Organization and Access Control with Business Groups
  * Use Auto-Complete in the Editors
  * Designing the American Flights API Spec Tutorial
  * Deleting API Specs and Fragments