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

# Register a webhook

POST https://<provided-by-saturn>/partner/webhooks
Content-Type: application/json

Subscribes one of your endpoints to a Saturn event.

`event_name` uses lower snake\_case in `resource.action` format, for example `fact_find.created`.

## Endpoint verification

Saturn immediately sends this signed request to your endpoint before storing the subscription:

```
POST <your endpoint>
Content-Type: application/json
X-Saturn-Signature: <hex HMAC-SHA256 of the body>
{"message": "Register Webhook", "event_name": "fact_find.created"}

```

Your endpoint must return 200 or 201 within 2 seconds. Any other status, a timeout, or an unreachable host returns 422 and stores nothing.

## Signature verification

`X-Saturn-Signature` is the hex-encoded HMAC-SHA256 of the raw request body under your `signing_secret`. Recompute it over the bytes received and use a constant-time comparison. Saturn never sends or returns the secret, so keep your own copy.

## Rules

* `endpoint` must be an HTTPS URL on a publicly reachable host.

* Registering the same event on different endpoints is allowed.

* Registering the same event on the same endpoint twice returns 409.

* Saturn identifies your firm from the API key.

Reference: https://developer.saturnos.com/partner/webhooks/register-a-webhook

## Authentication

- `Authorization` header (required) — API Key authentication via header

## Request

### Body (application/json)

This endpoint expects an object.

- `endpoint` (string, required)
- `event_name` (string, required)
- `signing_secret` (string, required)

## Response

### 201

Created

- `data` (PartnerWebhooksPostResponsesContentApplicationJsonSchemaData, required)
- `error` (PartnerWebhooksPostResponsesContentApplicationJsonSchemaError, required)
- `success` (boolean, required)

## Types

### PartnerWebhooksPostResponsesContentApplicationJsonSchemaData

- `endpoint` (string, required)
- `is_active` (boolean, required)
- `created_at` (datetime, required)
- `saturn_ref_id` (string, required)
- `event_subscribed` (string, required)

### PartnerWebhooksPostResponsesContentApplicationJsonSchemaError

- `message` (string, required)

## Examples

**Request**

```json
{
  "endpoint": "https://your-system.example.com/hooks/saturn",
  "event_name": "fact_find:created",
  "signing_secret": "a secret you generate and keep"
}
```

**Response**

```json
{
  "data": {
    "endpoint": "https://your-system.example.com/hooks/saturn",
    "is_active": true,
    "created_at": "2026-09-12T09:30:00Z",
    "saturn_ref_id": "3c1d0c8e-1f42-4a77-9a1e-2b0f6d5f4a10",
    "event_subscribed": "fact_find:created"
  },
  "error": {
    "message": ""
  },
  "success": true
}
```

**SDK Code**

```python Webhooks_Register a webhook_example
import requests

url = "https://api.example.com/partner/webhooks"

payload = {
    "endpoint": "https://your-system.example.com/hooks/saturn",
    "event_name": "fact_find:created",
    "signing_secret": "a secret you generate and keep"
}
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Webhooks_Register a webhook_example
const url = 'https://api.example.com/partner/webhooks';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"endpoint":"https://your-system.example.com/hooks/saturn","event_name":"fact_find:created","signing_secret":"a secret you generate and keep"}'
};

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

```go Webhooks_Register a webhook_example
package main

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

func main() {

	url := "https://api.example.com/partner/webhooks"

	payload := strings.NewReader("{\n  \"endpoint\": \"https://your-system.example.com/hooks/saturn\",\n  \"event_name\": \"fact_find:created\",\n  \"signing_secret\": \"a secret you generate and keep\"\n}")

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

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Webhooks_Register a webhook_example
require 'uri'
require 'net/http'

url = URI("https://api.example.com/partner/webhooks")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"endpoint\": \"https://your-system.example.com/hooks/saturn\",\n  \"event_name\": \"fact_find:created\",\n  \"signing_secret\": \"a secret you generate and keep\"\n}"

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

```java Webhooks_Register a webhook_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/partner/webhooks")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"endpoint\": \"https://your-system.example.com/hooks/saturn\",\n  \"event_name\": \"fact_find:created\",\n  \"signing_secret\": \"a secret you generate and keep\"\n}")
  .asString();
```

```php Webhooks_Register a webhook_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/partner/webhooks', [
  'body' => '{
  "endpoint": "https://your-system.example.com/hooks/saturn",
  "event_name": "fact_find:created",
  "signing_secret": "a secret you generate and keep"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Webhooks_Register a webhook_example
using RestSharp;

var client = new RestClient("https://api.example.com/partner/webhooks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"endpoint\": \"https://your-system.example.com/hooks/saturn\",\n  \"event_name\": \"fact_find:created\",\n  \"signing_secret\": \"a secret you generate and keep\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Webhooks_Register a webhook_example
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "endpoint": "https://your-system.example.com/hooks/saturn",
  "event_name": "fact_find:created",
  "signing_secret": "a secret you generate and keep"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/partner/webhooks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```