Function update_api_key

Source
pub async fn update_api_key(
    hash: &str,
    name: Option<String>,
    disabled: Option<bool>,
    limit: Option<f64>,
) -> Result<ApiKey, OpenRouterError>
Expand description

Updates an existing API key. Requires a Provisioning API key.

§Arguments

  • hash - The hash of the API key to update.
  • name - Optional new display name for the API key.
  • disabled - Optional flag to disable the API key.
  • limit - Optional new credit limit for the API key.

§Returns

  • Result<api_keys::ApiKey, OpenRouterError> - The updated API key.

§Example

let updated_api_key = update_api_key("api_key_hash", Some("Updated Name".to_string()), Some(false), Some(200.0)).await?;
println!("{:?}", updated_api_key);