# Restart a stopped Space from a Webhook?

**URL:** <https://discuss.huggingface.co/t/restart-a-stopped-space-from-a-webhook/32098>\
**Category:** Spaces\
**Created:** [February 20, 2023, 4:03pm UTC](https://discuss.huggingface.co/t/restart-a-stopped-space-from-a-webhook/32098 "2023-02-20T16:03:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![milyiyo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/milyiyo/32/59140_2.png) [@milyiyo](https://discuss.huggingface.co/u/milyiyo)\
**Post date:** [February 20, 2023, 4:03pm UTC](https://discuss.huggingface.co/t/restart-a-stopped-space-from-a-webhook/32098/1 "2023-02-20T16:03:30Z")

</div>

Hi everyone,

Are webhooks capable of restarting a related Space if it is stopped?

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [February 22, 2023, 2:11am UTC](https://discuss.huggingface.co/t/restart-a-stopped-space-from-a-webhook/32098/2 "2023-02-22T02:11:08Z")

</div>

Hi @milyiyo, currently we don’t have a Webhook trigger event for when the Space is stopped or restarted. But it’s a good idea indeed.

You can restart a stopped Space programmatically via our API or using our `huggingface_hub` lib

> **[HfApi Client](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_api#huggingface_hub.HfApi.restart_space)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

Read more about our [Webhooks](https://huggingface.co/docs/hub/webhooks#:~:text=Possible%20values%20for%20the%20associated%20action%3A%20%22create%22%2C%20%22delete%22%2C%20%22update%22%2C%20%22move%22) events

> - `"repo"` - Global events on repos. Possible values for the associated `action`: `"create"`, `"delete"`, `"update"`, `"move"`.
> - `"repo.content"` - Events on the repo’s content, such as new commits or tags. It triggers on new Pull Requests as well due to the newly created reference/commit. The associated `action` is always `"update"`.
> - `"repo.config"` - Events on the config: update Space secrets, update settings, update DOIs, disabled or not, etc. The associated `action` is always `"update"`.
> - `"discussion"` - Creating a discussion or Pull Request, updating the title or status, and merging. Possible values for the associated `action`: `"create"`, `"delete"`, `"update"`.
> - `"discussion.comment"` - Creating, updating, and hiding a comment. Possible values for the associated `action`: `"create"`, `"update"`.

---

<div class="post-metadata">

**Author:** ![milyiyo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/milyiyo/32/59140_2.png) [@milyiyo](https://discuss.huggingface.co/u/milyiyo)\
**Post date:** [February 22, 2023, 3:56pm UTC](https://discuss.huggingface.co/t/restart-a-stopped-space-from-a-webhook/32098/3 "2023-02-22T15:56:09Z")

</div>

Thanks @radames 🙂 👍
