Creating a New API

Last modified on October 20, 2021

You can create APIs in SwaggerHub in several ways:

You can create APIs in your personal account or on behalf of any organization that you created.

Create an API in SwaggerHub

  1. In the sidebar on the left, click and select Create New API.

    Creating an API
  2. You will see a dialog where you need to enter the API information:

    API information
    • OpenAPI Version – Choose the API format: OpenAPI 2.0 or 3.0. Note: OpenAPI 3.0 support has some limitations.

    • Template – Select a sample API to start with, such as Petstore or IOT (Internet of Things), or select None to start with a blank API.

    • Name – The API name is its unique ID and is part of its path on SwaggerHub, as in{owner}/petstore/1.0. Requirements:

      • 3 to 60 character long
      • allowed characters: A..Z a..z 0..9 - _ .
      • must start and end with a letter or digit

      Note that API names are case-sensitive, so petstore and PetStore are two different APIs.

    • Owner – Choose whether to create the API in your personal or organization account (if you are a member of an organization on SwaggerHub). The API owner is part of the API path in SwaggerHub: Organization-owned APIs count toward the organization’s limits rather than yours.

      Note: Organization owners can always create APIs in that organization. Members with the Designer role have “create” permissions if the organization is configured with the Allow Designers to Create APIs under the Organization option.
    • Project – If an organization is selected as the Owner, you can optionally select a project to add this API to. The list contains existing projects available to you.

      SwaggerHub On-Premise note: This option was added in v. 1.23.
    • Visibility – Choose whether to make the API public or private. Public APIs are visible to anyone, even to people without a SwaggerHub account. Private APIs can be accessed only by you and by the people you added as collaborators). You can change the API visibility later if needed.

    • Auto Mock API – If selected, SwaggerHub will automatically create an API mock with the base path{owner}/{api}/{version}. This will let you test your API when designing it, and will let developers start working on the client application without having to wait until the API functionality is implemented. SwaggerHub will also create the API Auto Mocking integration for your new API that will automatically update the mock every time you save the API. For more information on using mocks, see API Auto Mocking.

    When creating a blank API (no template), you also need to specify the following fields:

    • Version – The API version. For example, 1.0, 1.0.0, 1.0b5, beta. See Version Format.

    • Title – The API title that will be displayed in the interactive API docs. For example, Pet Store API.

    • Description – An overview of what your API is for. The description will be included in the API definition and will also be displayed in search results in SwaggerHub. You can change the description later.

  3. Click Create API.

After you create the API, the SwaggerHub editor will open where you can write your API definition.

See Also

Importing OpenAPI Definitions
Forking an API

Watch the video
Highlight search results