From b61fc8bb7b8dcc2063854f7f95953fad7754668f Mon Sep 17 00:00:00 2001 From: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Date: Wed, 21 Apr 2021 16:26:04 -0400 Subject: [PATCH] Doc: Document the X-Grafana-Org-Id HTTP header (#32478) (#33239) * Doc: Document the X-Grafana-Org-Id HTTP header * Update docs/sources/http_api/auth.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> * update the auth.md with X-Grafana-Org-Id * remove empty line * Update docs/sources/http_api/auth.md * Update docs/sources/http_api/auth.md Co-authored-by: Marcus Efraimsson Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: Marcus Efraimsson Co-authored-by: ying-jeanne <74549700+ying-jeanne@users.noreply.github.com> Co-authored-by: Marcus Efraimsson --- docs/sources/http_api/auth.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/sources/http_api/auth.md b/docs/sources/http_api/auth.md index 5f0755c604b..49273c43507 100755 --- a/docs/sources/http_api/auth.md +++ b/docs/sources/http_api/auth.md @@ -11,6 +11,27 @@ aliases = ["/docs/grafana/latest/http_api/authentication/"] Currently you can authenticate via an `API Token` or via a `Session cookie` (acquired using regular login or OAuth). +## X-Grafana-Org-Id Header + +**X-Grafana-Org-Id** is an optional property that specifies the organization to which the action is applied. If it is not set, the created key belongs to the current context org. Use this header in all requests except those regarding admin. + +**Example Request**: + +```http +POST /api/auth/keys HTTP/1.1 +Accept: application/json +Content-Type: application/json +X-Grafana-Org-Id: 2 +Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + +{ + "name": "mykey", + "role": "Admin", + "secondsToLive": 86400 +} +``` + + ## Basic Auth If basic auth is enabled (it is enabled by default), then you can authenticate your HTTP request via