> ## Documentation Index
> Fetch the complete documentation index at: https://morphik.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# rotate_app_token

> Rotate an app token by ID or name

> [tab] Sync
>
> ```python theme={null}
> def rotate_app_token(
>     app_id: Optional[str] = None,
>     app_name: Optional[str] = None,
>     expiry_days: Optional[int] = None,
> ) -> Dict[str, Any]
> ```

> [tab] Async
>
> ```python theme={null}
> async def rotate_app_token(
>     app_id: Optional[str] = None,
>     app_name: Optional[str] = None,
>     expiry_days: Optional[int] = None,
> ) -> Dict[str, Any]
> ```

## Parameters

* `app_id` (str, optional): App ID to rotate
* `app_name` (str, optional): App name to rotate
* `expiry_days` (int, optional): New token expiry in days

## Returns

* `Dict[str, Any]`: API response containing the rotated token and metadata

## Examples

```python theme={null}
db.rotate_app_token(app_name="demo", expiry_days=30)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.