Pause a customer key
Requires the partner:write scope. Pauses a customer key without changing its secret and returns the key with its current ETag. Paused keys reject sending requests with key_paused. No request body is needed. An already paused key returns 400 invalid_request unless this request replays a saved idempotent response. A revoked key returns 404 not_found.
managementKeyAuthorizationBearer <zc_mgmt_>id*string^key_[0-9a-f]{12}$If-Match?stringChange only the key version last read; a stale validator returns 412
Idempotency-Key?stringMakes a retry return the first successful response instead of repeating the state change
1 <= length <= 255The paused customer key
application/json- response
id*stringname*string|nullproducts*array<>created_at*|nullexpires_at*|nullpaused_at*|When the key was paused, or null. Use the customer-key pause and resume endpoints to change it
revoked*booleanrevoked_at*|nullrules*Rules for a key's read products; a request must also pass the endpoint's own
send*|The key's sending settings; null without the send product
customer_ref*|Customer reference, or null for an unassigned key
1 <= length <= 100// src/bin/management_pause_customer_key.rs
// Builds on the example project (/reference/json-rpc#example-project).
use swqos_examples::swqos::{Result, required};
#[tokio::main]
async fn main() -> Result<()> {
let key_id: String = required("KEY_ID")?;
let mut endpoint = reqwest::Url::parse("https://console.zerocopy.sh/api/v1/customer-keys/")?;
endpoint.path_segments_mut().map_err(|_| "invalid base URL")?
.pop_if_empty().push(&key_id);
endpoint.path_segments_mut().map_err(|_| "invalid base URL")?.push("pause");
let request = reqwest::Client::new()
.post(endpoint)
.bearer_auth(required("MANAGEMENT_API_KEY")?);
let request = if let Ok(etag) = std::env::var("KEY_ETAG") {
request.header("If-Match", etag)
} else {
request
};
// Reuse this key when retrying the same state change.
let request = request.header("Idempotency-Key", required("KEY_REQUEST_ID")?);
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(())
}{
"id": "key_012345abcdef",
"name": "Acme primary",
"products": [
"send"
],
"created_at": "2026-11-12T09:00:00Z",
"expires_at": null,
"paused_at": "2026-11-13T02:14:00Z",
"revoked": false,
"revoked_at": null,
"rules": {
"endpoints": {
"mode": "all"
},
"ips": [],
"origins": [],
"methods": {
"mode": "all",
"list": []
}
},
"send": {
"rate_per_second": 15,
"min_tip_lamports": 1000000
},
"customer_ref": "acme-123"
}