Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content

0.3.0

Logo

0.3.0

Contents:

  • API
  • Models
  • Errors
  • Examples
Back to top
View this page

Cookie API¶

Official wrapper for the Cookie API.

⚙️ Installation¶

Python 3.10 or higher is required

pip install cookie-api

🔑 How to get an API key?¶

  1. Invite Cookie to your Discord server or to your Discord account

  2. Run /premium api

🚀 Example Usage¶

The API key can be passed as a parameter or set as the environment variable COOKIE_KEY. For more information, see to our documentation.

Sync Example¶

from cookie import CookieAPI

api = CookieAPI(api_key="[YOUR_API_KEY]")

user_stats = api.get_user_stats(123456789)  # Replace with user ID

Async Example¶

import asyncio
from cookie import AsyncCookieAPI

api = AsyncCookieAPI(api_key="[YOUR_API_KEY]")

async def main():
    user_stats = await api.get_user_stats(123456789)  # Replace with user ID
    await api.close()

asyncio.run(main())

You can also use an asynchronous context manager (recommended)

async def main():
    async with api as con:
        user_stats = await con.get_user_stats(123456789)  # Replace with user ID

⚡ OpenAPI Docs¶

If you want to use the API without this wrapper, you can find the OpenAPI docs here.

The models in this package are automatically generated using the OpenAPI spec:

python cookie/_internal/model_generator.py
Next
API
Copyright © 2026, tibue99
Made with Sphinx and @pradyunsg's Furo
On this page
  • Cookie API
    • ⚙️ Installation
    • 🔑 How to get an API key?
    • 🚀 Example Usage
      • Sync Example
      • Async Example
    • ⚡ OpenAPI Docs