# API Rest not working with keycloak docker-compose

**URL:** https://discourse.orthanc-server.org/t/api-rest-not-working-with-keycloak-docker-compose/5547
**Category:** General
**Created:** [February 21, 2025, 12:24am UTC](https://discourse.orthanc-server.org/t/api-rest-not-working-with-keycloak-docker-compose/5547 "2025-02-21T00:24:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![medicalit](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@medicalit](https://discourse.orthanc-server.org/u/medicalit)
#### Post date: [February 21, 2025, 12:24am UTC](https://discourse.orthanc-server.org/t/api-rest-not-working-with-keycloak-docker-compose/5547/1 "2025-02-21T00:24:50Z")

</div>

Hello everyone,

I have used the following Docker Compose file:

> **[orthanc-auth-service/minimal-setup/keycloak at main ·...](https://github.com/orthanc-team/orthanc-auth-service/tree/main/minimal-setup/keycloak)**
>
> Web service to run next to orthanc to handle sharing of studies - orthanc-team/orthanc-auth-service

I added HTTPS, used the domain **“orthanc.local”** , and correctly generated the certificates. So far, no issues—I can navigate, create a token from UI2, and successfully open it in OHIF.

Now, I need to upload studies and query a specific study via the API to generate a token for creating the access URL. I enabled port **8042** , which is not exposed by default in the compose file. However, when I try to send a **POST** request to `/tools/find`, I get a **Bad Request** error, indicating that I am not authenticated.

I have followed the instructions in the README exactly as described but still cannot get it to work.

Does anyone have an idea of how to better understand this process? If I repeat these steps without Keycloak (using basic auth), I have no issues using the API.

---

<div class="post-metadata">

### Author: ![medicalit](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@medicalit](https://discourse.orthanc-server.org/u/medicalit)
#### Post date: [February 21, 2025, 12:19pm UTC](https://discourse.orthanc-server.org/t/api-rest-not-working-with-keycloak-docker-compose/5547/2 "2025-02-21T12:19:21Z")

</div>

There was a problem with de api key. If anyone needs help tell me.

Solved!

---

<div class="post-metadata">

### Author: ![benjamin.golinvaux](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/benjamin.golinvaux/32/1508_2.png) [@benjamin.golinvaux](https://discourse.orthanc-server.org/u/benjamin.golinvaux)
#### Post date: [February 21, 2025, 2:42pm UTC](https://discourse.orthanc-server.org/t/api-rest-not-working-with-keycloak-docker-compose/5547/3 "2025-02-21T14:42:43Z")

</div>

Hello,

If you have found other errors in the sample above, it would be really great if you could perhaps create a PR or explain here what the required changes are.

Thanks in advance!

–Benjamin
