← ClaudeAtlas

rotating-api-keyslisted

Rotates a Sendly API key with a grace period so callers roll over with zero downtime, using the Account Keys API. Covers issuing a replacement key, the one-time raw secret, and the overlap window. Applies when rotating, refreshing, or replacing an API key on a schedule or after a suspected leak.
SendlyHQ/sendly-skills · ★ 0 · AI & Automation · score 62
Install: claude install-skill SendlyHQ/sendly-skills
# Rotating API Keys with Sendly Rotation issues a **new** key and keeps the **old** one working for a grace period, so you can move every caller onto the new secret before the old one stops. The new secret's raw value is returned exactly once — store it immediately. ## Quick start ```typescript import Sendly from "@sendly/node"; const sendly = new Sendly(process.env.SENDLY_API_KEY!); const { newKey, oldKey, message } = await sendly.account.rotateApiKey("key_abc123"); console.log(newKey.key); // "sk_live_…" — shown once, save it now console.log(message); // "Old key will expire in 24 hours" ``` ## Authentication Send a Bearer token (`SENDLY_API_KEY`). Any valid key can rotate a key in its own workspace — no extra scope is required. The key you rotate does not have to be the key you authenticate with. ## REST API **Base URL:** `https://sendly.live/api/v1` ### Rotate a key ```bash curl -X POST https://sendly.live/api/v1/account/keys/key_abc123/rotate \ -H "Authorization: Bearer $SENDLY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"gracePeriodHours": 72}' ``` **Optional:** `gracePeriodHours` — how long the old key keeps working, 24–168 inclusive (default 24). Both keys are valid during this window. **Response (200):** ```json { "newKey": { "id": "key_def456", "name": "Production (rotated)", "type": "live", "prefix": "sk_live", "lastFour": "9f2a", "permissions": ["sms:send", "sms:read", "..."], "createdAt": "2026-07-09T1