create_keys

Example Usage

import os
import unkey
from unkey_py import Unkey

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

res = s.migrations.create_keys(request=[
    {
        "api_id": "api_123",
        "name": "my key",
        "start": "unkey_32kq",
        "owner_id": "team_123",
        "meta": {
            "billingTier": "PRO",
            "trialEnds": "2023-06-16T17:16:37.161Z",
        },
        "roles": [
            "admin",
            "finance",
        ],
        "permissions": [
            "domains.create_record",
            "say_hello",
        ],
        "expires": 1623869797161,
        "remaining": 1000,
        "refill": {
            "interval": unkey.V1MigrationsCreateKeysInterval.DAILY,
            "amount": 100,
        },
        "ratelimit": {
            "limit": 10,
            "refill_rate": 1,
            "refill_interval": 60,
            "type": unkey.V1MigrationsCreateKeysType.FAST,
        },
        "enabled": False,
    },
])

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

Parameters

ParameterTypeRequiredDescription
requestList[models.RequestBody]: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.V1MigrationsCreateKeysResponse

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

enqueue

Example Usage

import os
import unkey
from unkey_py import Unkey

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

res = s.migrations.enqueue(request={
    "migration_id": "<id>",
    "api_id": "<id>",
    "keys": [
        {
            "name": "my key",
            "start": "unkey_32kq",
            "owner_id": "team_123",
            "meta": {
                "billingTier": "PRO",
                "trialEnds": "2023-06-16T17:16:37.161Z",
            },
            "roles": [
                "admin",
                "finance",
            ],
            "permissions": [
                "domains.create_record",
                "say_hello",
            ],
            "expires": 1623869797161,
            "remaining": 1000,
            "refill": {
                "interval": unkey.V1MigrationsEnqueueKeysInterval.DAILY,
                "amount": 100,
            },
            "ratelimit": {
                "limit": 10,
                "duration": 60000,
                "type": unkey.V1MigrationsEnqueueKeysType.FAST,
            },
            "enabled": False,
        },
    ],
})

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

Parameters

ParameterTypeRequiredDescription
requestmodels.V1MigrationsEnqueueKeysRequestBody: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.V1MigrationsEnqueueKeysResponse

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