{
  "asyncapi": "3.0.0",
  "info": {
    "title": "core/api-keys",
    "version": ""
  },
  "channels": {
    "systemEventsApiKeys": {
      "address": "system-events.api-keys",
      "messages": {
        "coreApiKeyCreated": {
          "$ref": "#/components/messages/api-keys.coreApiKeyCreated"
        },
        "coreApiKeyDeleted": {
          "$ref": "#/components/messages/api-keys.coreApiKeyDeleted"
        },
        "coreApiKeyUpdated": {
          "$ref": "#/components/messages/api-keys.coreApiKeyUpdated"
        },
        "coreApiKeyValidationFailed": {
          "$ref": "#/components/messages/api-keys.coreApiKeyValidationFailed"
        }
      }
    }
  },
  "operations": {
    "coreApiKeyCreated": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsApiKeys"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsApiKeys/messages/coreApiKeyCreated"
        }
      ]
    },
    "coreApiKeyDeleted": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsApiKeys"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsApiKeys/messages/coreApiKeyDeleted"
        }
      ]
    },
    "coreApiKeyUpdated": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsApiKeys"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsApiKeys/messages/coreApiKeyUpdated"
        }
      ]
    },
    "coreApiKeyValidationFailed": {
      "action": "send",
      "channel": {
        "$ref": "#/channels/systemEventsApiKeys"
      },
      "messages": [
        {
          "$ref": "#/channels/systemEventsApiKeys/messages/coreApiKeyValidationFailed"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "api-keys.coreApiKeyCreated": {
        "name": "com.qlik.core.api-key.created",
        "title": "API key created",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "properties": {
                "data": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/dataPayload"
                    },
                    {
                      "type": "object",
                      "required": [
                        "expiry"
                      ],
                      "properties": {
                        "expiry": {
                          "type": "string",
                          "examples": [
                            "2025-11-08T20:43:24.130Z"
                          ],
                          "description": "API key expiry date."
                        }
                      }
                    }
                  ],
                  "examples": [],
                  "description": "Details of the created API key."
                },
                "type": {
                  "type": "string",
                  "default": "com.qlik.core.api-key.created",
                  "description": "Identifies the type of event related to the originating occurrence."
                }
              }
            }
          ]
        },
        "description": "Published when an API key is created.",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      },
      "api-keys.coreApiKeyDeleted": {
        "name": "com.qlik.core.api-key.deleted",
        "title": "API key deleted",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "properties": {
                "data": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/dataPayload"
                    },
                    {
                      "type": "object",
                      "required": [
                        "status",
                        "expiry"
                      ],
                      "properties": {
                        "expiry": {
                          "type": "string",
                          "examples": [
                            "2025-11-08T20:43:24.130Z"
                          ],
                          "description": "API key expiry date."
                        },
                        "status": {
                          "type": "string",
                          "examples": [
                            "deleted",
                            "revoked"
                          ],
                          "description": "Status of the API key. Set to `deleted` when triggered by the owner, or `revoked` when triggered by a tenant admin."
                        }
                      }
                    }
                  ],
                  "examples": [],
                  "description": "Details of the deleted API key."
                },
                "type": {
                  "type": "string",
                  "default": "com.qlik.core.api-key.deleted",
                  "description": "Identifies the type of event related to the originating occurrence."
                }
              }
            }
          ]
        },
        "description": "Published when an API key is deleted.",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      },
      "api-keys.coreApiKeyUpdated": {
        "name": "com.qlik.core.api-key.updated",
        "title": "API key updated",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "properties": {
                "data": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/dataPayload"
                    },
                    {
                      "type": "object",
                      "required": [
                        "expiry"
                      ],
                      "properties": {
                        "expiry": {
                          "type": "string",
                          "examples": [
                            "2025-11-08T20:43:24.130Z"
                          ],
                          "description": "API key expiry date."
                        }
                      }
                    }
                  ],
                  "examples": [],
                  "description": "Details of the updated API key."
                },
                "type": {
                  "type": "string",
                  "default": "com.qlik.core.api-key.updated",
                  "description": "Identifies the type of event related to the originating occurrence."
                }
              }
            }
          ]
        },
        "description": "Published when an API key is updated.",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      },
      "api-keys.coreApiKeyValidationFailed": {
        "name": "com.qlik.core.api-key.validation.failed",
        "title": "API key validation failed",
        "payload": {
          "type": "object",
          "allOf": [
            {
              "$ref": "#/components/schemas/cloudEventsContextAttributes"
            },
            {
              "$ref": "#/components/schemas/cloudEventsQlikExtensionsAttributes"
            },
            {
              "type": "object",
              "properties": {
                "data": {
                  "type": "object",
                  "examples": [
                    {
                      "jti": "62eadf5a01f72ccd31f37041",
                      "code": "APIKEYS-18",
                      "idpId": "62eaddcce5ff30cabc6f67e8",
                      "subType": "externalClient",
                      "description": "The api key is either expired or revoked",
                      "createdByUser": "62eadf5a01f72ccd31f37041"
                    }
                  ],
                  "required": [
                    "jti",
                    "code",
                    "description",
                    "subType"
                  ],
                  "properties": {
                    "jti": {
                      "type": "string",
                      "examples": [
                        "62eadf5a01f72ccd31f37041"
                      ],
                      "description": "API key identifier (MongoDB ObjectId)."
                    },
                    "code": {
                      "type": "string",
                      "examples": [
                        "APIKEYS-18"
                      ],
                      "description": "Error code."
                    },
                    "idpId": {
                      "type": "string",
                      "examples": [
                        "62eaddcce5ff30cabc6f67e8"
                      ],
                      "description": "Identity provider identifier tied to the externalClient."
                    },
                    "subType": {
                      "type": "string",
                      "examples": [
                        "externalClient"
                      ],
                      "description": "API key subType."
                    },
                    "description": {
                      "type": "string",
                      "examples": [
                        "The api key is either expired or revoked"
                      ],
                      "description": "Error description."
                    },
                    "createdByUser": {
                      "type": "string",
                      "examples": [
                        "62eadf5a01f72ccd31f37041"
                      ],
                      "description": "Identifier of the user who created the key."
                    }
                  },
                  "description": "Details of the failed API key validation."
                },
                "type": {
                  "type": "string",
                  "default": "com.qlik.core.api-key.validation.failed",
                  "description": "Identifies the type of event related to the originating occurrence."
                },
                "toplevelresourceid": {
                  "type": "string",
                  "examples": [
                    "1fc531f9-1964-46d6-9267-256e707fac45"
                  ],
                  "description": "API key identifier."
                }
              }
            }
          ]
        },
        "description": "Published when API key validation fails. Only published for externalClient API keys.",
        "x-qlik-deprecated": false,
        "x-qlik-stability": "stable",
        "x-qlik-visibility": "public"
      }
    },
    "schemas": {
      "cloudEventsContextAttributes": {
        "type": "object",
        "required": [
          "id",
          "source",
          "specversion",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "A234-1234-1234"
            ],
            "minLength": 1,
            "description": "Identifies the event."
          },
          "time": {
            "type": "string",
            "format": "date-time",
            "examples": [
              "2023-01-01T12:00:00Z"
            ],
            "minLength": 1,
            "description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339."
          },
          "type": {
            "type": "string",
            "examples": [
              "com.qlik.core.api-key.created"
            ],
            "minLength": 1,
            "description": "Describes the type of event related to the originating occurrence."
          },
          "source": {
            "type": "string",
            "format": "uri-reference",
            "examples": [
              "com.qlik/my-service"
            ],
            "minLength": 1,
            "description": "Identifies the context in which an event happened."
          },
          "specversion": {
            "type": "string",
            "examples": [
              "1.0.2"
            ],
            "minLength": 1,
            "description": "The version of the CloudEvents specification which the event uses."
          },
          "datacontenttype": {
            "type": "string",
            "default": "application/json",
            "examples": [
              "application/json"
            ],
            "minLength": 1,
            "description": "Content type of the data value. Must adhere to RFC 2046 format."
          }
        },
        "description": "CloudEvents Specification JSON Schema"
      },
      "cloudEventsQlikExtensionsAttributes": {
        "type": "object",
        "required": [
          "tenantid"
        ],
        "properties": {
          "userid": {
            "type": "string",
            "examples": [
              "VZhiEfgW2bLd7HgR-jjzAh6VnicipweT"
            ],
            "description": "Unique identifier for the user triggering the event."
          },
          "authtype": {
            "type": "string",
            "examples": [
              "api-keys"
            ],
            "description": "Representing the type of principal that triggered the occurrence."
          },
          "originip": {
            "type": "string",
            "examples": [
              "0.0.0.0"
            ],
            "description": "Origin IP address."
          },
          "tenantid": {
            "type": "string",
            "examples": [
              "Rn8kQvY2wZ4pL7mX1jB6tC3dS5fH0gJ9"
            ],
            "description": "Unique identifier for the tenant related to the event."
          },
          "sessionid": {
            "type": "string",
            "examples": [
              "9fBc2dE4gH6jK8mN0pQ2rS4tV6wX8yZ0"
            ],
            "description": "Unique identifier for the session related to the event."
          },
          "authclaims": {
            "type": "string",
            "examples": [
              "{\"sub\":\"VZhiEfgW2bLd7HgR-jjzAh6VnicipweT\",\"tenantId\":\"VZhiEfgW2bLd7HgR-jjzAh6VnicipweT\"}"
            ],
            "description": "A JSON string representing claims of the principal that triggered the event."
          }
        }
      },
      "dataPayload": {
        "type": "object",
        "required": [
          "id",
          "description",
          "sub",
          "subType"
        ],
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "1fc531f9-1964-46d6-9267-256e707fac45"
            ],
            "description": "API key identifier."
          },
          "sub": {
            "type": "string",
            "examples": [
              "62eadf5a01f72ccd31f37041"
            ],
            "description": "Subject identifier."
          },
          "subType": {
            "type": "string",
            "examples": [
              "user"
            ],
            "description": "Subject type."
          },
          "description": {
            "type": "string",
            "examples": [
              "description text for the key"
            ],
            "description": "API key description."
          }
        }
      }
    }
  }
}