Public and Private APIs

Last modified on April 14, 2021

API definitions in SwaggerHub can be public and private. Public APIs are visible to anyone, even to those who do not have a SwaggerHub account. Private APIs are visible only to the API owner and collaborators (the users who were explicitly granted access to the API).

You can set the public or private status for each API version individually.

Make your API public or private

You make your API public or private when creating or importing it:

Creating a public or private API

You can also change the visibility status of an existing API at any time. To do this, you must be the API’s owner or a collaborator with the Editor role:

  1. Open the API page in SwaggerHub.

  2. If your API has several versions, select the version you want to make private or public:

    Switching between API versions
  3. Click to make the version private or to make it public.

See if an API is public or private

Private APIs appear with the PRIVATE label on the SwaggerHub dashboard, in search results and on the API definition page. Note that different versions of the same API can have different visibility statuses.

Private API

Click the image to enlarge it.

Control who can access your private API

By default, a private API is visible only to the user who created it. To give other people and teams access to your private API, you need to add them as collaborators. Collaborators can have read-only or read-write access to an API. Note that collaborators need a SwaggerHub account.

To add collaborators:

  1. Open the API page in SwaggerHub.

  2. In the top right corner, click .

  3. Type the user name, user email or team name to add. Select a role for each collaborator:

    • View – view the API definition and the comments made by other collaborators.

    • Comment – view the API definition, view and add comments.

    • Edit –view, edit, publish, and unpublish the API definition, manage comments (add, resolve, reopen, delete), make an API public or private.

    Collaborators and roles
  4. Click Save.

The specified users will get an email notification that they have been added to an API as a collaborator.

Change visibility via CLI

Use SwaggerHub CLI to change visibility of your APIs from the command line.

To change API visibility to Private:

swaggerhub api:update --visibility=private OWNER/API_NAME/VERSION

To change API visibility to Public:

swaggerhub api:update --visibility=public OWNER/API_NAME/VERSION

See Also

Creating a New API
Publishing an API
Organizations, Projects, and Teams

Highlight search results