List API Keys
curl --request GET \
--url https://stage-api.getswitch.io/auth/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_by": [
"-created_at"
]
}
'import requests
url = "https://stage-api.getswitch.io/auth/api-keys"
payload = { "order_by": ["-created_at"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_by: ['-created_at']})
};
fetch('https://stage-api.getswitch.io/auth/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/auth/api-keys"
payload := strings.NewReader("{\n \"order_by\": [\n \"-created_at\"\n ]\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"items": [
{
"uuid": "3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f",
"name": "Nightly forecast export",
"exp": "2027-11-30T09:00:00Z",
"created_at": "2026-11-30T09:00:00Z",
"auth_scopes": [
{
"slug": "forecast:read",
"description": "Read forecast data"
},
{
"slug": "integrations:vehicles:read",
"description": "Read access to upstream vehicles"
}
]
}
],
"total": 1,
"page": 1,
"size": 10,
"pages": 1
}API Keys
List API Keys
The API keys you created, 10 per page by default (size up to 50). Only your own keys are listed, and never the key string itself. Filter by name, id, expiry or creation time, search by name, or by scope (authscope__*). order_by (for example ["-created_at"]), uuid__in and name__in are lists and are read from a JSON body, not the query string.
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 - 422: Invalid filter parameters
Required Auth Scopes:
api_keys:read
GET
/
auth
/
api-keys
List API Keys
curl --request GET \
--url https://stage-api.getswitch.io/auth/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_by": [
"-created_at"
]
}
'import requests
url = "https://stage-api.getswitch.io/auth/api-keys"
payload = { "order_by": ["-created_at"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_by: ['-created_at']})
};
fetch('https://stage-api.getswitch.io/auth/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://stage-api.getswitch.io/auth/api-keys"
payload := strings.NewReader("{\n \"order_by\": [\n \"-created_at\"\n ]\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"items": [
{
"uuid": "3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f",
"name": "Nightly forecast export",
"exp": "2027-11-30T09:00:00Z",
"created_at": "2026-11-30T09:00:00Z",
"auth_scopes": [
{
"slug": "forecast:read",
"description": "Read forecast data"
},
{
"slug": "integrations:vehicles:read",
"description": "Read access to upstream vehicles"
}
]
}
],
"total": 1,
"page": 1,
"size": 10,
"pages": 1
}Authorizations
HTTPBearerHTTPBearer
Query Parameters
Response
Paginated list of API keys successfully retrieved with applied filters.
