Create an API key for yourself. The response carries the key string in key: it is shown only once, so store it safely right away; later calls return the key’s details but never the key again. Send it as Authorization: Bearer <key>.
exp: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days.
narrowing: optional cap per resource ({resource: level}, levels none, read, use, manage); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions.
auth_scopes: legacy scope list, kept for older clients; prefer narrowing.
Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key.
Failure Modes:
400: Invalid scopes: ... when auth_scopes asks for a scope you do not hold
401: Token is missing, invalid, expired or revoked
403: access_denied when your role cannot manage API keys, or the request is authenticated with an API key
422: config_invalid when exp is in the past or more than 365 days ahead, or narrowing names an unknown resource or level or goes above your own level; or an invalid body
An API key, sent as Authorization: Bearer <key>. Create one in the SWITCH Copilot under Settings → API keys (needs the API keys permission in your company), or with POST /auth/api-keys. The key is shown once, at creation.
Body
application/json
Schema for creating a new API key.
Used in API requests to create a new API key resource, optionally specifying
expiration and scopes.
name
string
required
Name of the new API key.
exp
string<date-time> | null
When the key expires (ISO 8601), in the future and at most 365 days ahead (422 config_invalid otherwise). Omitted: 365 days from now.
auth_scopes
string[] | null
Deprecated, prefer narrowing: legacy scope slugs for the key, each one you hold (400 otherwise). Without narrowing, the key's cap is derived from them. Omitted: all your scopes.
narrowing
Narrowing · object | null
Optional cap per resource, {resource: level} with levels none, read, use, manage (resources as in access.resources of GET /auth/me). The key acts with the lower of the cap and your own level; a cap above your level is refused (422). Omitted: the key acts with your permissions.
Show child attributes
Response
API key successfully created with metadata and key string.
Public schema for an API key returned at creation time.
Extends ApiKeyPublic to include the actual key string, which is only shown once at
creation.
uuid
string
required
Unique UUID identifier for the API key.
name
string
required
Name of the API key.
created_at
string<date-time>
required
Datetime when the API key was created.
auth_scopes
AuthScopePublic · object[]
required
List of authorization scopes assigned to the API key.
Show child attributes
key
string
required
The API key itself, returned only in this response: store it now. Send it as Authorization: Bearer <key>.
exp
string<date-time> | null
When the key expires (UTC).
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"SWITCH","description":"SWITCH API reference and guides: forecasts, fleet operations, routing, analytics, and Myles in your AI assistant.","colors":{"primary":"#131110","light":"#FAFAF4","dark":"#131110"},"logo":{"light":"https://mintcdn.com/switchsrl-stage/q2Qy6e_N_m85PgIF/logo/switch-wordmark-ink.svg?fit=max\u0026auto=format\u0026n=q2Qy6e_N_m85PgIF\u0026q=85\u0026s=83a9625c685d993be0e8a51c68c0aee6","dark":"https://mintcdn.com/switchsrl-stage/q2Qy6e_N_m85PgIF/logo/switch-wordmark-white.png?fit=max\u0026auto=format\u0026n=q2Qy6e_N_m85PgIF\u0026q=85\u0026s=cb194173a9e2bccf4640045f35a2a87f","href":"https://getswitch.io"},"favicon":"https://mintcdn.com/switchsrl-stage/q2Qy6e_N_m85PgIF/favicon.png?fit=max\u0026auto=format\u0026n=q2Qy6e_N_m85PgIF\u0026q=85\u0026s=594ed1f74ed3ae7cef44edc0e0f34df4","api":{"playground":{"display":"interactive"},"examples":{"defaults":"required","languages":["curl","python","javascript","go"],"prefill":true}},"background":{"color":{"light":"#FFFFFF","dark":"#131110"}},"navbar":{"primary":{"type":"button","label":"Open SWITCH","href":"https://copilot.getswitch.io"}},"footer":{"socials":{"website":"https://getswitch.io","linkedin":"https://www.linkedin.com/company/14072408"}},"fonts":{"family":"Roboto"},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"switchsrl-stage","hasAudioNarration":false,"actualSubdomain":"switchsrl-stage","customDomains":[],"gitSource":{"type":"github","owner":"switch-street-witcher","repo":"switch-api","deployBranch":"stage","contentDirectory":"","isPrivate":false,"mountPath":"","label":"","_id":"6b0d7bf4d778254279acca0f"},"entitlements":{},"buildId":"6b0d7c46d778254279acd4e8","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"API Reference","count":101},{"language":"default","tag":"Fleet Management","count":23},{"language":"default","tag":"Integrations","count":16},{"language":"default","tag":"Station Based Analytics","count":13},{"language":"default","tag":"Routing Sessions","count":11},{"language":"default","tag":"Routing Operations","count":8},{"language":"default","tag":"API Keys","count":5},{"language":"default","tag":"Forecast","count":4},{"language":"default","tag":"Live","count":4},{"language":"default","tag":"Operations","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":true},"customCss":[]}
{"page":{"pagePath":"api-reference/api-keys/create-api-key","slug":"/api-reference/api-keys/create-api-key","pageMetadata":{"title":"Create API Key","description":"Create an API key for yourself. The response carries the key string in `key`: it is shown **only once**, so store it safely right away; later calls return the key's details but never the key again. Send it as `Authorization: Bearer \u003ckey>`.\n\n- `exp`: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days.\n- `narrowing`: optional cap per resource (`{resource: level}`, levels `none`, `read`, `use`, `manage`); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions.\n- `auth_scopes`: legacy scope list, kept for older clients; prefer `narrowing`.\n\nCreate keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key.\n\n**Failure Modes:**\n- **400**: `Invalid scopes: ...` when `auth_scopes` asks for a scope you do not hold\n- **401**: Token is missing, invalid, expired or revoked\n- **403**: `access_denied` when your role cannot manage API keys, or the request is authenticated with an API key\n- **422**: `config_invalid` when `exp` is in the past or more than 365 days ahead, or `narrowing` names an unknown resource or level or goes above your own level; or an invalid body\n\n**Required Auth Scopes:**\n- `api_keys:write`","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /auth/api-keys","href":"/api-reference/api-keys/create-api-key","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n li: \"li\",\n p: \"p\",\n strong: \"strong\",\n ul: \"ul\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsxs(_components.p, {\n children: [\"Create an API key for yourself. The response carries the key string in \", _jsx(_components.code, {\n children: \"key\"\n }), \": it is shown \", _jsx(_components.strong, {\n children: \"only once\"\n }), \", so store it safely right away; later calls return the key’s details but never the key again. Send it as \", _jsx(_components.code, {\n children: \"Authorization: Bearer \u003ckey>\"\n }), \".\"]\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.code, {\n children: \"exp\"\n }), \": when the key expires, at most 365 days ahead; omitted, the key lasts 365 days.\"]\n }), \"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.code, {\n children: \"narrowing\"\n }), \": optional cap per resource (\", _jsx(_components.code, {\n children: \"{resource: level}\"\n }), \", levels \", _jsx(_components.code, {\n children: \"none\"\n }), \", \", _jsx(_components.code, {\n children: \"read\"\n }), \", \", _jsx(_components.code, {\n children: \"use\"\n }), \", \", _jsx(_components.code, {\n children: \"manage\"\n }), \"); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions.\"]\n }), \"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.code, {\n children: \"auth_scopes\"\n }), \": legacy scope list, kept for older clients; prefer \", _jsx(_components.code, {\n children: \"narrowing\"\n }), \".\"]\n }), \"\\n\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key.\"\n }), \"\\n\", _jsx(_components.p, {\n children: _jsx(_components.strong, {\n children: \"Failure Modes:\"\n })\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.strong, {\n children: \"400\"\n }), \": \", _jsx(_components.code, {\n children: \"Invalid scopes: ...\"\n }), \" when \", _jsx(_components.code, {\n children: \"auth_scopes\"\n }), \" asks for a scope you do not hold\"]\n }), \"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.strong, {\n children: \"401\"\n }), \": Token is missing, invalid, expired or revoked\"]\n }), \"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.strong, {\n children: \"403\"\n }), \": \", _jsx(_components.code, {\n children: \"access_denied\"\n }), \" when your role cannot manage API keys, or the request is authenticated with an API key\"]\n }), \"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.strong, {\n children: \"422\"\n }), \": \", _jsx(_components.code, {\n children: \"config_invalid\"\n }), \" when \", _jsx(_components.code, {\n children: \"exp\"\n }), \" is in the past or more than 365 days ahead, or \", _jsx(_components.code, {\n children: \"narrowing\"\n }), \" names an unknown resource or level or goes above your own level; or an invalid body\"]\n }), \"\\n\"]\n }), \"\\n\", _jsx(_components.p, {\n children: _jsx(_components.strong, {\n children: \"Required Auth Scopes:\"\n })\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsx(_components.li, {\n children: _jsx(_components.code, {\n children: \"api_keys:write\"\n })\n }), \"\\n\"]\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Create API Key","description":"Create an API key for yourself. The response carries the key string in `key`: it is shown **only once**, so store it safely right away; later calls return the key's details but never the key again. Send it as `Authorization: Bearer \u003ckey>`.\n\n- `exp`: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days.\n- `narrowing`: optional cap per resource (`{resource: level}`, levels `none`, `read`, `use`, `manage`); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions.\n- `auth_scopes`: legacy scope list, kept for older clients; prefer `narrowing`.\n\nCreate keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key.\n\n**Failure Modes:**\n- **400**: `Invalid scopes: ...` when `auth_scopes` asks for a scope you do not hold\n- **401**: Token is missing, invalid, expired or revoked\n- **403**: `access_denied` when your role cannot manage API keys, or the request is authenticated with an API key\n- **422**: `config_invalid` when `exp` is in the past or more than 365 days ahead, or `narrowing` names an unknown resource or level or goes above your own level; or an invalid body\n\n**Required Auth Scopes:**\n- `api_keys:write`","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /auth/api-keys","href":"/api-reference/api-keys/create-api-key","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["API Keys"],"summary":"Create API Key","description":"Create an API key for yourself. The response carries the key string in `key`: it is shown **only once**, so store it safely right away; later calls return the key's details but never the key again. Send it as `Authorization: Bearer \u003ckey>`.\n\n- `exp`: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days.\n- `narrowing`: optional cap per resource (`{resource: level}`, levels `none`, `read`, `use`, `manage`); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions.\n- `auth_scopes`: legacy scope list, kept for older clients; prefer `narrowing`.\n\nCreate keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key.\n\n**Failure Modes:**\n- **400**: `Invalid scopes: ...` when `auth_scopes` asks for a scope you do not hold\n- **401**: Token is missing, invalid, expired or revoked\n- **403**: `access_denied` when your role cannot manage API keys, or the request is authenticated with an API key\n- **422**: `config_invalid` when `exp` is in the past or more than 365 days ahead, or `narrowing` names an unknown resource or level or goes above your own level; or an invalid body\n\n**Required Auth Scopes:**\n- `api_keys:write`","operationId":"create_api_key","security":["67e48d51-b98e-482a-9c57-3d7445488369","b0b2c0b8-a4df-415b-ad5a-312cf8e10062"],"requestBody":"33d67580-be80-4d28-96f1-c48b902d7067","responses":{"201":"a0c55f7b-5ce9-42a9-b9d5-7324235ec165","400":"97f6b344-043b-4084-ad2a-47c04c3ccc9d","401":"b8c2ee8f-5ae5-4d0a-9e74-e40324cacbcc","403":"23ed8861-f614-4b45-9529-08455a84bb20","422":"e1b9d34f-2caf-4551-9c22-bb995326f1d8","500":"93828351-45c5-40de-8482-e413d38d1399"},"method":"post","type":"path","servers":["3e069aac-8807-4f2b-8fbd-901b66759f89"],"path":"/auth/api-keys","baseUrlOptions":["https://stage-api.getswitch.io"],"title":"Create API Key","codeSamples":[],"requestExampleLanguages":["bash","python","javascript","go"],"requiredOnlyExamples":true,"requestExampleType":"generated","responseExampleType":"generated","prefillPlaygroundWithExample":true,"prefillPlaygroundExamples":[{"body.name":"Nightly forecast export","body.exp.oneOf.0":"2027-11-30T09:00:00Z","body.narrowing.oneOf.0.fleet\\.vehicles":"read","body.narrowing.oneOf.0.forecast":"read"}]},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"name":{"type":"string","title":"Name","description":"Name of the new API key.","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"exp":{"oneOf":[{"type":"string","format":"date-time","title":"Exp","description":"When the key expires (ISO 8601), in the future and at most 365 days ahead (422 `config_invalid` otherwise). Omitted: 365 days from now.","uniqueKey":"exp.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","title":"Exp","description":"When the key expires (ISO 8601), in the future and at most 365 days ahead (422 `config_invalid` otherwise). Omitted: 365 days from now.","uniqueKey":"exp.oneOf.1","typeLabel":"null"}],"uniqueKey":"exp","typeLabel":"string\u003cdate-time> | null"},"auth_scopes":{"oneOf":[{"items":{"type":"string","uniqueKey":"auth_scopes.oneOf.0.items.[INDEX]","typeLabel":"string"},"type":"array","title":"Auth Scopes","description":"Deprecated, prefer `narrowing`: legacy scope slugs for the key, each one you hold (400 otherwise). Without `narrowing`, the key's cap is derived from them. Omitted: all your scopes.","uniqueKey":"auth_scopes.oneOf.0","typeLabel":"string[]"},{"items":{"type":"string"},"type":"null","title":"Auth Scopes","description":"Deprecated, prefer `narrowing`: legacy scope slugs for the key, each one you hold (400 otherwise). Without `narrowing`, the key's cap is derived from them. Omitted: all your scopes.","uniqueKey":"auth_scopes.oneOf.1","typeLabel":"null"}],"uniqueKey":"auth_scopes","typeLabel":"string[] | null"},"narrowing":{"oneOf":[{"additionalProperties":{"type":"string","enum":["none","read","use","manage"],"uniqueKey":"narrowing.oneOf.0.additionalProperties","typeLabel":"enum\u003cstring>"},"type":"object","title":"Narrowing","description":"Optional cap per resource, `{resource: level}` with levels `none`, `read`, `use`, `manage` (resources as in `access.resources` of `GET /auth/me`). The key acts with the lower of the cap and your own level; a cap above your level is refused (422). Omitted: the key acts with your permissions.","uniqueKey":"narrowing.oneOf.0","typeLabel":"Narrowing · object"},{"additionalProperties":{"type":"string","enum":["none","read","use","manage"],"uniqueKey":"narrowing.oneOf.1.additionalProperties","typeLabel":"enum\u003cstring>"},"type":"null","title":"Narrowing","description":"Optional cap per resource, `{resource: level}` with levels `none`, `read`, `use`, `manage` (resources as in `access.resources` of `GET /auth/me`). The key acts with the lower of the cap and your own level; a cap above your level is refused (422). Omitted: the key acts with your permissions.","uniqueKey":"narrowing.oneOf.1","typeLabel":"null"}],"uniqueKey":"narrowing","typeLabel":"Narrowing · object | null"}},"type":"object","required":["name"],"title":"ApiKeyCreate","description":"Schema for creating a new API key.\n\nUsed in API requests to create a new API key resource, optionally specifying\nexpiration and scopes.","examples":[{"exp":"2027-11-30T09:00:00Z","name":"Nightly forecast export","narrowing":{"fleet.vehicles":"read","forecast":"read"}}],"uniqueKey":"","typeLabel":"ApiKeyCreate · object"},"examples":{"Example":{"title":"Example","value":{"exp":"2027-11-30T09:00:00Z","name":"Nightly forecast export","narrowing":{"fleet.vehicles":"read","forecast":"read"}}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"a0c55f7b-5ce9-42a9-b9d5-7324235ec165":{"description":"API key successfully created with metadata and key string.","content":{"application/json":{"schema":{"properties":{"uuid":{"type":"string","title":"Uuid","description":"Unique UUID identifier for the API key.","isRequired":true,"uniqueKey":"uuid","typeLabel":"string"},"name":{"type":"string","title":"Name","description":"Name of the API key.","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Datetime when the API key was created.","isRequired":true,"uniqueKey":"created_at","typeLabel":"string\u003cdate-time>"},"auth_scopes":{"items":{"properties":{"slug":{"type":"string","title":"Slug","description":"Unique slug identifier for the authorization scope.","isRequired":true,"uniqueKey":"auth_scopes.items.[INDEX].slug","typeLabel":"string"},"description":{"type":"string","title":"Description","description":"Description of the authorization scope.","isRequired":true,"uniqueKey":"auth_scopes.items.[INDEX].description","typeLabel":"string"}},"type":"object","required":["slug","description"],"title":"AuthScopePublic","description":"Public schema for an authorization scope.\n\nExposes information about an available authorization scope to API consumers.","uniqueKey":"auth_scopes.items.[INDEX]","typeLabel":"AuthScopePublic · object"},"type":"array","title":"Auth Scopes","description":"List of authorization scopes assigned to the API key.","isRequired":true,"uniqueKey":"auth_scopes","typeLabel":"AuthScopePublic · object[]"},"key":{"type":"string","title":"Key","description":"The API key itself, returned only in this response: store it now. Send it as `Authorization: Bearer \u003ckey>`.","isRequired":true,"uniqueKey":"key","typeLabel":"string"},"exp":{"oneOf":[{"type":"string","format":"date-time","title":"Exp","description":"When the key expires (UTC).","uniqueKey":"exp.oneOf.0","typeLabel":"string\u003cdate-time>"},{"type":"null","format":"date-time","title":"Exp","description":"When the key expires (UTC).","uniqueKey":"exp.oneOf.1","typeLabel":"null"}],"uniqueKey":"exp","typeLabel":"string\u003cdate-time> | null"}},"type":"object","required":["uuid","name","created_at","auth_scopes","key"],"title":"ApiKeyFirstTimePublic","description":"Public schema for an API key returned at creation time.\n\nExtends ApiKeyPublic to include the actual key string, which is only shown once at\ncreation.","examples":[{"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","key":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFWEFNUExFIjoibm90LWEtcmVhbC1rZXkifQ.EXAMPLE_SIGNATURE_NOT_A_REAL_KEY","name":"Nightly forecast export","uuid":"3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f"}],"uniqueKey":"","typeLabel":"ApiKeyFirstTimePublic · object"},"examples":{"Example":{"title":"Example","value":{"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","key":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFWEFNUExFIjoibm90LWEtcmVhbC1rZXkifQ.EXAMPLE_SIGNATURE_NOT_A_REAL_KEY","name":"Nightly forecast export","uuid":"3f2b8c1e-5d4a-4e7b-9c0d-1a2b3c4d5e6f"}}},"exampleType":"generated"}},"exampleType":"generated"},"97f6b344-043b-4084-ad2a-47c04c3ccc9d":{"description":"Bad Request. Invalid authorization scopes specified - user lacks permission for requested scopes.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"b8c2ee8f-5ae5-4d0a-9e74-e40324cacbcc":{"description":"Unauthorized. Authentication credentials missing, invalid, expired, or revoked.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"23ed8861-f614-4b45-9529-08455a84bb20":{"description":"Forbidden. Missing required `api_keys:write` authorization scope.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"e1b9d34f-2caf-4551-9c22-bb995326f1d8":{"description":"Unprocessable Entity. Invalid request body, or `config_invalid`: `exp` in the past or more than 365 days ahead, `narrowing` above your own level.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"93828351-45c5-40de-8482-e413d38d1399":{"description":"Internal Server Error. Database transaction failure or token generation error.","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}}},"security":{"67e48d51-b98e-482a-9c57-3d7445488369":{"HTTPBearer":{"type":"http","scheme":"bearer","description":"An API key, sent as `Authorization: Bearer \u003ckey>`. Create one in the SWITCH Copilot under **Settings → API keys** (needs the API keys permission in your company), or with `POST /auth/api-keys`. The key is shown once, at creation.","scopes":[],"schemeName":"HTTPBearer"}},"b0b2c0b8-a4df-415b-ad5a-312cf8e10062":{"HTTPBearer":{"type":"http","scheme":"bearer","description":"An API key, sent as `Authorization: Bearer \u003ckey>`. Create one in the SWITCH Copilot under **Settings → API keys** (needs the API keys permission in your company), or with `POST /auth/api-keys`. The key is shown once, at creation.","scopes":[],"schemeName":"HTTPBearer"}}},"servers":{"3e069aac-8807-4f2b-8fbd-901b66759f89":{"url":"https://stage-api.getswitch.io","description":"Stage"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"An API key, sent as `Authorization: Bearer \u003ckey>`. Create one in the SWITCH Copilot under **Settings → API keys** (needs the API keys permission in your company), or with `POST /auth/api-keys`. The key is shown once, at creation.","scopes":[],"schemeName":"HTTPBearer"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"An API key, sent as `Authorization: Bearer \u003ckey>`. Create one in the SWITCH Copilot under **Settings → API keys** (needs the API keys permission in your company), or with `POST /auth/api-keys`. The key is shown once, at creation.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"HTTPBearer","name":"Authorization"}],"title":"HTTPBearer"},{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"An API key, sent as `Authorization: Bearer \u003ckey>`. Create one in the SWITCH Copilot under **Settings → API keys** (needs the API keys permission in your company), or with `POST /auth/api-keys`. The key is shown once, at creation.","scopes":[],"schemeName":"HTTPBearer"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"An API key, sent as `Authorization: Bearer \u003ckey>`. Create one in the SWITCH Copilot under **Settings → API keys** (needs the API keys permission in your company), or with `POST /auth/api-keys`. The key is shown once, at creation.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"HTTPBearer","name":"Authorization"}],"title":"HTTPBearer"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"switchsrl-stage","siteName":"SWITCH","title":"Create API Key - SWITCH","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-30T13:38:22.788Z","originalFileLocation":"api-reference/api-keys/create-api-key.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create an API key for yourself. The response carries the key string in key: it is shown only once, so store it safely right away; later calls return the key\u0026#x27;s details but never the key again. Send it as Authorization: Bearer . - exp: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days. - narrowing: optional cap per resource ({resource: level}, levels none, read, use, manage); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions. - auth_scopes: legacy scope list, kept for older clients; prefer narrowing. Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key. Failure Modes: - 400: Invalid scopes: ... when auth_scopes asks for a scope you do not hold - 401: Token is missing, invalid, expired or revoked - 403: access_denied when your role cannot manage API keys, or the request is authenticated with an API key - 422: config_invalid when exp is in the past or more than 365 days ahead, or narrowing names an unknown resource or level or goes above your own level; or an invalid body Required Auth Scopes: - api_keys:write\">\u003cmeta data-mint-head name=\"application-name\" content=\"SWITCH\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create API Key - SWITCH\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create an API key for yourself. The response carries the key string in key: it is shown only once, so store it safely right away; later calls return the key\u0026#x27;s details but never the key again. Send it as Authorization: Bearer . - exp: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days. - narrowing: optional cap per resource ({resource: level}, levels none, read, use, manage); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions. - auth_scopes: legacy scope list, kept for older clients; prefer narrowing. Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key. Failure Modes: - 400: Invalid scopes: ... when auth_scopes asks for a scope you do not hold - 401: Token is missing, invalid, expired or revoked - 403: access_denied when your role cannot manage API keys, or the request is authenticated with an API key - 422: config_invalid when exp is in the past or more than 365 days ahead, or narrowing names an unknown resource or level or goes above your own level; or an invalid body Required Auth Scopes: - api_keys:write\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"SWITCH\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://switchsrl-stage.mintlify.site/_mintlify/api/og/v2?division=API+Keys\u0026amp;title=Create+API+Key\u0026amp;description=Create+an+API+key+for+yourself.+The+response+carries+the+key+string+in+%60key%60%3A+it+is+shown+**only+once**%2C+so+store+it+safely+right+away%3B+later+calls+return+the+k\u0026amp;theme=18a078e79863f23e2770fc78\u0026amp;signature=4980478339d41ec2a6a2f444b83f32631492cb225062352025a6aecd85c81676\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Create API Key - SWITCH\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create an API key for yourself. The response carries the key string in key: it is shown only once, so store it safely right away; later calls return the key\u0026#x27;s details but never the key again. Send it as Authorization: Bearer . - exp: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days. - narrowing: optional cap per resource ({resource: level}, levels none, read, use, manage); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions. - auth_scopes: legacy scope list, kept for older clients; prefer narrowing. Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key. Failure Modes: - 400: Invalid scopes: ... when auth_scopes asks for a scope you do not hold - 401: Token is missing, invalid, expired or revoked - 403: access_denied when your role cannot manage API keys, or the request is authenticated with an API key - 422: config_invalid when exp is in the past or more than 365 days ahead, or narrowing names an unknown resource or level or goes above your own level; or an invalid body Required Auth Scopes: - api_keys:write\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://switchsrl-stage.mintlify.site/_mintlify/api/og/v2?division=API+Keys\u0026amp;title=Create+API+Key\u0026amp;description=Create+an+API+key+for+yourself.+The+response+carries+the+key+string+in+%60key%60%3A+it+is+shown+**only+once**%2C+so+store+it+safely+right+away%3B+later+calls+return+the+k\u0026amp;theme=18a078e79863f23e2770fc78\u0026amp;signature=4980478339d41ec2a6a2f444b83f32631492cb225062352025a6aecd85c81676\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/switchsrl-stage/JTXLLi80I0McEXEm/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"SWITCH\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#131110\">\u003clink data-mint-head rel=\"canonical\" href=\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/api-keys/create-api-key.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://switchsrl-stage.mintlify.app/#organization\",\"name\":\"SWITCH\",\"url\":\"https://switchsrl-stage.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/switchsrl-stage/q2Qy6e_N_m85PgIF/logo/switch-wordmark-ink.svg?fit=max\u0026auto=format\u0026n=q2Qy6e_N_m85PgIF\u0026q=85\u0026s=83a9625c685d993be0e8a51c68c0aee6\"}},{\"@type\":\"WebSite\",\"@id\":\"https://switchsrl-stage.mintlify.app#website\",\"name\":\"SWITCH\",\"url\":\"https://switchsrl-stage.mintlify.app\",\"publisher\":{\"@id\":\"https://switchsrl-stage.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key#webpage\",\"url\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key\",\"name\":\"Create API Key\",\"description\":\"Create an API key for yourself. The response carries the key string in key: it is shown only once, so store it safely right away; later calls return the key's details but never the key again. Send it as Authorization: Bearer . - exp: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days. - narrowing: optional cap per resource ({resource: level}, levels none, read, use, manage); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions. - auth_scopes: legacy scope list, kept for older clients; prefer narrowing. Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key. Failure Modes: - 400: Invalid scopes: ... when auth_scopes asks for a scope you do not hold - 401: Token is missing, invalid, expired or revoked - 403: access_denied when your role cannot manage API keys, or the request is authenticated with an API key - 422: config_invalid when exp is in the past or more than 365 days ahead, or narrowing names an unknown resource or level or goes above your own level; or an invalid body Required Auth Scopes: - api_keys:write\",\"dateModified\":\"2026-11-30T13:38:22.788Z\",\"isPartOf\":{\"@id\":\"https://switchsrl-stage.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Keys\",\"item\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/list-api-keys\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create API Key\",\"item\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key#apireference\",\"headline\":\"Create API Key\",\"name\":\"Create API Key\",\"description\":\"Create an API key for yourself. The response carries the key string in key: it is shown only once, so store it safely right away; later calls return the key's details but never the key again. Send it as Authorization: Bearer . - exp: when the key expires, at most 365 days ahead; omitted, the key lasts 365 days. - narrowing: optional cap per resource ({resource: level}, levels none, read, use, manage); the key then acts with the lower of the cap and your own level. Omitted, the key acts with your permissions. - auth_scopes: legacy scope list, kept for older clients; prefer narrowing. Create keys while signed in (for example from the Copilot): a request authenticated with an API key cannot create another key. Failure Modes: - 400: Invalid scopes: ... when auth_scopes asks for a scope you do not hold - 401: Token is missing, invalid, expired or revoked - 403: access_denied when your role cannot manage API keys, or the request is authenticated with an API key - 422: config_invalid when exp is in the past or more than 365 days ahead, or narrowing names an unknown resource or level or goes above your own level; or an invalid body Required Auth Scopes: - api_keys:write\",\"url\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key\",\"mainEntityOfPage\":{\"@id\":\"https://switchsrl-stage.mintlify.app/api-reference/api-keys/create-api-key#webpage\"},\"dateModified\":\"2026-11-30T13:38:22.788Z\",\"publisher\":{\"@id\":\"https://switchsrl-stage.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://switchsrl-stage.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"SWITCH\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"SWITCH\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/api-keys/create-api-key.md","siteName":"SWITCH","nav":{"global":null,"tabs":[{"tab":"API Reference","groups":[{"group":"Get started","pages":[{"title":"Introduction","href":""}]},{"group":"API Keys","pages":[{"title":"List API Keys","description":"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.\n\nAPI keys authenticate scripts and integrations as you: send one as `Authorization: Bearer \u003ckey>`. 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`.\n\n**Failure Modes:**\n- **401**: Token is missing, invalid, expired or revoked\n- **403**: `access_denied` when your role cannot read API keys\n- **422**: Invalid filter parameters\n\n**Required Auth Scopes:**\n- `api_keys:read`","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /auth/api-keys","href":"/api-reference/api-keys/list-api-keys"},{"title":"Create API Key","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /auth/api-keys","href":"/api-reference/api-keys/create-api-key"},{"title":"Get API Key","description":"One of your API keys: name, expiry, creation time and scopes. The key string itself is never returned.\n\nAPI keys authenticate scripts and integrations as you: send one as `Authorization: Bearer \u003ckey>`. 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`.\n\n**Failure Modes:**\n- **401**: Token is missing, invalid, expired or revoked\n- **403**: `access_denied` when your role cannot read API keys\n- **404**: `API key not found` when no key of yours has this id\n\n**Required Auth Scopes:**\n- `api_keys:read`","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /auth/api-keys/{uuid}","href":"/api-reference/api-keys/get-api-key"},{"title":"Delete API Key","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /auth/api-keys/{uuid}","href":"/api-reference/api-keys/delete-api-key"},{"title":"Get Current User Profile","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /auth/me","href":"/api-reference/api-keys/get-current-user-profile"}]},{"group":"Grids","pages":[{"title":"Download Grid File For Single Data Scenario","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /grids/stream","href":"/api-reference/grids/download-grid-file-for-single-data-scenario"},{"title":"Download Grid File For Specific Data Scenario","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /grids/stream/{data_scenario_id}","href":"/api-reference/grids/download-grid-file-for-specific-data-scenario"}]},{"group":"Forecast","pages":[{"title":"Get Forecasted Demand","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /forecast","href":"/api-reference/forecast/get-forecasted-demand"},{"title":"Get Forecasted Demand as GeoJSON","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /forecast/geojson","href":"/api-reference/forecast/get-forecasted-demand-as-geojson"},{"title":"Get Forecasted Demand by Type","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /forecast/{forecast_type}","href":"/api-reference/forecast/get-forecasted-demand-by-type"},{"title":"Get Forecasted Demand by Type as GeoJSON","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /forecast/{forecast_type}/geojson","href":"/api-reference/forecast/get-forecasted-demand-by-type-as-geojson"}]},{"group":"Operations","pages":[{"title":"Get Imbalance Snapshot","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/imbalance","href":"/api-reference/operations/get-imbalance-snapshot"},{"title":"Get Imbalance Snapshot as GeoJSON","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/imbalance/geojson","href":"/api-reference/operations/get-imbalance-snapshot-as-geojson"},{"title":"Get Rebalancing Suggestions","deprecated":true,"version":null,"openapi":"/api-reference/openapi.json post /operations/rebalance","href":"/api-reference/operations/get-rebalancing-suggestions"},{"title":"Generate Operations Based on Strategies","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/suggest","href":"/api-reference/operations/generate-operations-based-on-strategies"}]},{"group":"Routing","pages":[{"title":"Solve Routing Optimization","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routing","href":"/api-reference/routing/solve-routing-optimization"},{"title":"Solve Multi-Fleet Routing (Two-Phase Greedy)","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routing/multi-fleet","href":"/api-reference/routing/solve-multi-fleet-routing-two-phase-greedy"}]},{"group":"Routing Sessions","pages":[{"title":"List Sessions","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/sessions","href":"/api-reference/routing-sessions/list-sessions"},{"title":"Dispatch Session","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/sessions","href":"/api-reference/routing-sessions/dispatch-session"},{"title":"Get Session Detail","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/sessions/{slug}","href":"/api-reference/routing-sessions/get-session-detail"},{"title":"Update Session","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /operations/sessions/{slug}","href":"/api-reference/routing-sessions/update-session"},{"title":"Delete Session","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /operations/sessions/{slug}","href":"/api-reference/routing-sessions/delete-session"},{"title":"List Routes in Session","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/sessions/{slug}/routes","href":"/api-reference/routing-sessions/list-routes-in-session"},{"title":"List Routes (Cross-Session)","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/routes","href":"/api-reference/routing-sessions/list-routes-cross-session"},{"title":"Get Route Detail","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/routes/{route_id}","href":"/api-reference/routing-sessions/get-route-detail"},{"title":"Update Route","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /operations/routes/{route_id}","href":"/api-reference/routing-sessions/update-route"},{"title":"Assign Drivers to Route","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/drivers","href":"/api-reference/routing-sessions/assign-drivers-to-route"},{"title":"Remove Driver from Route","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /operations/routes/{route_id}/drivers/{user_id}","href":"/api-reference/routing-sessions/remove-driver-from-route"}]},{"group":"Routing Operations","pages":[{"title":"List Operations in Route","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/routes/{route_id}/operations","href":"/api-reference/routing-operations/list-operations-in-route"},{"title":"Complete Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/operations/{op_id}/complete","href":"/api-reference/routing-operations/complete-operation"},{"title":"Undo Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/operations/{op_id}/undo","href":"/api-reference/routing-operations/undo-operation"},{"title":"Cancel Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/operations/{op_id}/cancel","href":"/api-reference/routing-operations/cancel-operation"},{"title":"Restore Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/operations/{op_id}/restore","href":"/api-reference/routing-operations/restore-operation"},{"title":"Generate Reroute Preview","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/reroute/generate","href":"/api-reference/routing-operations/generate-reroute-preview"},{"title":"Optimize Reroute","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/reroute/optimize","href":"/api-reference/routing-operations/optimize-reroute"},{"title":"Apply Rerouted Operations","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/routes/{route_id}/reroute/apply","href":"/api-reference/routing-operations/apply-rerouted-operations"}]},{"group":"Fleet Management","pages":[{"title":"List Cargo Vehicles","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/cargo-vehicles","href":"/api-reference/fleet-management/list-cargo-vehicles"},{"title":"Create Cargo Vehicle","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/cargo-vehicles","href":"/api-reference/fleet-management/create-cargo-vehicle"},{"title":"Get Cargo Vehicle by ID","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/cargo-vehicles/{vehicle_id}","href":"/api-reference/fleet-management/get-cargo-vehicle-by-id"},{"title":"Update Cargo Vehicle","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /operations/cargo-vehicles/{vehicle_id}","href":"/api-reference/fleet-management/update-cargo-vehicle"},{"title":"Delete Cargo Vehicle","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /operations/cargo-vehicles/{vehicle_id}","href":"/api-reference/fleet-management/delete-cargo-vehicle"},{"title":"List Depots","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/depots","href":"/api-reference/fleet-management/list-depots"},{"title":"Create Depot","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/depots","href":"/api-reference/fleet-management/create-depot"},{"title":"Get Depot by ID","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/depots/{depot_id}","href":"/api-reference/fleet-management/get-depot-by-id"},{"title":"Update Depot","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /operations/depots/{depot_id}","href":"/api-reference/fleet-management/update-depot"},{"title":"Delete Depot","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /operations/depots/{depot_id}","href":"/api-reference/fleet-management/delete-depot"},{"title":"Synchronize Company Stations","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/stations/sync","href":"/api-reference/fleet-management/synchronize-company-stations"},{"title":"List Stations","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/stations","href":"/api-reference/fleet-management/list-stations"},{"title":"Create Station","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/stations","href":"/api-reference/fleet-management/create-station"},{"title":"Get Station by ID","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/stations/{station_id}","href":"/api-reference/fleet-management/get-station-by-id"},{"title":"Update Station","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /operations/stations/{station_id}","href":"/api-reference/fleet-management/update-station"},{"title":"Delete Station","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /operations/stations/{station_id}","href":"/api-reference/fleet-management/delete-station"},{"title":"List Drivers","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/drivers","href":"/api-reference/fleet-management/list-drivers"},{"title":"Create Driver","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /operations/drivers","href":"/api-reference/fleet-management/create-driver"},{"title":"Get Driver by ID","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/drivers/{driver_id}","href":"/api-reference/fleet-management/get-driver-by-id"},{"title":"Update Driver","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /operations/drivers/{driver_id}","href":"/api-reference/fleet-management/update-driver"},{"title":"Delete Driver","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /operations/drivers/{driver_id}","href":"/api-reference/fleet-management/delete-driver"},{"title":"Get Fleet Settings","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /operations/fleet-settings","href":"/api-reference/fleet-management/get-fleet-settings"},{"title":"Update Fleet Settings","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json patch /operations/fleet-settings","href":"/api-reference/fleet-management/update-fleet-settings"}]},{"group":"Free Float Analytics","pages":[{"title":"Get Free-Float Trip History","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/free-float/{provider}/trip_history","href":"/api-reference/free-float-analytics/get-free-float-trip-history"}]},{"group":"Live","pages":[{"title":"Get Live Fleet Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/live/fleet-status","href":"/api-reference/live/get-live-fleet-status"},{"title":"List Live Deliveries","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/live/deliveries","href":"/api-reference/live/list-live-deliveries"},{"title":"Get Live Transit Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/live/transit/status","href":"/api-reference/live/get-live-transit-status"},{"title":"Get Live Transit Line","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/live/transit/lines/{route_id}","href":"/api-reference/live/get-live-transit-line"}]},{"group":"Station Based Analytics","pages":[{"title":"Get Station Summary Metrics","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/summary_metrics","href":"/api-reference/station-based-analytics/get-station-summary-metrics"},{"title":"Get Vehicle Shortage Mapping","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/vehicle_shortage_mapping","href":"/api-reference/station-based-analytics/get-vehicle-shortage-mapping"},{"title":"Get Commuting Station Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/commuting_stations","href":"/api-reference/station-based-analytics/get-commuting-station-analysis"},{"title":"Get Missed Demand Estimation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/missed_demand","href":"/api-reference/station-based-analytics/get-missed-demand-estimation"},{"title":"Get Station Refill Time Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/refill_times","href":"/api-reference/station-based-analytics/get-station-refill-time-analysis"},{"title":"Get Competitor Opportunity Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/competitor_opportunities","href":"/api-reference/station-based-analytics/get-competitor-opportunity-analysis"},{"title":"Get Deployment Window Optimization","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/deployment_windows","href":"/api-reference/station-based-analytics/get-deployment-window-optimization"},{"title":"Get Station Trip Volume Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/trip_volume","href":"/api-reference/station-based-analytics/get-station-trip-volume-analysis"},{"title":"Get Demand Growth Trends","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/growth_trends","href":"/api-reference/station-based-analytics/get-demand-growth-trends"},{"title":"Get Calendar Event Impact Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/calendar_events","href":"/api-reference/station-based-analytics/get-calendar-event-impact-analysis"},{"title":"Get Station Capacity Alerts","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/capacity_alerts","href":"/api-reference/station-based-analytics/get-station-capacity-alerts"},{"title":"Get E-Bike Usage Pattern Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/ebike_patterns","href":"/api-reference/station-based-analytics/get-e-bike-usage-pattern-analysis"},{"title":"Get After-Hours Demand Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/station-based/{provider}/after_hours_demand","href":"/api-reference/station-based-analytics/get-after-hours-demand-analysis"}]},{"group":"Zone Based Analytics","pages":[{"title":"Get Zone Trip Volume","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/zone-based/{provider}/trip_volume","href":"/api-reference/zone-based-analytics/get-zone-trip-volume"},{"title":"Get Commuting Zone Analysis","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/zone-based/{provider}/commuting_zones","href":"/api-reference/zone-based-analytics/get-commuting-zone-analysis"},{"title":"Get Zone Shortage Mapping","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/zone-based/{provider}/shortage_mapping","href":"/api-reference/zone-based-analytics/get-zone-shortage-mapping"},{"title":"Get Zone Growth Trends","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/zone-based/{provider}/growth_trends","href":"/api-reference/zone-based-analytics/get-zone-growth-trends"}]},{"group":"Transit Analytics","pages":[{"title":"Get Transit Punctuality","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/analytics/transit/punctuality","href":"/api-reference/transit-analytics/get-transit-punctuality"},{"title":"Get Transit Line Details","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/analytics/transit/lines/{route_id}","href":"/api-reference/transit-analytics/get-transit-line-details"},{"title":"Get Transit Service Delivery","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /copilot/analytics/transit/service-delivery","href":"/api-reference/transit-analytics/get-transit-service-delivery"}]},{"group":"Integrations","pages":[{"title":"List Fleet Vehicles","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/vehicles","href":"/api-reference/integrations/list-fleet-vehicles"},{"title":"Get Fleet Vehicle","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/vehicles/{vehicle_id}","href":"/api-reference/integrations/get-fleet-vehicle"},{"title":"List Fleet Stations","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/stations","href":"/api-reference/integrations/list-fleet-stations"},{"title":"List Fleet Tasks","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/tasks","href":"/api-reference/integrations/list-fleet-tasks"},{"title":"List Vehicle Statuses","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/statuses","href":"/api-reference/integrations/list-vehicle-statuses"},{"title":"List Allowed Actions by Vehicle Type","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/actions/allowed","href":"/api-reference/integrations/list-allowed-actions-by-vehicle-type"},{"title":"List Vehicle Actions","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/actions/{vehicle_id}","href":"/api-reference/integrations/list-vehicle-actions"},{"title":"List Remote Operations","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/remote-operations","href":"/api-reference/integrations/list-remote-operations"},{"title":"List Custom Vehicle States","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/custom-states","href":"/api-reference/integrations/list-custom-vehicle-states"},{"title":"Set Vehicle Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /integrations/statuses/{vehicle_id}/set","href":"/api-reference/integrations/set-vehicle-status"},{"title":"Trigger Vehicle Action","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /integrations/actions/{vehicle_id}/trigger","href":"/api-reference/integrations/trigger-vehicle-action"},{"title":"Complete Remote Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /integrations/remote-operations/{operation_id}/complete","href":"/api-reference/integrations/complete-remote-operation"},{"title":"Reopen Remote Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /integrations/remote-operations/{operation_id}/undo","href":"/api-reference/integrations/reopen-remote-operation"},{"title":"Delete Remote Operation","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /integrations/remote-operations/{operation_id}","href":"/api-reference/integrations/delete-remote-operation"},{"title":"Set Vehicle Custom State","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /integrations/custom-states/{vehicle_id}/set","href":"/api-reference/integrations/set-vehicle-custom-state"},{"title":"Get Integration Availability","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /integrations/availability","href":"/api-reference/integrations/get-integration-availability"}]}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/myles-mcp"}]}]},"basePath":"","title":"Create API Key - SWITCH","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-BMn8tSe3.js","snippetPresets-Dl5ZrD9W.js","utils-CddEzDcs.js","style-to-object-BY3JEAdk.js","utils-Dym31Pnf.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-ZiqR8hPK.js","conditional-requirements-CFM0id0Q.js","cloneDeep-D3fPbylz.js","_Uint8Array-BcNtDki0.js","isObject-FP1Yky1u.js","ApiExamples-4Sf3CFhl.js","usePlaygroundInputsStore-Ck91l6q0.js","shallow-DapBSR9G.js","isEqual-Clu_sGzx.js","CodeSnippets-DAVHdSX2.js","CodeSnippet-Be6AcO_D.js","use-playground-group-access-CteWws2O.js","Page-_aL_PM_2.js","api-description-markdown-BPoPkVJQ.js","DynamicMarkdown-QJ7LkRm3.js","SectionHeading-DyxPTJti.js","MethodPill-CGjK-dNY.js","getPastedJson-C4YIGTOJ.js","Check2Icon-B7COpIZE.js","axios-CsQoIw0U.js","Markdown-Bquzb4Gw.js","AssistantPageLink-wSgGy_i5.js","dist-Bg48sGSz.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}