limit

Example Usage

import os
from unkey_py import Unkey

s = Unkey(
    bearer_auth=os.getenv("UNKEY_BEARER_AUTH", ""),
)

res = s.ratelimits.limit(request={
    "identifier": "user_123",
    "limit": 10,
    "duration": 60000,
    "namespace": "email.outbound",
    "cost": 2,
    "resources": [
        {
            "type": "organization",
            "id": "org_123",
            "name": "unkey",
        },
    ],
})

if res.object is not None:
    # handle response
    pass

Parameters

ParameterTypeRequiredDescription
requestmodels.LimitRequestBody:heavy_check_mark:The request object to use for the request.
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.LimitResponse

Errors

Error TypeStatus CodeContent Type
models.ErrBadRequest400application/json
models.ErrUnauthorized401application/json
models.ErrForbidden403application/json
models.ErrNotFound404application/json
models.ErrConflict409application/json
models.ErrTooManyRequests429application/json
models.ErrInternalServerError500application/json
models.SDKError4XX, 5XX*/*