{
  "openapi": "3.0.1",
  "info": {
    "title": "Developer Platform API",
    "description": "Mend's Developer Platform API 1.0 features: \n+ Access via GitHub tokens. \n+ Automation of Credentials for GitHub. \n+ New standard API documentation for easy navigation and search.",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://developer-api.mend.io/api/v1",
      "description": "US Environment"
    },
    {
      "url": "https://developer-eu-api.mend.io/api/v1",
      "description": "EU Environment"
    }
  ],
  "security": [
    {
      "bearer-key": []
    }
  ],
  "tags": [
    {
      "name": "Repo Secret"
    },
    {
      "name": "Org Secret"
    }
  ],
  "paths": {
    "/repos/{platform}/{org}/{repo}/secrets/{secretName}": {
      "put": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "updateRepoSecrets",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "GitHub Repo Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SecretResponseDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "deleteRepoSecret",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "GitHub Repo Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretResponseDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orgs/{platform}/{org}/secrets/{secretName}": {
      "put": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "updateOrgSecrets",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretRequestDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SecretResponseDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "deleteOrgSecret",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretResponseDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/repos/{platform}/{org}/{repo}/secrets": {
      "get": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "getRepoSecrets",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "auth",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/AuthModel"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "GitHub Repo Name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponseDetailedSecretResponseDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "addRepoSecrets",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "description": "GitHub Repo Name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SecretResponseDto"
                }
              }
            }
          }
        }
      }
    },
    "/orgs/{platform}/{org}/secrets": {
      "get": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "getOrgSecrets",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "auth",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/AuthModel"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponseDetailedSecretResponseDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "addOrgSecret",
        "parameters": [
          {
            "name": "mend-appId",
            "required": true,
            "in": "header",
            "description": "GitHub appId is '1'",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Authorization",
            "required": true,
            "in": "header",
            "description": "SCM_TOKEN (GitHub token)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "description": "github",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "description": "GitHub Org Name",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SecretResponseDto"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthModel": {
        "type": "object",
        "properties": {
          "mend-appId": {
            "type": "integer",
            "format": "int32"
          },
          "token": {
            "type": "string"
          }
        }
      },
      "MendScmApp": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "externalId": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "other",
              "github",
              "gitlab",
              "bitbucket",
              "azdo"
            ]
          },
          "endpoint": {
            "type": "string"
          },
          "endpointId": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string"
          },
          "clientId": {
            "type": "string"
          },
          "clientSecret": {
            "type": "string"
          },
          "clientIdRw": {
            "type": "string"
          },
          "clientSecretRw": {
            "type": "string"
          },
          "webhookSecret": {
            "type": "string"
          },
          "ownerName": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "forkAuthor": {
            "type": "string"
          },
          "forkToken": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "botUserId": {
            "type": "string"
          },
          "botUserName": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "descriptor": {
            "$ref": "#/components/schemas/ScmAppDescriptorDto"
          },
          "loginSlugId": {
            "type": "string"
          },
          "public": {
            "type": "boolean"
          }
        }
      },
      "ScmAppDescriptorDto": {
        "type": "object"
      },
      "UserAccountEntity": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "enabled": {
            "type": "boolean"
          },
          "endpointId": {
            "type": "string",
            "format": "uuid"
          },
          "externalId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "avatarUrl": {
            "type": "string"
          },
          "externalUrl": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "OWNER",
              "ADMIN",
              "SUPPORT",
              "USER"
            ]
          },
          "externalData": {
            "type": "object"
          },
          "lastEventAt": {
            "type": "string",
            "format": "date-time"
          },
          "addedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "tosConsentAt": {
            "type": "string",
            "format": "date-time"
          },
          "extraData": {
            "type": "object"
          },
          "countryName": {
            "type": "string"
          },
          "ipAddress": {
            "type": "string"
          }
        }
      },
      "SecretRequestDto": {
        "type": "object",
        "properties": {
          "secretName": {
            "type": "string"
          },
          "secretValue": {
            "type": "string"
          },
          "envVar": {
            "type": "boolean"
          }
        }
      },
      "SecretResponseDto": {
        "type": "object",
        "properties": {
          "secretName": {
            "type": "string"
          },
          "envVar": {
            "type": "boolean"
          }
        }
      },
      "DetailedSecretResponseDto": {
        "type": "object",
        "properties": {
          "secretName": {
            "type": "string"
          },
          "envVar": {
            "type": "boolean"
          },
          "addedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ListResponseDetailedSecretResponseDto": {
        "type": "object",
        "properties": {
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DetailedSecretResponseDto"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearer-key": {
        "type": "apiKey",
        "description": "JWT",
        "name": "Authorization",
        "in": "header"
      }
    }
  }
}