> 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/agentix-api/cortex-agentix/api-keys.md).

# API Keys

APIs for managing API keys

## Get existing API keys

> Get a list of API keys filtered by expiration date, role, or ID.\
> \
> \*\*Required license:\*\* \*\*Cortex AgentiX Enterprise\*\* or \*\*Cortex AgentiX Base\*\*.

```json
{"openapi":"3.0.0","info":{"title":"Cortex AgentiX APIs","version":"Cortex AgentiX"},"tags":[{"name":"API keys","description":"APIs for managing API keys"}],"servers":[{"url":"https://api-yourfqdn"}],"paths":{"/public_api/v1/api_keys/get_api_keys":{"post":{"tags":["API keys"],"summary":"Get existing API keys","description":"Get a list of API keys filtered by expiration date, role, or ID.\n\n**Required license:** **Cortex AgentiX Enterprise** or **Cortex AgentiX Base**.","operationId":"post-public_api-v1-api_keys-get_api_keys","parameters":[{"name":"authorization","in":"header","description":"api_key","required":true,"schema":{"type":"string"}},{"name":"x-xdr-auth-id","in":"header","description":"api_key_id","required":true,"schema":{"type":"string"}},{"name":"x-xdr-timestamp","in":"header","description":"timestamp in milliseconds","required":true,"schema":{"type":"string"}},{"name":"x-xdr-nonce","in":"header","description":"64 byte random string","required":true,"schema":{"type":"string"}},{"name":"x-child-tenant-id","in":"header","description":"child tenant ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"request_data":{"type":"object","properties":{"filters":{"type":"array","description":"An array of filter fields.","items":{"type":"object","properties":{"field":{"type":"string","enum":["expiration","roles","id"],"description":"Identifies the API key field the filter is matching. Filters are based on the following keywords:\r\n- `expiration`: Time the API key expires in epoch milliseconds.\r\n- `roles`: The role assigned to the API key at creation.\r\n- `id`: API key ID."},"operator":{"type":"string","enum":["gte","lte","contains","in"],"description":"Identifies the comparison operator you want to use for this filter. Valid keywords are:\r\n\r\n- `gte` / `lte` operator is used with `expiration` field (Integer in timestamp epoch milliseconds).\r\n\r\n- `contains` operator is used with `roles` field (Array of strings).\r\n\r\n- `in` operator is used with `id` field (Array of integers)."},"value":{"description":"Value that this filter must match. The contents of this field will differ depending on the API key field that you specified for this filter:\r\n- `expiration`: Integer representing the number of milliseconds after the Unix epoch, UTC timezone.\r\n- `roles`: Array of strings representing the roles in the Cortex XSOAR system.\r\n- `id`: Array of integers representing the API key IDs.","oneOf":[{"type":"integer"},{"type":"array"}]}}}}}}},"required":["request_data"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"creation_time":{"type":"integer"},"created_by":{"type":"string"},"user_name":{"type":"string"},"roles":{"type":"array","items":{"type":"string"}},"security_level":{"type":"string"},"comment":{"nullable":true},"expiration":{"type":"integer"}}}},"filter_count":{"type":"integer"},"total_count":{"type":"integer","description":"Note: The `total_count` value contains all API Keys, including ones that have expired."}}}}}}}}}}}}}
```

## Generate an API key

> Generate a new API key and define the roles assigned to it and whether the security level is standard or advanced.\
> \
> \*\*Required license:\*\* \*\*Cortex AgentiX Enterprise\*\* or \*\*Cortex AgentiX Base\*\*.

```json
{"openapi":"3.0.0","info":{"title":"Cortex AgentiX APIs","version":"Cortex AgentiX"},"tags":[{"name":"API keys","description":"APIs for managing API keys"}],"servers":[{"url":"https://api-yourfqdn"}],"paths":{"/public_api/v1/api_keys/generate":{"post":{"tags":["API keys"],"summary":"Generate an API key","description":"Generate a new API key and define the roles assigned to it and whether the security level is standard or advanced.\n\n**Required license:** **Cortex AgentiX Enterprise** or **Cortex AgentiX Base**.","operationId":"post-public_api-v1-api_keys-generate","parameters":[{"name":"authorization","in":"header","description":"api_key","required":true,"schema":{"type":"string"}},{"name":"x-xdr-auth-id","in":"header","description":"api_key_id","required":true,"schema":{"type":"string"}},{"name":"x-xdr-timestamp","in":"header","description":"timestamp in milliseconds","required":true,"schema":{"type":"string"}},{"name":"x-xdr-nonce","in":"header","description":"64 byte random string","required":true,"schema":{"type":"string"}},{"name":"x-child-tenant-id","in":"header","description":"child tenant ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"request_data":{"type":"object","properties":{"roles":{"type":"array","description":"A list of roles to be assigned to the API key.","items":{"type":"string"}},"security_level":{"type":"string","enum":["standard","advanced"],"description":"The seurity level of the API key. API keys with advanced security are hashed with a nonce and timestamp, which is useful for proprietary scripts and are intended to prevent replay attacks. Standard security API keys can be used as-is and are suitable for curl."},"expiration":{"type":"integer","description":"Integer in timestamp epoch milliseconds. Default value is one week from the time of the API call. Maximum expiration date is six months from the time of the API call."},"comment":{"type":"string"}},"required":["roles","security_level"]}},"required":["request_data"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"id":{"type":"integer"},"key":{"type":"string"}}}}}}}}}}}}}
```

## Delete API keys

> Delete API keys by ID.\
> \
> \*\*Required license:\*\* \*\*Cortex AgentiX Enterprise\*\* or \*\*Cortex AgentiX Base\*\*.

```json
{"openapi":"3.0.0","info":{"title":"Cortex AgentiX APIs","version":"Cortex AgentiX"},"tags":[{"name":"API keys","description":"APIs for managing API keys"}],"servers":[{"url":"https://api-yourfqdn"}],"paths":{"/public_api/v1/api_keys/delete":{"post":{"tags":["API keys"],"summary":"Delete API keys","description":"Delete API keys by ID.\n\n**Required license:** **Cortex AgentiX Enterprise** or **Cortex AgentiX Base**.","operationId":"post-public_api-v1-api_keys-delete","parameters":[{"name":"authorization","in":"header","description":"api_key","required":true,"schema":{"type":"string"}},{"name":"x-xdr-auth-id","in":"header","description":"api_key_id","required":true,"schema":{"type":"string"}},{"name":"x-xdr-timestamp","in":"header","description":"timestamp in milliseconds","required":true,"schema":{"type":"string"}},{"name":"x-xdr-nonce","in":"header","description":"64 byte random string","required":true,"schema":{"type":"string"}},{"name":"x-child-tenant-id","in":"header","description":"child tenant ID","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"request_data":{"type":"object","properties":{"filters":{"type":"array","description":"An array of filter fields.","items":{"type":"object","properties":{"field":{"type":"string","enum":["id"],"description":"Identifies the API key field the filter is matching. Filters are based on the following keyword:\r\n- `id`: The API key ID.\r\n"},"operator":{"type":"string","enum":["in"],"description":"Identifies the comparison operator you want to use for this filter. Valid keyword is:\r\n`in`\r\n- `id`: Integer representing the API key ID.\r\n"},"value":{"type":"array","description":"Array of API key IDs.","items":{"type":"integer"}}}}}}}},"required":["request_data"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"update_count":{"type":"integer","description":"The number of API keys deleted."}}}}}}}}}}}}}
```


---

# 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/agentix-api/cortex-agentix/api-keys.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.
