# API endpoint for creating a space from a repo?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fapi-endpoint-for-creating-a-space-from-a-repo%2F29686%3E%5C
**Category:** Spaces\
**Created:** [January 15, 2023, 6:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fapi-endpoint-for-creating-a-space-from-a-repo%2F29686 "2023-01-15T18:21:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tehfailsafe](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/tehfailsafe/32/13574_2.png) [@tehfailsafe](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftehfailsafe)%5C
**Post date:** [January 15, 2023, 6:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fapi-endpoint-for-creating-a-space-from-a-repo%2F29686%2F1 "2023-01-15T18:21:19Z")

</div>

Looks like we can get spaces, search them, or find by id. Is there a way to create a new space from an existing repo programmatically?

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ffreddyaboulton)%5C
**Post date:** [January 15, 2023, 8:54pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fapi-endpoint-for-creating-a-space-from-a-repo%2F29686%2F2 "2023-01-15T20:54:09Z")

</div>

Hi @tehfailsafe !

You can create a space from a local directory with the create\_repo function of the hub client library: [Hugging Face Hub API](https://huggingface.co/docs/huggingface_hub/package_reference/hf_api#huggingface_hub.HfApi.create_repo.repo_type)

---

<div class="post-metadata">

**Author:** ![tehfailsafe](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/tehfailsafe/32/13574_2.png) [@tehfailsafe](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftehfailsafe)%5C
**Post date:** [January 16, 2023, 1:58am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fapi-endpoint-for-creating-a-space-from-a-repo%2F29686%2F3 "2023-01-16T01:58:23Z")

</div>

Oh, great! I must have been looking at some different docs. We can even use create\_branch with repo\_type! Exactly what I wanted (vs uploading from local)

Thanks!
