Rotate an API key
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.disasm.dev/v1/keys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rotate"), Headers = { { "Authorization", "Bearer <token>" }, },};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "net/http" "io")
func main() {
url := "https://api.disasm.dev/v1/keys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.disasm.dev/v1/keys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rotate';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.disasm.dev/v1/keys/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rotate \ --header 'Authorization: Bearer <token>'Replaces the key. The old key stops working at once. The new key is returned once only, so store it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The API key ID (UUID).
Responses
Section titled “Responses”The key was rotated. The new plaintext key is returned once.
object
object
The new key. Returned once only.
Example
{ "key": { "id": "new-key-uuid", "key_hint": "dk_live_****wxyz", "label": "Production", "status": "active", "request_balance": 5000 }, "plaintext": "dk_live_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345", "message": "Key rotated successfully. Save the new key; it will not be shown again."}Headers
Section titled “Headers”Example
60Maximum requests per minute (60).
Example
59Requests remaining in the current window.
Example
1718000000Unix timestamp when the rate limit resets.
Missing or invalid API key.
object
A human-readable message describing what went wrong.
Example
{ "error": "Missing or invalid API key"}The requested resource does not exist or does not belong to you.
object
A human-readable message describing what went wrong.
Example
{ "error": "API key not found"}Rate limit exceeded. See the X-RateLimit-* response headers.
object
A human-readable message describing what went wrong.
Example
{ "error": "Rate limit exceeded"}Headers
Section titled “Headers”Example
60Maximum requests per minute (60).
Example
59Requests remaining in the current window.
Example
1718000000Unix timestamp when the rate limit resets.