create

Example Usage

import os
from unkey_py import Unkey

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

res = s.identities.create(request={
    "external_id": "user_123",
    "ratelimits": [
        {
            "name": "tokens",
            "limit": 10,
            "duration": 1000,
        },
        {
            "name": "tokens",
            "limit": 10,
            "duration": 1000,
        },
    ],
})

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

Parameters

ParameterTypeRequiredDescription
requestmodels.CreateIdentityRequestBody: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.CreateIdentityResponse

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*/*

get

Example Usage

import os
from unkey_py import Unkey

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

res = s.identities.get(identity_id="id_1234", external_id="id_1234")

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

Parameters

ParameterTypeRequiredDescriptionExample
identity_idOptional[str]:heavy_minus_sign:N/Aid_1234
external_idOptional[str]:heavy_minus_sign:N/Aid_1234
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.GetIdentityResponse

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*/*

list

Example Usage

import os
from unkey_py import Unkey

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

res = s.identities.list(limit=100)

if res.object is not None:
    while True:
        # handle items

        res = res.next()
        if res is None:
            break

Parameters

ParameterTypeRequiredDescriptionExample
environmentOptional[str]:heavy_minus_sign:N/A
limitOptional[int]:heavy_minus_sign:N/A100
cursorOptional[str]:heavy_minus_sign:N/A
retriesOptional[utils.RetryConfig]:heavy_minus_sign:Configuration to override the default retry behavior of the client.

Response

models.ListIdentitiesResponse

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*/*

update

Example Usage

import os
from unkey_py import Unkey

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

res = s.identities.update(request={
    "identity_id": "id_1234",
    "external_id": "user_1234",
    "ratelimits": [
        {
            "name": "tokens",
            "limit": 10,
            "duration": 1000,
        },
        {
            "name": "tokens",
            "limit": 10,
            "duration": 1000,
        },
        {
            "name": "tokens",
            "limit": 10,
            "duration": 1000,
        },
    ],
})

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

Parameters

ParameterTypeRequiredDescription
requestmodels.UpdateIdentityRequestBody: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.UpdateIdentityResponse

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*/*

delete

Example Usage

import os
from unkey_py import Unkey

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

res = s.identities.delete(request={
    "identity_id": "id_1234",
})

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

Parameters

ParameterTypeRequiredDescription
requestmodels.DeleteIdentityRequestBody: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.DeleteIdentityResponse

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*/*