> 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/xsoar-8-api/cortex-xsoar-8.x-apis/api-keys.md).

# API Keys

APIs for managing API keys

## 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.

```json
{"openapi":"3.0.1","info":{"title":"Cortex XSOAR 8 API","version":"XSOAR 8 Cloud"},"tags":[{"name":"API Keys","description":"APIs for managing API keys"}],"servers":[{"url":"https://api-yourfqdn","description":""}],"paths":{"/public_api/v1/api_keys/generate":{"post":{"summary":"Generate an API key","tags":["API Keys"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"id":{"type":"integer"},"key":{"type":"string"}}}}}}}}},"operationId":"post-public_api-v1-api_keys-generate","description":"Generate a new API key and define the roles assigned to it and whether the security level is standard or advanced.","parameters":[{"schema":{"type":"string"},"in":"header","name":"authorization","description":"api_key","required":true},{"schema":{"type":"string"},"in":"header","name":"x-xdr-auth-id","description":"api_key_id","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["request_data"],"properties":{"request_data":{"type":"object","required":["roles","security_level"],"properties":{"roles":{"type":"array","description":"A list of roles to be assigned to the API key.","items":{"type":"string"}},"security_level":{"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.","enum":["standard","advanced"]},"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"}}}}}}}}}}}}
```

## Delete API keys

> Delete API keys by ID.

```json
{"openapi":"3.0.1","info":{"title":"Cortex XSOAR 8 API","version":"XSOAR 8 Cloud"},"tags":[{"name":"API Keys","description":"APIs for managing API keys"}],"servers":[{"url":"https://api-yourfqdn","description":""}],"paths":{"/public_api/v1/api_keys/delete":{"post":{"summary":"Delete API keys","tags":["API Keys"],"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."}}}}}}}}},"operationId":"post-public_api-v1-api_keys-delete","description":"Delete API keys by ID.","parameters":[{"schema":{"type":"string"},"in":"header","name":"authorization","description":"api_key","required":true},{"schema":{"type":"string"},"in":"header","name":"x-xdr-auth-id","description":"api_key_id","required":true}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["request_data"],"properties":{"request_data":{"type":"object","properties":{"filters":{"type":"array","description":"An array of filter fields.","items":{"type":"object","properties":{"field":{"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":{"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"}}}}}}}}}}}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/xsoar-8-api/cortex-xsoar-8.x-apis/api-keys.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
