> This page is for version v2.
> For other versions, use one of these documentation indexes:
> - v1 (default): https://doc.youratlas.com/v1/llms.txt
> - v2: https://doc.youratlas.com/v2/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://doc.youratlas.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://doc.youratlas.com/_mcp/server.

# Rotate your webhook signing secret

POST https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate

Creates a new signing secret and returns it. Atlas signs with the new secret from now on. For the next 24 hours (until `previousExpiresAt`) each delivery is also signed with the old secret, so the `webhook-signature` header carries both signatures and your receiver keeps verifying while you switch over. No request body. Requires your API key.

Reference: https://doc.youratlas.com/api-reference/atlas-api/events-gateway/events-rotate-webhook-signing-secret

## Authentication

- `api-key` header (required) — Your Atlas API key. Get it from the Atlas Portal under Settings > API Keys.

## Response

### 200

The new signing secret

- `secret` (string, required) — Signing secret in Standard Webhooks format (`whsec_` followed by base64).
- `createdAt` (datetime, required) — When this secret was created (UTC).
- `previousExpiresAt` (datetime, optional) — Present after a rotation. Until this time (UTC) deliveries are also signed with the previous secret.

## Errors

### 401 Unauthorized Error

Invalid or missing API key

- `error` (ErrorError, optional)

### 500 Internal Server Error

Internal server error

- `error` (ErrorError, optional)

## Types

### ErrorError

- `message` (string, optional)
- `code` (string, optional)
- `requestId` (string, optional)

## Examples

**Response**

```json
{
  "secret": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD",
  "createdAt": "2026-11-21T10:00:00.000Z",
  "previousExpiresAt": "2026-11-22T10:00:00.000Z"
}
```

**SDK Code**

```python Events Gateway_eventsRotateWebhookSigningSecret_example
import requests

url = "https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate"

headers = {"api-key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Events Gateway_eventsRotateWebhookSigningSecret_example
const url = 'https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate';
const options = {method: 'POST', headers: {'api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Events Gateway_eventsRotateWebhookSigningSecret_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Events Gateway_eventsRotateWebhookSigningSecret_example
require 'uri'
require 'net/http'

url = URI("https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Events Gateway_eventsRotateWebhookSigningSecret_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate")
  .header("api-key", "<apiKey>")
  .asString();
```

```php Events Gateway_eventsRotateWebhookSigningSecret_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate', [
  'headers' => [
    'api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Events Gateway_eventsRotateWebhookSigningSecret_example
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Events Gateway_eventsRotateWebhookSigningSecret_example
import Foundation

let headers = ["api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/events-gateway/webhooks/signing-secret/rotate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```