> ## Documentation Index
> Fetch the complete documentation index at: https://unkey.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# get-api

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

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](/api-reference/apis/get-api-namespace) for the full HTTP endpoint documentation.
</Note>

## Usage

```bash theme={"theme":"kanagawa-wave"}
unkey api apis get-api [flags]
```

## Flags

<ParamField body="--api-id" type="string" required>
  Specifies which API to retrieve by its unique identifier. Must be a valid API ID that begins with `api_` and exists within your workspace.
</ParamField>

## Global Flags

| Flag         | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| `--root-key` | string | Override root key (`$UNKEY_ROOT_KEY`)                    |
| `--api-url`  | string | Override API base URL (default: `https://api.unkey.com`) |
| `--config`   | string | Path to config file (default: `~/.unkey/config.toml`)    |
| `--output`   | string | Output format. Use `json` for raw JSON                   |

## Examples

<CodeGroup>
  ```bash Basic theme={"theme":"kanagawa-wave"}
  unkey api apis get-api --api-id=api_1234abcd
  ```

  ```bash JSON output for scripting theme={"theme":"kanagawa-wave"}
  unkey api apis get-api --api-id=api_1234abcd --output=json
  ```

  ```bash Verify an API exists before creating keys theme={"theme":"kanagawa-wave"}
  unkey api apis get-api --api-id=api_1234abcd && unkey api keys create-key --api-id=api_1234abcd
  ```
</CodeGroup>

## Output

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

```text theme={"theme":"kanagawa-wave"}
req_2c9a0jf23l4k567 (took 45ms)

{
  "id": "api_1234abcd",
  "name": "payment-service-prod"
}
```

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

```json theme={"theme":"kanagawa-wave"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "data": {
    "id": "api_1234abcd",
    "name": "payment-service-prod"
  }
}
```
