openapi: 3.1.0
info:
  title: Waylay Vault
  version: 2.13.0-beta.0
  description: Waylay Accounts Service Vault API endpoints
servers:
- url: https://api.waylay.io
  description: Waylay enterprise gateway
x-visibility: public
externalDocs:
  url: /#/api/vault/
  description: Waylay Documentation
tags:
- name: Vault
paths:
  /configs/v1/secrets:
    get:
      tags:
      - Vault
      summary: List All Vault Secrets
      description: "Lists all available vault secret keys for authenticated user's\
        \ tenant.\nWhen providing the `values` query parameter as `true` the listing\
        \ will also contain the secrets content. \n"
      externalDocs:
        url: /#/api/vault/?id=listing-all-secrets
        description: Waylay Documentation
      operationId: getSecrets
      x-permissions:
      - vault:all:read
      parameters:
      - name: values
        in: query
        description: For including secrets values in the listing.
        required: false
        schema:
          type: boolean
          default: false
      responses:
        '200':
          $ref: '#/components/responses/Secrets'
      security: &id001
      - waylayApiKeySecret: []
  /configs/v1/secrets/{key}:
    get:
      tags:
      - Vault
      summary: Retrieve Secret
      description: 'Fetches vault secret content for specified secret key.

        '
      externalDocs:
        url: /#/api/vault/?id=retrieving-a-secret
        description: Waylay Documentation
      operationId: getSecret
      x-permissions:
      - vault:all:read
      parameters:
      - name: key
        in: path
        description: The unique identifier of the vault secret key.
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/SecretContent'
      security: *id001
    put:
      tags:
      - Vault
      summary: Create Or Update Secret
      description: 'Creating a secret requires the following:


        A `Content-Type` header to indicate what type of data is being stored


        A payload that is valid according to the MIME type


        A key, identified in the URL `https://api.waylay.io/configs/v1/secrets/<key>`


        Vault supports the following MIME types:

        | Text             | Structured          | Binary                             |

        | ---------------- | --------------------| -----------------------------------|

        | `text/*`         | `application/json`  | `application/octet-stream`         |

        | `*/*+text`       | `*/*+json`          |                                    |

        | `*/*+xml`        |                     |                                    |


        Any other unrecognized MIME type is stored as a binary buffer, and will be
        returned as such.

        '
      externalDocs:
        url: /#/api/vault/?id=creating-updating-a-secret
        description: Waylay Documentation
      operationId: addOrUpdateSecret
      x-permissions:
      - vault:all:read
      - vault:all:create
      - vault:all:update
      parameters:
      - name: key
        in: path
        description: The unique identifier of the vault secret key.
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              examples:
              - hello: world
          text/*:
            schema:
              type: string
              examples:
              - this is a test
          application/octet-stream:
            schema:
              type: string
              format: binary
          '*/*+xml':
            schema:
              type: string
              description: xml case
          '*/*':
            schema:
              type: string
              format: binary
              description: stored and returned with content type
      responses:
        '200':
          $ref: '#/components/responses/SecretKey'
      security: *id001
    delete:
      tags:
      - Vault
      summary: Remove Secret
      description: 'Removes a vault secret.

        '
      externalDocs:
        url: /#/api/vault/?id=removing-a-secret
        description: Waylay Documentation
      operationId: removeSecret
      x-permissions:
      - vault:all:delete
      parameters:
      - name: key
        in: path
        description: The unique identifier of the vault secret key.
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/SecretKey'
      security: *id001
components:
  schemas:
    Secret:
      type: object
      properties:
        key:
          type: string
          examples:
          - secret-key
        value:
          oneOf:
          - type: string
            examples:
            - This is the secret content
          - type: object
            additionalProperties: true
            examples:
            - hello: world
        type:
          type: string
          examples:
          - application/json
      required:
      - key
  responses:
    SecretKey:
      description: Vault Secret Key
      content:
        text/html:
          schema:
            type: string
            examples:
            - secret-key
    SecretContent:
      description: Vault Secret Content
      content:
        application/json:
          schema:
            type: object
            examples:
            - hello: world
        application/octet-stream:
          schema:
            type: string
            format: binary
        text/plain:
          schema:
            type: string
            examples:
            - this is a test
        text/html:
          schema:
            type: string
            examples:
            - <div>Some content</div>
        text/*:
          schema:
            type: string
        '*/*xml':
          schema:
            type: string
        '*.*':
          schema:
            type: string
            format: binary
    Secrets:
      description: Vault Secrets
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/Secret'
  securitySchemes:
    waylayApiKeySecret:
      type: http
      description: Waylay apiKey/apiSecret basic authentication. All endpoints support
        also Waylay JWT Bearer authentication.
      scheme: basic
