# cancelOffer

## cancelOffer()

```python
async def cancelOffer(offer_id: str, authData: str) -> None
```

*Cancel existing gift offer*

### Returns

`None` if the offer was cancelled successfully

### Raises

* `authDataError` if `authData` is not provided
* `offerError` if `offer_id` is not provided
* `requestError` if request fails.

### Parameters

* `offer_id` (str): ID of the offer to cancel
* `authData` (str): Authentication data required to cancel the offer.&#x20;

### Example

Cancel all existing offers:

```python
from aportalsmp.offers import myPlacedOffers, cancelOffer
from aportalsmp.auth import update_auth
import asyncio

auth = asyncio.run(update_auth(api_id=123, api_hash="..."))

async def main():
    placed_offers = await myPlacedOffers(authData = auth)
    for offer in placed_offers:
        await cancelOffer(offer_id = offer.id, authData = auth)
```

***See used functions:*** [*myPlacedOffers*](https://bleach-1.gitbook.io/aportalsmp/documentation/aportalsmp.offers/myplacedoffers)*,* [*update\_auth*](https://bleach-1.gitbook.io/aportalsmp/documentation/aportalsmp.auth/update_auth)
