# Help with api on spaces

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133%3E%5C
**Category:** Beginners\
**Created:** [October 4, 2024, 2:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133 "2024-10-04T14:19:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![arieltoledo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/arieltoledo/32/28586_2.png) [@arieltoledo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Farieltoledo)%5C
**Post date:** [October 4, 2024, 2:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133%2F1 "2024-10-04T14:19:58Z")

</div>

Hi, I’ve created a simple app, its a docker file with a fastAPI api. There are 2 endpoints. GET (“/”) and POST (“/inference”). After the building process, I can see the Hello Work working ok on the browser. But im enable to reach it from curl. The app is served at 5000 port. If i do it like this:

curl -X GET --location ‘[https://huggingface.co/spaces/my\_user/myspace](https://huggingface.co/spaces/my_user/myspace)’ --header ‘Content-Type: application/json’ --header ‘Authorization: Bearer \<MY\_HG\_TOKEN\>’  
I get the html

If i do it like this  
curl -X GET --location ‘[https://huggingface.co/spaces/my\_user/myspace:5000](https://huggingface.co/spaces/my_user/myspace:5000)’ --header ‘Content-Type: application/json’ --header ‘Authorization: Bearer \<MY\_HG\_TOKEN\>’  
I get {“error”:“Invalid username or password.”}:

I added the app\_port to the README

Any ideas what Im missing ?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [October 4, 2024, 9:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133%2F2 "2024-10-04T21:21:08Z")

</div>

The only thing I can think of is to use this URL instead, which seems to be an alias or main body of Spaces.  
https://my\_user-myspace.hf.space/

---

<div class="post-metadata">

**Author:** ![arieltoledo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/arieltoledo/32/28586_2.png) [@arieltoledo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Farieltoledo)%5C
**Post date:** [October 7, 2024, 5:05pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133%2F3 "2024-10-07T17:05:50Z")

</div>

> [@John6666](#):
>
> https://my\_user-myspace.hf.space/

Thanks for the answer Jhon goona give it a try-

---

<div class="post-metadata">

**Author:** ![arieltoledo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/arieltoledo/32/28586_2.png) [@arieltoledo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Farieltoledo)%5C
**Post date:** [October 8, 2024, 11:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133%2F4 "2024-10-08T11:03:50Z")

</div>

Yeap, using that url works like a charm. Thanks again.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [October 8, 2024, 11:13am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhelp-with-api-on-spaces%2F110133%2F5 "2024-10-08T11:13:39Z")

</div>

I didn’t think it would work out that well. Well, thank goodness.😀
