{
  "swagger": "2.0",
  "info": {
    "title": "Permission service",
    "version": "0.1507.0",
    "description": "Send your API key as a bearer token: `Authorization: Bearer <api key>`."
  },
  "tags": [
    {
      "name": "PermissionService",
      "x-displayName": "Permission service",
      "description": "The PermissionService provides an interface for checking permissions for a user, where a permission is an action that is performed on a resource."
    }
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/authorization/permissions/v1/check": {
      "post": {
        "operationId": "PermissionService_CheckPermissions",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/CheckPermissionsResponse"
            },
            "x-example": {
              "responses": [
                {
                  "isAuthorized": true,
                  "requestedPermission": {
                    "action": "<action>",
                    "resource": "<resource>"
                  }
                }
              ]
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/CheckPermissionsRequest"
            },
            "x-example": {
              "requests": [
                {
                  "action": "<action>",
                  "resource": "<resource>"
                }
              ]
            }
          }
        ],
        "tags": [
          "PermissionService"
        ],
        "summary": "Check permissions",
        "description": "Checks a list of permissions for the calling user and returns results in the same order."
      }
    }
  },
  "definitions": {
    "CheckPermissionRequest": {
      "type": "object",
      "properties": {
        "action": {
          "type": "string"
        },
        "resource": {
          "type": "string",
          "pattern": "^ri\\.[a-z][a-z0-9\\-]*\\.([a-z0-9][a-z0-9\\-]*)?\\.[a-z][a-z0-9\\-]*\\.[a-zA-Z0-9\\-\\._]+$",
          "x-constraints": [
            "Matches `^ri\\.[a-z][a-z0-9\\-]*\\.([a-z0-9][a-z0-9\\-]*)?\\.[a-z][a-z0-9\\-]*\\.[a-zA-Z0-9\\-\\._]+$`."
          ]
        }
      },
      "description": "A permission is the declaration of an action that can be performed on a resource.",
      "required": [
        "action",
        "resource"
      ]
    },
    "CheckPermissionResponse": {
      "type": "object",
      "properties": {
        "isAuthorized": {
          "type": "boolean"
        },
        "requestedPermission": {
          "$ref": "#/definitions/CheckPermissionRequest"
        }
      },
      "required": [
        "requestedPermission"
      ]
    },
    "CheckPermissionsRequest": {
      "type": "object",
      "properties": {
        "requests": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/CheckPermissionRequest"
          }
        }
      },
      "example": {
        "requests": [
          {
            "action": "<action>",
            "resource": "<resource>"
          }
        ]
      }
    },
    "CheckPermissionsResponse": {
      "type": "object",
      "properties": {
        "responses": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/CheckPermissionResponse"
          }
        }
      }
    }
  },
  "securityDefinitions": {
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Your API key as a bearer token: `Authorization: Bearer <api key>`."
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}
