Rotate an expiring API key

Duplicate an expiring key’s available settings, restore omitted limits and expiry, validate the replacement, then revoke the old secret without downtime.

Last reviewed

Rotation requires an overlap: create and validate the replacement while the existing key still works, then revoke the old credential after every client has moved.

Four panels show duplicating settings, restoring limits and expiry, deploying the replacement secret, and allowing five minutes before verifying the revoked key fails.
Four panels show duplicating settings, restoring limits and expiry, deploying the replacement secret, and allowing five minutes before verifying the revoked key fails. Open full-size screenshot.

Before you rotate

Open Profile → API keys at /profile/api and expand the expiring key. The UI marks future dates as Expires date and highlights keys expiring within 30 days. Expired keys still count toward the free-plan cap of 3 and the absolute cap of 20.

Keys cannot be edited. Duplicate settings opens a replacement draft, but the expiry starts at Never expires and stored usage limits start blank because the list endpoint does not return them. S3 secret material is not copied.

Steps

  1. Inventory every client using the old key, including its protocol, workspace, folder reach, IP or active-hours guard, and any usage ceiling recorded outside Dosya.
  2. Select Duplicate settings, change the name to identify the rotation, then review Restrictions and expiry instead of assuming every field was cloned.
  3. Re-enter requests per minute, download per day, maximum file size, and concurrent-transfer limits; choose Expires in 30 days, Expires in 90 days, or Never expires deliberately.
  4. Press Generate key, copy the dos_… secret from the one-time is ready dialog, and create new S3 credentials separately when the client uses that gateway.
  5. Deploy the replacement to one client at a time and prove an actual allowed request plus its expected reach before removing the former secret.
  6. Expand the old row, choose Revoke, read the irreversible warning, confirm, and verify the retired credential is refused while the replacement continues.

Timing and recovery

Authentication checks expiry when loading a key, while the auth cache lives for 300 seconds. Treat the displayed deadline as the stop time and rotate early; do not depend on a warm cache extending access. Revocation irreversibly deletes the row and schedules deletion of REST and S3 cache entries. Stop the old client, allow up to five minutes for cached authentication, and verify refusal before treating the retired secret as unusable everywhere.

If a Free account has 3 keys, deleting an unused key or upgrading can create room. The absolute limit is 20 keys on every plan, so reaching 20 requires deleting a confirmed-unused credential; an upgrade cannot raise that ceiling. Do not revoke the active key merely to make room until a safe replacement path exists.

Expected result

The integration operates with the newly generated secret and restored restrictions. The old key is absent from active use and returns an authentication failure after irrevocable revocation.

Reference for “Rotate an expiring API key”: Dosya REST API overview page with Get API Key and View SDKs links.
Reference for “Rotate an expiring API key”: Dosya REST API overview page with Get API Key and View SDKs links. Open full-size screenshot.

Was this helpful?

Loading helpfulness results…

Voting saves a necessary ballot cookie for up to 180 days so you can change your answer.

Questions and replies

Ask about the steps in this guide. Questions are reviewed before publication.

Keep account details, credentials and private files out of public questions. Use private support for those.

Loading questions…

    Sign in to your Dosya account to ask a question.

    Check the outcome before you retry

    Use these shared checks when a task needs a second look.