Creating a New API

Last modified on May 22, 2023

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 will need to enter the API information:

    API information
    • 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 and anyone with the Designer role can create APIs in that organization.
    • 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.
    • Specification – Choose the API format: OpenAPI 2.0, OpenAPI 3.0 or AsyncAPI. Note: OpenAPI 3.0 support has some limitations, AsyncAPI also has limitations.

    • Template – For OpenAPI: Select a template API to start with, such as Petstore or IOT (Internet of Things), or select None to start with a blank API. If you have defined API custom templates, those will appear in the pulldown and you can choose them.

    • 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.

    • 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 owners and by the people added as designers or consumers). 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 API Definitions
Forking an API

Watch the video
Highlight search results