# Trying to connect selfhosted grafana to cloud oncall

**URL:** <https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985>\
**Category:** Grafana Cloud\
**Tags:** oncall\
**Created:** [August 30, 2024, 12:45pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985 "2024-08-30T12:45:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![meander](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@meander](https://community.grafana.com/u/meander)\
**Post date:** [August 30, 2024, 12:45pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/1 "2024-08-30T12:45:58Z")

</div>

Hi! I’m trying to connect self-hosted grafana oncall to cloud oncall so that we can use the mobile app with push notifications.

The [grafana documentation](https://grafana.com/docs/oncall/latest/set-up/open-source/#grafana-oss-cloud-setup) says

> To connect to Grafana Cloud OnCall, refer to the **Cloud** page in your OSS Grafana OnCall instance.

Our OSS grafana OnCall instance wants a Grafana Cloud OnCall API key

> Find it on the Settings page of OnCall, within your Grafana Cloud OnCall instance

In the Grafana Cloud OnCall instance, there is no option to create an API key; I read in a blog post that they have been deprecated. I tried creating an API token instead, but it says “invalid token”. I can use the token with curl without error.

In the env variables tab of the grafana oncall plugin on our self hosted grafana, I looked for a place to set the [https://oncall-prod-eu-west-0.grafana.net/oncall/](https://oncall-prod-eu-west-0.grafana.net/oncall/) url, but I didn’t find one. Is this the problem?

I read a post in this community called “invalid-token-when-connecting-on-call-with-grafana-cloud” (hit the new user links per post limit, sorry) that the url should be set in an `ONCALL_CLOUD_API_URL` variable, but I’m not sure if that variable should be set in the helm chart for the kube-prometheus-stack (where our grafana is) or the docker compose for oncall or somewhere else.

After reading a grafana blog post about entitled “grafana-cloud-access-policies-say-hi-to-the-new-cloud-api-keys”, i tried creating one of those. This also did not work, same invalid token error.

---

<div class="post-metadata">

**Author:** ![tumigislason](https://avatars.discourse-cdn.com/v4/letter/t/46a35a/32.png) [@tumigislason](https://community.grafana.com/u/tumigislason)\
**Post date:** [September 2, 2024, 11:44am UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/2 "2024-09-02T11:44:14Z")

</div>

Hi @meander

I am facing the same issue, created a GitHub issue a few days ago: [v1.9.0 Grafana OnCall Plugin: Can't connect to Grafana Cloud OnCall · Issue #4943 · grafana/oncall · GitHub](https://github.com/grafana/oncall/issues/4943)

---

<div class="post-metadata">

**Author:** ![meander](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@meander](https://community.grafana.com/u/meander)\
**Post date:** [September 2, 2024, 12:02pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/3 "2024-09-02T12:02:05Z")

</div>

Thanks! I replied on the github issue. My setup is slightly different from yours but the result is the same.

---

<div class="post-metadata">

**Author:** ![meander](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@meander](https://community.grafana.com/u/meander)\
**Post date:** [September 2, 2024, 12:39pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/4 "2024-09-02T12:39:36Z")

</div>

Actually I think mine’s a bit different, because I can connect to the self-hosted OnCall all right, I’m just getting a token error when I try to connect to the cloud OnCall

---

<div class="post-metadata">

**Author:** ![michaelderynck](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michaelderynck](https://community.grafana.com/u/michaelderynck)\
**Post date:** [September 6, 2024, 10:14pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/5 "2024-09-06T22:14:05Z")

</div>

Recently we made some changes to the way Grafana OnCall is initialized. Use 1.9.22, there were quite a few changes along the way from 1.9.0-1.9.22 to get things working.

- If you are running Grafana 11 and newer you must have `externalServiceAccounts` feature toggle enabled.  
This has already been enabled in the docker compose files and helm charts in the oncall repo.
- Plugin settings must be provided to the plugin using an API call if you are installing for the first time (Note: credentials and hostnames need to be adjusted for your configuration, stackId and orgId are expected to be the listed constants in a self-hosted configuration)

```auto
curl -X POST 'http://admin:admin@localhost:3000/api/plugins/grafana-oncall-app/settings' -H "Content-Type: application/json" -d '{"enabled":true, "jsonData":{"stackId":5, "orgId":100, "onCallApiUrl":"http://engine:8080/", "grafanaUrl":"http://grafana:3000/"}}'

```

- Once settings are configured use this API call to install:

```auto
curl -X POST 'http://admin:admin@localhost:3000/api/plugins/grafana-oncall-app/resources/plugin/install'

```

Grafana OnCall should now be ready to use.  
For additional troubleshooting see [here](https://github.com/grafana/oncall#troubleshooting)

---

<div class="post-metadata">

**Author:** ![meander](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@meander](https://community.grafana.com/u/meander)\
**Post date:** [October 3, 2024, 1:50pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/6 "2024-10-03T13:50:49Z")

</div>

Hi! Thanks, I’ve followed these steps after upgrading to 1.9.22 but this only helped me to connect self-hosted grafana to oncall after the upgrade. The thing that I’ve been stuck on is connecting Open Source OnCall to Grafana Cloud OnCall so that I can use the mobile app with with push notifications.

In the self-hosted grafana, it says that I need a Grafana Cloud OnCall API Key, and it says that I can get this key from the Grafana Cloud OnCall instance on the Settings page:

 ![self_hosted_grafana](https://us1.discourse-cdn.com/grafana/original/3X/e/e/ee360ff16160c15e0f224f6136064762cd40e73f.png)

But here I am on the settings page, and there is no place to generate a key. I tried to generate a token instead of an API Key, but when I paste the token into the API Key box, it says “Invalid token”.

 ![grafana_cloud](https://us1.discourse-cdn.com/grafana/original/3X/3/0/30d9bf2ec720ae2a6999616167eb1b07e02a5364.png)

I know the token is valid because I can curl with it and get a HTTP 200: [https://oncall-prod-eu-west-0.grafana.net/oncall/api/v1/integrations](https://oncall-prod-eu-west-0.grafana.net/oncall/api/v1/integrations)

---

<div class="post-metadata">

**Author:** ![odorlesstangerine](https://avatars.discourse-cdn.com/v4/letter/o/a8b319/32.png) [@odorlesstangerine](https://community.grafana.com/u/odorlesstangerine)\
**Post date:** [October 22, 2024, 7:21pm UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/7 "2024-10-22T19:21:09Z")

</div>

Did you manage to make this work? I am facing the same problem

---

<div class="post-metadata">

**Author:** ![meander](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@meander](https://community.grafana.com/u/meander)\
**Post date:** [October 24, 2024, 7:43am UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/8 "2024-10-24T07:43:54Z")

</div>

No, I haven’t managed to solve it.

---

<div class="post-metadata">

**Author:** ![meander](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@meander](https://community.grafana.com/u/meander)\
**Post date:** [November 15, 2024, 9:15am UTC](https://community.grafana.com/t/trying-to-connect-selfhosted-grafana-to-cloud-oncall/129985/9 "2024-11-15T09:15:39Z")

</div>

Someone on github had the same problem, and they posted a solution!  
[OSS OnCall fails to set-up connection to Grafana Cloud OnCall: "Invalid token" · Issue #5214 · grafana/oncall · GitHub](https://github.com/grafana/oncall/issues/5214#issuecomment-2465006546)

The problem was that it defaults to trying to connect to the US grafana cloud. In the oncall docker environment, you need to set an environment variable:

`GRAFANA_CLOUD_ONCALL_API_URL: https://oncall-prod-eu-west-0.grafana.net/oncall`

The Documentation doesn’t mention this at all [Grafana OnCall open source guide | Grafana OnCall documentation](https://grafana.com/docs/oncall/latest/set-up/open-source/#grafana-oss-cloud-setup)

And neither does the README [oncall/README.md at dev · grafana/oncall · GitHub](https://github.com/grafana/oncall/blob/dev/README.md)

Or the docker compose file [oncall/docker-compose.yml at dev · grafana/oncall · GitHub](https://github.com/grafana/oncall/blob/dev/docker-compose.yml)
