Skip to main content

get-api

Retrieve details about an API namespace using the Unkey CLI, including its ID, name, and associated workspace. Useful for scripting workflows.
1 min read

Retrieve basic information about an API namespace including its ID and name.

Use this to verify an API exists before performing operations, get the human-readable name when you only have the API ID, or confirm access to a specific namespace. For detailed key information, use the listKeys endpoint instead.

Required permissions:

  • api.*.read_api (to read any API)
  • api.<api_id>.read_api (to read a specific API)
Note

See the API reference for the full HTTP endpoint documentation.

Usage#

Flags#

--api-idstringrequired#

Specifies which API to retrieve by its unique identifier. Must be a valid API ID that begins with api_ and exists within your workspace.

Global Flags#

FlagTypeDescription
--root-keystringOverride root key ($UNKEY_ROOT_KEY)
--api-urlstringOverride API base URL (default: https://api.unkey.com)
--configstringPath to config file (default: ~/.unkey/config.toml)
--outputstringOutput format. Use json for raw JSON
--bodystringSend this JSON string as the request body. You cannot combine it with request-building flags.

Examples#

Output#

Default output shows the request ID, followed by the API information:

With --output=json, the full response envelope is returned: