Rotate the AI key of a site

rotate_site_ai_key

Replaces the AI key of a site with a new one, so the old key stops working within a minute, everywhere.

A running preview gets the new key right away, but a published site keeps the old one until it is published again, so its AI answers 401 until then, and the tool tells the client to remind you to publish right after. needsPublish in the answer is true while the site is published, and the message then says to publish. Anything outside Modulify that used the old key breaks until the new one is pasted in.

The new key is not returned: the answer carries url, keyChangedAt and needsPublish, and get_site_ai_key reads the key. The tool tells the client to rotate only when a key has leaked or you ask, never as routine maintenance. It needs the Delete projects permission, like the rotate button beside the AI key. See Rotate the key.

Inputs

Input Type Required Description
projectId string Yes The site id.