# Help with api on spaces

**URL:** <https://discuss.huggingface.co/t/help-with-api-on-spaces/110133>\
**Category:** Beginners\
**Created:** [October 4, 2024, 2:19pm UTC](https://discuss.huggingface.co/t/help-with-api-on-spaces/110133 "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](https://discuss.huggingface.co/u/arieltoledo)\
**Post date:** [October 4, 2024, 2:19pm UTC](https://discuss.huggingface.co/t/help-with-api-on-spaces/110133/1 "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](https://discuss.huggingface.co/u/John6666)\
**Post date:** [October 4, 2024, 9:21pm UTC](https://discuss.huggingface.co/t/help-with-api-on-spaces/110133/2 "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](https://discuss.huggingface.co/u/arieltoledo)\
**Post date:** [October 7, 2024, 5:05pm UTC](https://discuss.huggingface.co/t/help-with-api-on-spaces/110133/3 "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](https://discuss.huggingface.co/u/arieltoledo)\
**Post date:** [October 8, 2024, 11:03am UTC](https://discuss.huggingface.co/t/help-with-api-on-spaces/110133/4 "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](https://discuss.huggingface.co/u/John6666)\
**Post date:** [October 8, 2024, 11:13am UTC](https://discuss.huggingface.co/t/help-with-api-on-spaces/110133/5 "2024-10-08T11:13:39Z")

</div>

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