Creating an API Custom Template

API custom templates are API definitions that you can create for use as templates by your organization. Only organization owners can add them. Custom templates are selectable from the Template dropdown during the creation of a new API.

Custom templates behave in the same way as built-in templates (for example, PetStore). When designers or developers create a new API using a template, its contents are initially copied into the new definition. APIs generated in this way are not linked to their template – once an API has been created and a template has been copied, any subsequent changes to that template are not reflected in the API.

The standard templates included with Swagger Studio are only available to copy into newly created API files – these templates cannot be changed or revised. However, you own the definition files of your custom templates, and can edit, delete, test, revise, or fork them like any other API.

A custom template can be updated and versioned similarly to other API definitions; it can be public or private; published or not; associated or not with a domain (if supported). You cannot generate code from an API custom template, and templates would not normally be actively used as APIs themselves.

Supported API protocols

API custom templates are available for OpenAPI 2.0, 3.0, 3.1, and AsyncAPI 2.x, 3.0.

Create a new API custom template

If you are an organization owner (not a designer or consumer), when you click on the Create New button in Swagger Studio, 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 Swagger Studio template or another API custom template file (that you have previously created) to be copied into your new template at creation.

Save an existing API as a template

You can save an existing API as a template only if you are an organization owner.

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: