ZeroCopyZeroCopy
ReferenceManagement API

Create a customer key

POST
/customer-keys

Requires the partner:write scope. Creates a customer key and returns its secret once, after all eight vanity tip accounts are live. Before then, creation returns 409 tip_accounts_not_live. The name is trimmed and must contain 1 to 64 characters. customer_ref is optional, trimmed to 1 to 100 characters, or null. Only name and customer_ref are accepted; products, rules, expiry and send settings cannot be set. Customer keys use send and do not count toward the own-key limit.

Authorization

managementKey
headerAuthorizationBearer <zc_mgmt_>

Header Parameters

Idempotency-Key?string

Makes a retry return the first successful response instead of creating another customer key

Length1 <= length <= 255

Request Body

application/json
  1. body
name*string
Length1 <= length <= 64
customer_ref?|

Trimmed customer reference; null leaves the key unassigned

Length1 <= length <= 100

Response Body

The key and its secret, shown once

application/json
  1. response
key*
secret*string

The key's secret, returned once and never again

Example request
// src/bin/management_create_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 CustomerKeyCreate {
    name: String,
    customer_ref: String,
}

#[tokio::main]
async fn main() -> Result<()> {
    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 = CustomerKeyCreate { name, customer_ref: required("CUSTOMER_REF")? };
    let endpoint = reqwest::Url::parse("https://console.zerocopy.sh/api/v1/customer-keys")?;
    let request = reqwest::Client::new()
        .post(endpoint)
        .bearer_auth(required("MANAGEMENT_API_KEY")?);
    // Reuse this key and the same body when retrying this creation attempt.
    let request = request.header("Idempotency-Key", required("KEY_REQUEST_ID")?);
    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
{
  "key": {
    "id": "key_012345abcdef",
    "name": "Acme primary",
    "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-123"
  },
  "secret": "zc_live_ExampleOnly0123456789abc"
}