Forum Discussion

shivasai's avatar
shivasai
New Contributor
2 years ago

How to add examples/API key values in swagger document

I want to add the header key as X-API-KEY and I want to add the value of that header, so as of now in the document I have seen how to add the key of the header but I have no idea how to add the value of the header, can anyone give me the solution for this?

 

components:

securitySchemes:
ApiKeyAuth: # arbitrary name for the security scheme
type: apiKey
in: header # can be "header", "query" or "cookie"
name: X-API-KEY # name of the header, query parameter or cookie

3 Replies

  • shivasai's avatar
    shivasai
    New Contributor


    Hi chichepo ,
    X-API-Key: abcdef12345

    As you see in the above picture we are using `apikey`
    There I am able to see the name:X-API-KEY as the key of the header, If I want to add the value of the header like value:abcdef12345 in swagger documentation, How can I add that?

  • chichepo's avatar
    chichepo
    Champion Level 3

    shivasai 
    Pardon me, I missed the fact that you were in securityScheme.

    I am not sure you can.

    You are going to expose a kind of "sensitive" data.
    In another hand, you may try to define a "Template" for the field (i.e.: APIKEY) to document the expected field content.

    Let us know if you find something