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

GET /onlyApiKey

GET
/onlyApiKey

Authorizations

apiKey
TypeAPI Key (header: api_key)
Exampleyour-api-key

Playground

Authorization

Samples

cURL
JavaScript
PHP
Python

POST /onlyBearerAuth

POST
/onlyBearerAuth

Authorizations

bearerAuth
TypeHTTP (bearer)
ExampleBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30

Playground

Authorization

Samples

cURL
JavaScript
PHP
Python

PUT /apiKeyAndBearerAuth

PUT
/apiKeyAndBearerAuth

Authorizations

apiKey
TypeAPI Key (header: api_key)
Exampleyour-api-key
+
bearerAuth
TypeHTTP (bearer)
ExampleBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30

Parameters

Header Parameters

headerParam*

Header parameter description

Typestring
Required
Examplevalue

Playground

Authorization
Headers

Samples

cURL
JavaScript
PHP
Python

GET /apiKeyOrBearerAuth/{pathParam}

GET
/apiKeyOrBearerAuth/{pathParam}

Authorizations

apiKey
TypeAPI Key (header: api_key)
Exampleyour-api-key
or
bearerAuth
TypeHTTP (bearer)
ExampleBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30

Parameters

Path Parameters

pathParam*

Path parameter description

Typestring
Required

Playground

Authorization
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

GET /noSecurity

GET
/noSecurity

Playground

Samples

cURL
JavaScript
PHP
Python

POST /multipleSecurity/{pathParam}

POST
/multipleSecurity/{pathParam}

Authorizations

apiKey|bearerAuth
apiKey
TypeAPI Key (header: api_key)
Exampleyour-api-key
+
bearerAuth
TypeHTTP (bearer)
ExampleBearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30
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

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

Playground

Authorization
Variables
Key
Value
Body

Samples

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI