Skip to content
v1.0.0

Example of an OpenAPI document with security

This is an example of an OpenAPI document with security definitions and security requirements.

Servers

https://localhost:3000Local server

ID: onlyApiKey

GET /onlyApiKey

GET
/onlyApiKey

Authorizations

apiKey
TypeAPI Key (header: api_key)

Samples


ID: onlyBearerAuth

POST /onlyBearerAuth

POST
/onlyBearerAuth

Authorizations

bearerAuth
TypeHTTP (bearer)

Samples


ID: apiKeyAndBearerAuth

PUT /apiKeyAndBearerAuth

PUT
/apiKeyAndBearerAuth

Authorizations

apiKey
TypeAPI Key (header: api_key)
+
bearerAuth
TypeHTTP (bearer)

Parameters

Header Parameters

headerParam*

Header parameter description

Typestring
Required
Examplevalue

Samples


ID: apiKeyOrBearerAuth

GET /apiKeyOrBearerAuth/{pathParam}

GET
/apiKeyOrBearerAuth/{pathParam}

Authorizations

apiKey
TypeAPI Key (header: api_key)
or
bearerAuth
TypeHTTP (bearer)

Parameters

Path Parameters

pathParam*

Path parameter description

Typestring
Required

Samples


ID: noSecurity

GET /noSecurity

GET
/noSecurity

Samples


ID: multipleSecurity

POST /multipleSecurity/{pathParam}

POST
/multipleSecurity/{pathParam}

Authorizations

apiKey|bearerAuth
apiKey
TypeAPI Key (header: api_key)
+
bearerAuth
TypeHTTP (bearer)
or
basicAuth|internalApiKey
basicAuth

Basic authentication with username and password

TypeHTTP (basic)
+
internalApiKey

Internal API key for special customers

TypeAPI Key (header: internal_api_key)
Examplespecial-key

Parameters

Path Parameters

pathParam*

Path parameter description

Typestring
Required

Query Parameters

param1*

Query parameter description

Typestring
Required
Enum
value1value2
defaultvalue1
param2*

Another query parameter description

Typestring
Required

Request Body

JSON
{
"prop1": "string",
"prop2": 0,
"prop3": [
[
"value1",
"value2"
]
]
}

Samples


Powered by VitePress OpenAPI