Contact Free trial Login

Create and Publish a RAML API Fragment in the Code Editor in API Designer

You can create API fragments directly in RAML with the help of code suggestions that appear within the code editor.

About this task

An API fragment is a RAML document that has a version and an identifier, but is not in itself a complete RAML specification. An API fragment is one of the following types defined by See the RAML 0.8 or 1.0 specification (depending on which you want to use) for descriptions of the types.

  • Trait

  • Resource Type

  • Library

  • Type

  • User Documentation

  • Example

  • Annotation Type

  • Security Scheme


  1. On the Projects page in Design Center, click Create and select Create Fragment.

  2. In the New API Fragment dialog, type a name for the project and select the type of API fragment that you want to create. Then, click Create.

    Result: The code editor opens. The editor is divided into three panels:

    • The left panel lists the files in your project. By default, the editor creates a .raml file that has the same name as the project.

      You can create more than one API specification in a single project. If you want to include additional API specifications in your project, click the plus sign in the Files panel to create a new file or click the dots that are next to the plus sign to import a file.

    • The central panel displays the editor in which you create your API fragment.

    • The right panel lists the types and resources that are in the API fragment that is displayed in the central panel.

  3. Draft your API fragment.

    As you draft, the code editor suggests RAML nodes, methods, and other elements that you can add at the location of your cursor.

    You can import files into your project, either separately or bundled together in .zip files. The files can be RAML 1.0 files, JSON files, or OpenAPI Specification (OAS) 2.0 files. The files can be on your computer or you can specify a URL for them if they are located online.

What to do next

You can publish the API fragment to Anypoint Exchange. Click the Publish button that is in the top-right corner of the code editor, and then click Publish to Exchange to open the Publish API specification to Exchange dialog.

The fragment can then be included as a dependency in an API-specification project. After revising a fragment, update API specifications that use the fragment to include the new version.

When you publish the API Fragment to Exchange, it automatically creates its API Portal.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.