{
  "components": {
    "schemas": {
      "V0EventsRequestBody": {
        "type": "string",
        "description": "NDJSON payload of events"
      },
      "V0EventsResponseBody": {
        "type": "object",
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V0EventsResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "successful_rows": {
            "type": "integer",
            "description": "The number of rows that were successfully processed"
          },
          "quarantined_rows": {
            "type": "integer",
            "description": "The number of rows that were quarantined"
          }
        },
        "required": [
          "successful_rows",
          "quarantined_rows"
        ]
      },
      "Encrypted": {
        "additionalProperties": false,
        "properties": {
          "encrypted": {
            "type": "string"
          },
          "keyId": {
            "type": "string"
          }
        },
        "required": [
          "encrypted",
          "keyId"
        ],
        "type": "object"
      },
      "ValidationErrorDetail": {
        "additionalProperties": false,
        "properties": {
          "location": {
            "description": "Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'",
            "type": "string"
          },
          "message": {
            "description": "Error message text",
            "type": "string"
          },
          "fix": {
            "description": "A human-readable message describing how to fix the error.",
            "type": "string"
          }
        },
        "type": "object",
        "required": [
          "message",
          "location"
        ]
      },
      "ValidationError": {
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "description": "A unique id for this request. Please always provide this to support.",
            "example": "req_123",
            "type": "string"
          },
          "detail": {
            "description": "A human-readable explanation specific to this occurrence of the problem.",
            "example": "Property foo is required but is missing.",
            "type": "string"
          },
          "errors": {
            "description": "Optional list of individual error details",
            "items": {
              "$ref": "#/components/schemas/ValidationErrorDetail"
            },
            "type": [
              "array"
            ]
          },
          "instance": {
            "description": "A URI reference that identifies the specific occurrence of the problem.",
            "example": "https://example.com/error-log/abc123",
            "format": "uri",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code",
            "example": 400,
            "format": "int",
            "type": "integer"
          },
          "title": {
            "description": "A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",
            "example": "Bad Request",
            "type": "string"
          },
          "type": {
            "default": "about:blank",
            "description": "A URI reference to human-readable documentation for the error.",
            "example": "https://example.com/errors/example",
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object",
        "required": [
          "requestId",
          "detail",
          "instance",
          "status",
          "title",
          "type",
          "errors"
        ]
      },
      "BaseError": {
        "additionalProperties": false,
        "properties": {
          "requestId": {
            "description": "A unique id for this request. Please always provide this to support.",
            "example": "req_123",
            "type": "string"
          },
          "detail": {
            "description": "A human-readable explanation specific to this occurrence of the problem.",
            "example": "Property foo is required but is missing.",
            "type": "string"
          },
          "instance": {
            "description": "A URI reference that identifies the specific occurrence of the problem.",
            "example": "https://example.com/error-log/abc123",
            "format": "uri",
            "type": "string"
          },
          "status": {
            "description": "HTTP status code",
            "example": 400,
            "format": "int",
            "type": "integer"
          },
          "title": {
            "description": "A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",
            "example": "Bad Request",
            "type": "string"
          },
          "type": {
            "default": "about:blank",
            "description": "A URI reference to human-readable documentation for the error.",
            "example": "https://example.com/errors/example",
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object",
        "required": [
          "requestId",
          "detail",
          "instance",
          "status",
          "title",
          "type",
          "errors"
        ]
      },
      "Item": {
        "additionalProperties": false,
        "properties": {
          "cost": {
            "default": 1,
            "description": "The cost of the request.",
            "format": "int64",
            "type": "integer"
          },
          "duration": {
            "description": "The duration in milliseconds for the rate limit window.",
            "format": "int64",
            "type": "integer"
          },
          "identifier": {
            "description": "The identifier for the rate limit.",
            "type": "string"
          },
          "limit": {
            "description": "The maximum number of requests allowed.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "identifier",
          "limit",
          "duration"
        ],
        "type": "object"
      },
      "Lease": {
        "additionalProperties": false,
        "properties": {
          "cost": {
            "description": "How much to lease.",
            "format": "int64",
            "type": "integer"
          },
          "timeout": {
            "description": "The time in milliseconds when the lease will expire. If you do not commit the lease by this time, it will be commited as is.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "cost",
          "timeout"
        ],
        "type": "object"
      },
      "SingleRatelimitResponse": {
        "additionalProperties": false,
        "properties": {
          "current": {
            "description": "The current number of requests made in the current window.",
            "format": "int64",
            "type": "integer"
          },
          "limit": {
            "description": "The maximum number of requests allowed.",
            "format": "int64",
            "type": "integer"
          },
          "remaining": {
            "description": "The number of requests remaining in the current window.",
            "format": "int64",
            "type": "integer"
          },
          "reset": {
            "description": "The time in milliseconds when the rate limit will reset.",
            "format": "int64",
            "type": "integer"
          },
          "success": {
            "description": "Whether the request passed the ratelimit. If false, the request must be blocked.",
            "type": "boolean"
          }
        },
        "required": [
          "limit",
          "remaining",
          "reset",
          "success",
          "current"
        ],
        "type": "object"
      },
      "V1DecryptRequestBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1DecryptRequestBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "encrypted": {
            "description": "The encrypted base64 string.",
            "minLength": 1,
            "type": "string"
          },
          "keyring": {
            "description": "The keyring to use for encryption.",
            "type": "string"
          }
        },
        "required": [
          "keyring",
          "encrypted"
        ],
        "type": "object"
      },
      "V1DecryptResponseBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1DecryptResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "plaintext": {
            "description": "The plaintext value.",
            "type": "string"
          }
        },
        "required": [
          "plaintext"
        ],
        "type": "object"
      },
      "V1EncryptBulkRequestBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1EncryptBulkRequestBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "data": {
            "items": {
              "type": "string"
            },
            "maxItems": 1000,
            "minItems": 1,
            "type": [
              "array"
            ]
          },
          "keyring": {
            "type": "string"
          }
        },
        "required": [
          "keyring",
          "data"
        ],
        "type": "object"
      },
      "V1EncryptBulkResponseBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1EncryptBulkResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "encrypted": {
            "items": {
              "$ref": "#/components/schemas/Encrypted"
            },
            "type": [
              "array"
            ]
          }
        },
        "required": [
          "encrypted"
        ],
        "type": "object"
      },
      "V1EncryptRequestBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1EncryptRequestBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "data": {
            "description": "The data to encrypt.",
            "minLength": 1,
            "type": "string"
          },
          "keyring": {
            "description": "The keyring to use for encryption.",
            "type": "string"
          }
        },
        "required": [
          "keyring",
          "data"
        ],
        "type": "object"
      },
      "V1EncryptResponseBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1EncryptResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "encrypted": {
            "description": "The encrypted data as base64 encoded string.",
            "type": "string"
          },
          "keyId": {
            "description": "The ID of the key used for encryption.",
            "type": "string"
          }
        },
        "required": [
          "encrypted",
          "keyId"
        ],
        "type": "object"
      },
      "V1LivenessResponseBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1LivenessResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "message": {
            "description": "Whether we're alive or not",
            "example": "OK",
            "type": "string"
          }
        },
        "required": [
          "message"
        ],
        "type": "object"
      },
      "V1RatelimitCommitLeaseRequestBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1RatelimitCommitLeaseRequestBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "cost": {
            "description": "The actual cost of the request.",
            "format": "int64",
            "type": "integer"
          },
          "lease": {
            "description": "The lease you received from the ratelimit response.",
            "type": "string"
          }
        },
        "required": [
          "lease",
          "cost"
        ],
        "type": "object"
      },
      "V1RatelimitMultiRatelimitRequestBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1RatelimitMultiRatelimitRequestBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "ratelimits": {
            "description": "The rate limits to check.",
            "items": {
              "$ref": "#/components/schemas/Item"
            },
            "type": [
              "array"
            ]
          }
        },
        "required": [
          "ratelimits"
        ],
        "type": "object"
      },
      "V1RatelimitMultiRatelimitResponseBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1RatelimitMultiRatelimitResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "ratelimits": {
            "description": "The rate limits that were checked.",
            "items": {
              "$ref": "#/components/schemas/SingleRatelimitResponse"
            },
            "type": [
              "array"
            ]
          }
        },
        "required": [
          "ratelimits"
        ],
        "type": "object"
      },
      "V1RatelimitRatelimitRequestBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1RatelimitRatelimitRequestBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "cost": {
            "description": "The cost of the request. Defaults to 1 if not provided.",
            "format": "int64",
            "type": "integer",
            "default": 1
          },
          "duration": {
            "description": "The duration in milliseconds for the rate limit window.",
            "format": "int64",
            "type": "integer"
          },
          "identifier": {
            "description": "The identifier for the rate limit.",
            "type": "string"
          },
          "lease": {
            "$ref": "#/components/schemas/Lease",
            "description": "Reserve an amount of tokens with the option to commit and update later."
          },
          "limit": {
            "description": "The maximum number of requests allowed.",
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "identifier",
          "limit",
          "duration"
        ],
        "type": "object"
      },
      "V1RatelimitRatelimitResponseBody": {
        "additionalProperties": false,
        "properties": {
          "$schema": {
            "description": "A URL to the JSON Schema for this object.",
            "example": "https://api.unkey.dev/schemas/V1RatelimitRatelimitResponseBody.json",
            "format": "uri",
            "readOnly": true,
            "type": "string"
          },
          "current": {
            "description": "The current number of requests made in the current window.",
            "format": "int64",
            "type": "integer"
          },
          "lease": {
            "description": "The lease to use when committing the request.",
            "type": [
              "string"
            ]
          },
          "limit": {
            "description": "The maximum number of requests allowed.",
            "format": "int64",
            "type": "integer"
          },
          "remaining": {
            "description": "The number of requests remaining in the current window.",
            "format": "int64",
            "type": "integer"
          },
          "reset": {
            "description": "The time in milliseconds when the rate limit will reset.",
            "format": "int64",
            "type": "integer"
          },
          "success": {
            "description": "Whether the request passed the ratelimit. If false, the request must be blocked.",
            "type": "boolean"
          }
        },
        "required": [
          "limit",
          "remaining",
          "reset",
          "success",
          "current",
          "lease"
        ],
        "type": "object"
      }
    }
  },
  "info": {
    "title": "Unkey API",
    "version": "1.0.0"
  },
  "openapi": "3.0.0",
  "paths": {
    "/v0/events": {
      "post": {
        "operationId": "v0.events.create",
        "summary": "Create events",
        "description": "Accept NDJSON payload of events and process them",
        "requestBody": {
          "content": {
            "application/x-ndjson": {
              "schema": {
                "$ref": "#/components/schemas/V0EventsRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V0EventsResponseBody"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "events"
        ]
      }
    },
    "/ratelimit.v1.RatelimitService/MultiRatelimit": {
      "post": {
        "operationId": "ratelimit.v1.multiRatelimit",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RatelimitMultiRatelimitRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RatelimitMultiRatelimitResponseBody"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "ratelimit"
        ]
      }
    },
    "/ratelimit.v1.RatelimitService/Ratelimit": {
      "post": {
        "operationId": "ratelimit.v1.ratelimit",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RatelimitRatelimitRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1RatelimitRatelimitResponseBody"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "ratelimit"
        ]
      }
    },
    "/v1/liveness": {
      "get": {
        "description": "This endpoint checks if the service is alive.",
        "operationId": "liveness",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1LivenessResponseBody"
                }
              }
            },
            "description": "OK"
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Internal Server Error"
          }
        },
        "summary": "Liveness check",
        "tags": [
          "liveness"
        ]
      }
    },
    "/v1/ratelimit.commitLease": {
      "post": {
        "operationId": "v1.ratelimit.commitLease",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1RatelimitCommitLeaseRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "ratelimit"
        ]
      }
    },
    "/vault.v1.VaultService/Decrypt": {
      "post": {
        "operationId": "vault.v1.decrypt",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1DecryptRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1DecryptResponseBody"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "vault"
        ]
      }
    },
    "/vault.v1.VaultService/Encrypt": {
      "post": {
        "operationId": "vault.v1.encrypt",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1EncryptRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1EncryptResponseBody"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "vault"
        ]
      }
    },
    "/vault.v1.VaultService/EncryptBulk": {
      "post": {
        "operationId": "vault.v1.encryptBulk",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1EncryptBulkRequestBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1EncryptBulkResponseBody"
                }
              }
            },
            "description": "OK"
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationError"
                }
              }
            }
          },
          "500": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BaseError"
                }
              }
            },
            "description": "Error"
          }
        },
        "tags": [
          "vault"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://api.unkey.dev"
    },
    {
      "url": "http://localhost"
    }
  ]
}