Skip to content

Latest commit

 

History

History
110 lines (83 loc) · 5.52 KB

README.md

File metadata and controls

110 lines (83 loc) · 5.52 KB

Ratelimits

(ratelimits)

Overview

Available Operations

limit

Example Usage

from unkey_py import Unkey

with Unkey(
    bearer_auth="UNKEY_ROOT_KEY",
) as s:
    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

Parameter Type Required Description
request models.LimitRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.LimitResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*

delete_override

Example Usage

from unkey_py import Unkey

with Unkey(
    bearer_auth="UNKEY_ROOT_KEY",
) as s:
    res = s.ratelimits.delete_override(request={
        "identifier": "user_123",
        "namespace_id": "rlns_1234",
        "namespace_name": "email.outbound",
    })

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

Parameters

Parameter Type Required Description
request models.DeleteOverrideRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeleteOverrideResponse

Errors

Error Type Status Code Content Type
models.ErrBadRequest 400 application/json
models.ErrUnauthorized 401 application/json
models.ErrForbidden 403 application/json
models.ErrNotFound 404 application/json
models.ErrConflict 409 application/json
models.ErrTooManyRequests 429 application/json
models.ErrInternalServerError 500 application/json
models.SDKError 4XX, 5XX */*