models
Api
ApiKey
ApiKeyList
ApiKeyMeta
Bases: BaseModel
Metadata about an api key.
Source code in unkey/models/keys.py
created_at
instance-attribute
The unix epoch representing when this key was created in milliseconds.
expires
instance-attribute
The optional unix epoch representing when this key expires in milliseconds.
meta
instance-attribute
The dynamic mapping of data used during key creation, if the key was found.
owner_id
instance-attribute
The owner of this api key if one was specified.
ratelimit
instance-attribute
The optional ratelimit associated with this key.
remaining
instance-attribute
The remaining verifications before this key is invalidated.
If None
, this field was not used in the keys creation and can
be ignored.
ApiKeyVerification
Bases: BaseModel
Data about whether this api key is valid.
Source code in unkey/models/keys.py
code
instance-attribute
The optional error code returned by the unkey api.
meta
instance-attribute
Dynamic mapping of data used during key creation, if the key was found.
owner_id
instance-attribute
The id of the owner for this key, if the key was found.
remaining
instance-attribute
The remaining verifications before this key is invalidated.
If None
, this field was not used in the keys creation and can
be ignored.
BaseEnum
Bases: Enum
The base enum all library enums inherit from.
Source code in unkey/models/base.py
from_str
classmethod
Generate this enum from the given value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
The value to generate from. |
required |
Returns:
Type | Description |
---|---|
T
|
The generated enum. |
Source code in unkey/models/base.py
from_str_maybe
classmethod
Attempt to generate this enum from the given value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
The value to generate from. |
required |
Returns:
Type | Description |
---|---|
t.Optional[T]
|
The generated enum or |
Source code in unkey/models/base.py
BaseModel
The base model all library models inherit from.
Source code in unkey/models/base.py
to_dict
Converts this class into a dictionary.
Returns:
Type | Description |
---|---|
t.Dict[str, t.Any]
|
The requested dictionary. |
HttpResponse
Bases: BaseModel
Directly represents a response from the api.
Could indicate either success or failure.
Source code in unkey/models/http.py
Ratelimit
Bases: BaseModel
Data representing a particular ratelimit.
Source code in unkey/models/keys.py
refill_rate
instance-attribute
How many tokens to refill during each refill interval.