Expand description
§API Keys Admin API
This module provides a Rust interface to Anthropic’s Admin API for managing API keys, which allows you to list, get, and update API keys.
§Key Features
- List all API keys with pagination and filtering support
- Get detailed information about a specific API key
- Update API key properties like name and status
§Basic Usage
use anthropic_api::{admin::api_keys::*, Credentials};
#[tokio::main]
async fn main() {
let credentials = Credentials::from_env();
// List API keys
let api_keys = ApiKeyList::builder()
.credentials(credentials.clone())
.create()
.await
.unwrap();
println!("Available API keys: {:?}", api_keys.data);
// Get a specific API key
if let Some(api_key) = api_keys.data.first() {
let api_key_details = ApiKey::builder(&api_key.id)
.credentials(credentials.clone())
.create()
.await
.unwrap();
println!("API key details: {:?}", api_key_details);
}
}Structs§
- ApiKey
- An API key available through the Anthropic Admin API.
- ApiKey
Builder - Builder for
ApiKeyRequest. - ApiKey
Creator - Information about the creator of an API key
- ApiKey
List - Response from the List API Keys API.
- ApiKey
List Builder - Builder for
ApiKeyListRequest. - ApiKey
List Request - Request parameters for listing API keys.
- ApiKey
Request - Request parameters for getting a specific API key.
- ApiKey
Update Builder - Builder for
ApiKeyUpdateRequest. - ApiKey
Update Request - Request parameters for updating an API key.
Enums§
- ApiKey
Builder Error - Error type for ApiKeyBuilder
- ApiKey
List Builder Error - Error type for ApiKeyListBuilder
- ApiKey
Status - Status of an API key
- ApiKey
Update Builder Error - Error type for ApiKeyUpdateBuilder