> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-commands-guide/api-keys-commands.md).

# API Keys Commands

* [deleteAPIKeys](#deleteapikeys)
* [getAPIKeys](#getapikeys)

#### getAPIKeys

***

Gets a list of existing API keys.

**Arguments**

<details>

<summary>Arguments</summary>

| Argument Name   | Description                                                                                                                  | Required |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------- | -------- |
| api\_key\_ids   | A comma-separated list of API key IDs to retrieve.                                                                           | Optional |
| roles           | A comma-separated list of roles to retrieve API keys by.                                                                     | Optional |
| expires\_before | Filter API keys that expire before this date. For example: '1 year'. Filters only for API keys that have an expiration date. | Optional |
| expires\_after  | Filter API keys that expire after this date. For example: '1 year'. Filters only API keys that have an expiration date.      | Optional |

</details>

**Outputs**

<details>

<summary>Outputs</summary>

**Core.APIKeyData.id** *number*

The unique identifier of the API key.

**Core.APIKeyData.roles** *string*

The roles associated with the API key.

**Core.APIKeyData.created\_by** *string*

The user who created the API key.

**Core.APIKeyData.creation\_time** *number*

The date and time the API key was created.

**Core.APIKeyData.expiration** *number*

The date and time the API key expires.

**Core.APIKeyData.comment** *string*

A comment or note associated with the API key.

</details>

#### deleteAPIKeys

***

Deletes the specified API keys. Any integration or script still using a deleted key immediately loses access.

**Arguments**

<details>

<summary>Arguments</summary>

| Argument Name | Description                                      | Required |
| ------------- | ------------------------------------------------ | -------- |
| api\_key\_ids | A comma-separated list of API key IDs to delete. | Required |

</details>

**Outputs**

There are no outputs for this command.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-commands-guide/api-keys-commands.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
