Creating an API Custom Template

Availability: Enterprise and Trial plans, SaaS and On-premise

API Custom templates are API definitions that you create for use as templates by your organization. Only organization owners can create API custom templates. API custom templates will appear in the Template pulldown when your organization's designers create new APIs.

API custom templates behave in exactly the same way as the built-in templates (e.g., PetStore). When designers/developers create a new API, the template's contents are initially copied into the current API file. APIs created using templates are not linked to their template -- once an API is created and the template is copied, changes to the template are NOT reflected in the created API file.

The standard API templates included with SwaggerHub are only available to copy into newly created API files – the templates themselves cannot be changed or revised. However, since you own the definition files of your own API custom templates, they can be edited, renamed, deleted, tested, revised, forked, etc., just like any other API. A custom template can be updated and versioned like any other API definition. It can be public or private. It can be published or not. It can refer to a domain (where supported). You cannot generate code from an API custom template, and templates would not normally be actively used as APIs themselves.

Supported API Types

API custom template files can be:

  • OpenAPI 2.0 (Swagger)

  • OpenAPI 3.0

How to Create New API Custom Templates

If you are an organization owner (not a designer or consumer), when you click on the Create New button in SwaggerHub, the popup menu will have the choice: Create New Template. From there, the process is the same as creating an API. You can create your template from a blank page by specifying – None – in the Template field. Alternatively, you can specify a standard SwaggerHub template or another API custom template file (that you have previously created) to be copied into your new template at creation.

How to Save an Existing API as a Template

You can save an existing API as a template if you are an organization owner (not a designer or consumer).

Save as Template

Working with API Custom Templates

All operations on API custom template files (fork, delete, etc.) are identical to those on regular API definition files.

Publication date: