Public and Private APIs

API definitions in API Hub for Design can be public and private. Public APIs are visible to anyone, even to those who do not have a API Hub for Design account. Private APIs are visible only to the API owner and designers and consumers (the users who were explicitly granted access to the API).Resource Roles

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

Make your API public or private

You make your API public or private when creating or importing it by selecting from the Visibility field:

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

  1. Open the API page in API Hub for Design.

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

    API_screenshot_API_versions_01.png
  3. Click public.png to make the version private or private.png to make it public.

See if an API is public or private

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

API_screenshot_check_public_private_01.png

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 API Hub for Design account.TeamsResource Roles

To add collaborators:

  1. Open the API page in API Hub for Design.

  2. In the top right corner, click share.png.

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

    Sharing and roles
  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 API Hub for Design 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

Publication date: