> 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-platform-iam/api-keys.md).

# API Keys

Operations for managing API keys including retrieving and editing API key configurations.

## Get API Key

> This endpoint retrieves an API key and its respective properties. Note: the 'roles' field refers to the 'pretty\_name' attributes from the Roles APIs, not the unique role identifiers. For possible 'security\_level' values, please refer to the enum documentation for 'SecurityLevel'.

```json
{"openapi":"3.0.2","info":{"title":"Cortex Platform IAM APIs","version":"Cortex AgentiX"},"tags":[{"name":"API Keys","description":"Operations for managing API keys including retrieving and editing API key configurations."}],"servers":[{"url":"https://api-{{fqdn}}"}],"paths":{"/platform/iam/v1/api-key/{api_key_id}":{"get":{"tags":["API Keys"],"summary":"Get API Key","description":"This endpoint retrieves an API key and its respective properties. Note: the 'roles' field refers to the 'pretty_name' attributes from the Roles APIs, not the unique role identifiers. For possible 'security_level' values, please refer to the enum documentation for 'SecurityLevel'.","operationId":"getApiKeyById","parameters":[{"name":"api_key_id","in":"path","description":"Full API key ID","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Successfully retrieved API key","content":{"application/json":{"schema":{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/Metadata"}}}}}},"400":{"$ref":"#/components/responses/ApiKeyFetchedBadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/UnauthorizedImproperPermissions"},"500":{"$ref":"#/components/responses/InternalError"}}}}},"components":{"schemas":{"Metadata":{"type":"object","description":"Metadata for the response"}},"responses":{"ApiKeyFetchedBadRequest":{"description":"Bad request for api key get call","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"err_msg":{"type":"string","description":"Error message describing the issue"},"metadata":{"type":"object","properties":{"err_extra":{"type":"string","description":"Additional error details"},"err_code":{"type":"integer","description":"HTTP error code"}},"required":["err_extra","err_code"]}},"required":["err_msg","metadata"]}},"required":["data"]}}}},"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object"}}}},"UnauthorizedImproperPermissions":{"description":"Unauthorized access due to lack of sufficient permissions. This includes Instance Administrator privilege escalation errors: non-admin API keys cannot assign, modify, or delete entities that have the Instance Administrator role.","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"err_msg":{"type":"string"},"err_extra":{"type":"string"},"err_code":{"type":"integer"}},"required":["err_msg"]}}}}}},"InternalError":{"description":"Internal server error. A unified status for API communication type errors."}}}}
```

## Edit an API key

> This endpoint allows for the editing of an existing API key. For possible 'security\_level' values, please refer to the enum documentation for 'SecurityLevel'.

```json
{"openapi":"3.0.2","info":{"title":"Cortex Platform IAM APIs","version":"Cortex AgentiX"},"tags":[{"name":"API Keys","description":"Operations for managing API keys including retrieving and editing API key configurations."}],"servers":[{"url":"https://api-{{fqdn}}"}],"paths":{"/platform/iam/v1/api-key/{api_key_id}":{"put":{"tags":["API Keys"],"summary":"Edit an API key","description":"This endpoint allows for the editing of an existing API key. For possible 'security_level' values, please refer to the enum documentation for 'SecurityLevel'.","operationId":"editAPIKey","parameters":[{"name":"api_key_id","in":"path","description":"Full API key ID","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyEditRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ApiKeyEditedSuccess"},"400":{"$ref":"#/components/responses/ApiKeyEditedBadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/UnauthorizedImproperPermissions"},"500":{"$ref":"#/components/responses/InternalError"}}}}},"components":{"schemas":{"ApiKeyEditRequest":{"type":"object","additionalProperties":false,"properties":{"request_data":{"type":"object","properties":{"roles":{"type":"array","description":"API Key's assigned roles. Note: this refers to the 'role_id' attributes from the Role APIs (the unique role identifiers)","items":{"type":"string"}},"security_level":{"type":"string","description":"API Key's security level"},"comment":{"type":"string","nullable":true,"description":"API Key's comment"}},"required":["roles","security_level"]}},"required":["request_data"]}},"responses":{"ApiKeyEditedSuccess":{"description":"API key edited successfully","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"message":{"type":"string","description":"Success message indicating the API key was edited"}},"required":["message"]}},"required":["data"]}}}},"ApiKeyEditedBadRequest":{"description":"Bad request for api key edit call","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"err_msg":{"type":"string","description":"Error message describing the issue"},"metadata":{"type":"object","properties":{"err_extra":{"type":"string","description":"Additional error details"},"err_code":{"type":"integer","description":"HTTP error code"}},"required":["err_extra","err_code"]}},"required":["err_msg","metadata"]}},"required":["data"]}}}},"Unauthorized":{"description":"Unauthorized access","content":{"application/json":{"schema":{"type":"object"}}}},"UnauthorizedImproperPermissions":{"description":"Unauthorized access due to lack of sufficient permissions. This includes Instance Administrator privilege escalation errors: non-admin API keys cannot assign, modify, or delete entities that have the Instance Administrator role.","content":{"application/json":{"schema":{"type":"object","properties":{"reply":{"type":"object","properties":{"err_msg":{"type":"string"},"err_extra":{"type":"string"},"err_code":{"type":"integer"}},"required":["err_msg"]}}}}}},"InternalError":{"description":"Internal server error. A unified status for API communication type errors."}}}}
```


---

# 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-platform-iam/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.
