{
  "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": [
    {
      "authorization": [],
      "appId": []
    }
  ],
  "paths": {
    "/repos/{platform}/{org}/{repo}/secrets/{secretName}": {
      "put": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "updateRepoSecrets",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "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": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/orgs/{platform}/{org}/secrets/{secretName}": {
      "put": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "updateOrgSecrets",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SecretResponseDto"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "deleteOrgSecret",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "secretName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/repos/{platform}/{org}/{repo}/secrets": {
      "get": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "getRepoSecrets",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponseDetailedSecretResponseDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Repo Secret"
        ],
        "operationId": "addRepoSecrets",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "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": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponseDetailedSecretResponseDto"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Org Secret"
        ],
        "operationId": "addOrgSecret",
        "parameters": [
          {
            "name": "platform",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "description": "SCM access token"
          },
          {
            "name": "mend-appId",
            "in": "header",
            "description": "(Optional) Id of your Mend application"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SecretRequestDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/SecretResponseDto"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SecretRequestDto": {
        "type": "object",
        "properties": {
          "secretName": {
            "type": "string"
          },
          "secretValue": {
            "type": "string"
          },
          "envVar": {
            "type": "boolean"
          }
        }
      },
      "SecretResponseDto": {
        "type": "object",
        "properties": {
          "secretName": {
            "type": "string"
          },
          "envVar": {
            "type": "boolean"
          },
          "rotatingTokenStatus": {
            "type": "string",
            "enum": [
              "invalid",
              "insufficient"
            ]
          }
        }
      },
      "DetailedSecretResponseDto": {
        "type": "object",
        "properties": {
          "secretName": {
            "type": "string"
          },
          "envVar": {
            "type": "boolean"
          },
          "rotatingTokenStatus": {
            "type": "string",
            "enum": [
              "invalid",
              "insufficient"
            ]
          },
          "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": {
      "authorization": {
        "type": "apiKey",
        "description": "SCM access token (e.g. GitHub token)",
        "name": "Authorization",
        "in": "header"
      },
      "appId": {
        "type": "apiKey",
        "description": "Id of your Mend application",
        "name": "mend-appId",
        "in": "header"
      }
    }
  }
}