ZeroCopyZeroCopy
ReferenceManagement API

Update a customer key

PATCH
/customer-keys/{id}

Requires the partner:write scope. Updates a customer key's name or customer reference and returns its current fields. Omitted fields keep their values. Set customer_ref to null to clear it. A name is trimmed to 1 to 64 characters; a non-null customer reference is trimmed to 1 to 100 characters. Only these two fields are accepted; products, rules, expiry and send settings cannot be changed. An empty patch returns 400 invalid_request.

Authorization

managementKey
headerAuthorizationBearer <zc_mgmt_>

Path Parameters

id*string
Match^key_[0-9a-f]{12}$

Header Parameters

If-Match?string

Change only the key version last read; a stale validator returns 412

Request Body

application/json
  1. body

Change name or customer reference; omitted fields keep their values

name?string
Length1 <= length <= 64
customer_ref?|

Trimmed customer reference; null leaves the key unassigned

Length1 <= length <= 100

Response Body

The key as changed

application/json
  1. response
id*string
name*string|null
products*array<>
created_at*|null
expires_at*|null
paused_at*|

When the key was paused, or null. Use the customer-key pause and resume endpoints to change it

revoked*boolean
revoked_at*|null
rules*

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

Length1 <= length <= 100

Change name or customer reference; omitted fields keep their values

Example request
// src/bin/management_update_customer_key.rs
// Builds on the example project (/reference/json-rpc#example-project).
use swqos_examples::swqos::{Result, required};

use serde::Serialize;

#[derive(Serialize)]
struct CustomerKeyPatch {
    name: String,
}

#[tokio::main]
async fn main() -> Result<()> {
    let key_id: String = required("KEY_ID")?;
    let name = required("KEY_NAME")?.trim().to_owned();
    if !(1..=64).contains(&name.chars().count()) {
        return Err("KEY_NAME must have 1 to 64 characters after trimming".into());
    }
    let payload = CustomerKeyPatch { name };
    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);
    let request = reqwest::Client::new()
        .patch(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
    };
    let request = request.json(&payload);
    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(())
}
Example response
{
  "id": "key_012345abcdef",
  "name": "Acme production",
  "products": [
    "send"
  ],
  "created_at": "2026-11-12T09:00:00Z",
  "expires_at": null,
  "paused_at": null,
  "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-prod"
}