ReferenceManagement API
Retrieve the current key
GET
Requires no additional scope. Returns the current management key, its team and its assigned scopes.
managementKeyheader
AuthorizationBearer <zc_mgmt_>The key
application/json- response
key*team*// src/bin/management_identity.rs
// Builds on the example project (/reference/json-rpc#example-project).
use swqos_examples::swqos::{Result, required};
#[tokio::main]
async fn main() -> Result<()> {
let endpoint = reqwest::Url::parse("https://console.zerocopy.sh/api/v1/me")?;
let request = reqwest::Client::new()
.get(endpoint)
.bearer_auth(required("MANAGEMENT_API_KEY")?);
let response = request.send().await?;
let status = response.status();
let request_id = response.headers().get("Request-Id")
.map(|value| value.to_str()).transpose()?.unwrap_or("<missing>").to_owned();
if let Some(etag) = response.headers().get("ETag") {
eprintln!("ETag: {}", etag.to_str()?);
}
let body = response.text().await?;
if !status.is_success() {
return Err(format!("HTTP {status}; Request-Id: {request_id}; {body}").into());
}
eprintln!("Request-Id: {request_id}");
println!("{body}");
Ok(())
}{
"key": {
"id": "mk_0123456789abcdef01234567",
"name": "Grafana metrics",
"scopes": [
"usage:read"
],
"expires_at": "2027-02-11T09:00:00Z"
},
"team": {
"id": "org_012345abcdef",
"name": "Example team"
}
}