Forking an API

Last modified on November 29, 2021

Forking creates a copy of a specific version of an API in your account. For example, you can fork someone else’s API as a starting point for your own API. Or you can create a fork of your own API to experiment with changes without affecting the original API definition.

You can fork to your personal account or to any organization you created.

Forks are not linked to the original API in any way, so the changes in the original API do not affect the forks.

Public vs private APIs

Public APIs can be forked by any logged-in SwaggerHub user. Private APIs can be forked only by the API owner and by the people who are collaborators on that API.

How to fork an API

  1. Open the API page in SwaggerHub.

  2. If the API has several versions, select the version you want to fork.

    Selecting an API version
  3. Click the API name. This will open the API Info panel.

    Opening the API Info panel
  4. Click Fork in the API Info panel.

    Forking an API
  5. Enter the name for your fork and specify other details.

    Forked API
    • API Name – The ID of your API, which will be part of the API URL in SwaggerHub, as in https://app.swaggerhub.com/api/{owner}/petstore/1.0.

      The ID must be at least 3 characters long and must start and end with a letter or digit. You can use English letters (A..Z, a..z), digits (0..9), dots (.), hyphens (-), and underscores (_). IDs are case-sensitive, so petstore and PetStore are two different APIs.

    • API Version – The API version. For example, 1.0, 1.0.0, 1.0b5, beta (see Version Format). It does not necessarily need to match the API version you are forking, because the fork will be a completely different API.

    • 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: https://app.swaggerhub.com/apis/owner/api-name/1.0. 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.

  6. Click Fork API.

SwaggerHub will copy the API to the specified owner account and will open the API definition in the SwaggerHub editor where you can edit it.

Notes

  • Forking does not copy integrations and comments that exist in the original API. This is by design to protect the integrity of the original API.

  • The “Save as New’ command is another way to copy an existing specification to a new API spec. This command works only for the APIs that you can edit in SwaggerHub. Forking can be used for any accessible API specification.

See Also

Creating a New API
Importing OpenAPI Definitions
Versioning
Saving an API as a New API

Watch the video
 
Highlight search results