# API Keys ## Create `agents.api_keys.create(strpath_agent_uuid, APIKeyCreateParams**kwargs) -> APIKeyCreateResponse` **post** `/v2/gen-ai/agents/{agent_uuid}/api_keys` To create an agent API key, send a POST request to `/v2/gen-ai/agents/{agent_uuid}/api_keys`. ### Parameters - **agent\_uuid:** `str` - **agent\_uuid:** `str` - **name:** `str` A human friendly name to identify the key ### Returns - `class APIKeyCreateResponse` - **api\_key\_info:** `Optional[APIAgentAPIKeyInfo]` Agent API Key Info ### Example ```python from gradient import Gradient client = Gradient() api_key = client.agents.api_keys.create( path_agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(api_key.api_key_info) ``` ## Update `agents.api_keys.update(strpath_api_key_uuid, APIKeyUpdateParams**kwargs) -> APIKeyUpdateResponse` **put** `/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}` To update an agent API key, send a PUT request to `/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}`. ### Parameters - **agent\_uuid:** `str` - **api\_key\_uuid:** `str` - **agent\_uuid:** `str` - **api\_key\_uuid:** `str` - **name:** `str` Name ### Returns - `class APIKeyUpdateResponse` - **api\_key\_info:** `Optional[APIAgentAPIKeyInfo]` Agent API Key Info ### Example ```python from gradient import Gradient client = Gradient() api_key = client.agents.api_keys.update( path_api_key_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", path_agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(api_key.api_key_info) ``` ## List `agents.api_keys.list(stragent_uuid, APIKeyListParams**kwargs) -> APIKeyListResponse` **get** `/v2/gen-ai/agents/{agent_uuid}/api_keys` To list all agent API keys, send a GET request to `/v2/gen-ai/agents/{agent_uuid}/api_keys`. ### Parameters - **agent\_uuid:** `str` - **page:** `int` Page number. - **per\_page:** `int` Items per page. ### Returns - `class APIKeyListResponse` - **api\_key\_infos:** `Optional[List[APIAgentAPIKeyInfo]]` Api key infos - **created\_at:** `Optional[datetime]` Creation date - **created\_by:** `Optional[str]` Created by - **deleted\_at:** `Optional[datetime]` Deleted date - **name:** `Optional[str]` Name - **secret\_key:** `Optional[str]` - **uuid:** `Optional[str]` Uuid - **links:** `Optional[APILinks]` Links to other pages - **meta:** `Optional[APIMeta]` Meta information about the data set ### Example ```python from gradient import Gradient client = Gradient() api_keys = client.agents.api_keys.list( agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(api_keys.api_key_infos) ``` ## Delete `agents.api_keys.delete(strapi_key_uuid, APIKeyDeleteParams**kwargs) -> APIKeyDeleteResponse` **delete** `/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}` To delete an API key for an agent, send a DELETE request to `/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}`. ### Parameters - **agent\_uuid:** `str` - **api\_key\_uuid:** `str` ### Returns - `class APIKeyDeleteResponse` - **api\_key\_info:** `Optional[APIAgentAPIKeyInfo]` Agent API Key Info ### Example ```python from gradient import Gradient client = Gradient() api_key = client.agents.api_keys.delete( api_key_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(api_key.api_key_info) ``` ## Regenerate `agents.api_keys.regenerate(strapi_key_uuid, APIKeyRegenerateParams**kwargs) -> APIKeyRegenerateResponse` **put** `/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}/regenerate` To regenerate an agent API key, send a PUT request to `/v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}/regenerate`. ### Parameters - **agent\_uuid:** `str` - **api\_key\_uuid:** `str` ### Returns - `class APIKeyRegenerateResponse` - **api\_key\_info:** `Optional[APIAgentAPIKeyInfo]` Agent API Key Info ### Example ```python from gradient import Gradient client = Gradient() response = client.agents.api_keys.regenerate( api_key_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", agent_uuid="\"123e4567-e89b-12d3-a456-426614174000\"", ) print(response.api_key_info) ```