Public and Private APIs | SwaggerHub Documentation (2024)

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 designers and consumers (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 by selecting from the Visibility field:

Public and Private APIs | SwaggerHub Documentation (1)

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 designer/consumer with access to the resource:

  1. Open the API page in SwaggerHub.

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

    Public and Private APIs | SwaggerHub Documentation (2)

  3. Click Public and Private APIs | SwaggerHub Documentation (3) to make the version private or Public and Private APIs | SwaggerHub Documentation (4) 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.

Public and Private APIs | SwaggerHub Documentation (5)

Click the image to enlarge it.

Control who can access your private API

By default, a private API is visible only to the organization member who created it. To give other people and teams access to your private API, you need to add them to the API as designers or consumers. Designers have read-write access, and consumers have read-only access to an API. Note that members need a SwaggerHub account.

To add collaborators:

  1. Open the API page in SwaggerHub.

  2. In the top right corner, click Public and Private APIs | SwaggerHub Documentation (6).

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

    Public and Private APIs | SwaggerHub Documentation (7)

  4. Click Save.

The specified users will get an email notification that they have been given access to an API.

Change visibility via CLI

Use SwaggerHub CLI to change the 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

In this section:

Public and Private APIs | SwaggerHub Documentation (2024)
Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5840

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.