Available via the apis property of the Client.

See the full docs on the KeyService.

Get api

Gets an api with the given ID.

result = await client.apis.get_api("api_123")

List keys

Retrieve a paginated list of api keys for a given api ID.

# Page through keys 10 at a time
exhausted = False
cursor = unkey.UNDEFINED # Must import unkey

while not exhausted:
    # Fetch the next 10 keys
    result = await client.apis.list_keys("api_123", limit=10, cursor=cursor)

    if result.is_ok:
        data = result.unwrap()

        if not data.cursor:
            # No cursor means no more keys exist after this page
            exhausted = True
            continue

        cursor = data.cursor
        print(data.keys)
        await asyncio.sleep(1) # Sleep 1 second, must import asyncio
    else:
        # Something went wrong
        print(result.unwrap_err())
        exhausted = True