Get API Key
curl --request GET \
--url https://api.getswitch.io/auth/api-keys/{uuid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/auth/api-keys/{uuid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/auth/api-keys/{uuid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getswitch.io/auth/api-keys/{uuid}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"auth_scopes": [
{
"description": "Read forecast data",
"slug": "forecast:read"
},
{
"description": "Read access to upstream vehicles",
"slug": "integrations:vehicles:read"
}
],
"created_at": "2026-11-30T09:00:00Z",
"exp": "2027-11-30T09:00:00Z",
"name": "Nightly forecast export",
"uuid": "3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f"
}API Keys
Get API Key
One of your API keys: name, expiry, creation time and scopes. The key string itself is never returned.
API keys authenticate scripts and integrations as you: send one as Authorization: Bearer <key>. A key acts with your permissions (or fewer, when created with narrowing) and stops working when it expires or is deleted. Create keys in the Copilot (Settings → API keys) or with POST /auth/api-keys.
Failure Modes:
- 401: Token is missing, invalid, expired or revoked
- 403:
access_deniedwhen your role cannot read API keys - 404:
API key not foundwhen no key of yours has this id
Required Auth Scopes:
api_keys:read
GET
/
auth
/
api-keys
/
{uuid}
Get API Key
curl --request GET \
--url https://api.getswitch.io/auth/api-keys/{uuid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getswitch.io/auth/api-keys/{uuid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getswitch.io/auth/api-keys/{uuid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getswitch.io/auth/api-keys/{uuid}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"auth_scopes": [
{
"description": "Read forecast data",
"slug": "forecast:read"
},
{
"description": "Read access to upstream vehicles",
"slug": "integrations:vehicles:read"
}
],
"created_at": "2026-11-30T09:00:00Z",
"exp": "2027-11-30T09:00:00Z",
"name": "Nightly forecast export",
"uuid": "3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f"
}Authorizations
HTTPBearerHTTPBearer
Path Parameters
Response
API key metadata successfully retrieved.
Public schema for an API key resource.
Exposes API key metadata and associated authorization scopes to API consumers.
