Delete

Delete Key Fn

Delete a key from the key management system.

Parameters::

  • keys (List[str]): A list of keys or hashed keys to delete. Example {"keys": ["sk-QWrxEynunsNpV1zT48HIrw", "837e17519f44683334df5291321d97b8bf1098cd490e49e215f6fea935aa28be"]}
  • key_aliases (List[str]): A list of key aliases to delete. Can be passed instead of keys.Example {"key_aliases": ["alias1", "alias2"]}

Returns:

  • deleted_keys (List[str]): A list of deleted keys. Example {"deleted_keys": ["sk-QWrxEynunsNpV1zT48HIrw", "837e17519f44683334df5291321d97b8bf1098cd490e49e215f6fea935aa28be"]}

Example:

curl --location 'http://0.0.0.0:4000/key/delete'     --header 'Authorization: Bearer sk-1234'     --header 'Content-Type: application/json'     --data '{
    "keys": ["sk-QWrxEynunsNpV1zT48HIrw"]
}'

Raises: HTTPException: If an error occurs during key deletion.

POST/key/delete
Authorization
Header parameters
Body
keysKeys
key_aliasesKey Aliases
Response

Successful Response

Body
any
Request
const response = await fetch('/key/delete', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "detail": [
    {
      "loc": [
        "text"
      ],
      "msg": "text",
      "type": "text"
    }
  ]
}