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

# Add a webhook endpoint

POST https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints
Content-Type: application/json

Events are POSTed as JSON and signed per the Standard Webhooks spec (`webhook-id`, `webhook-timestamp`, `webhook-signature`). The signing `secret` is returned once. Failed deliveries are retried for about a day.

Reference: https://docs.skaitra.com/api/api-zinynas/webhooks/webhook-endpoints-create

## Authentication

- `Authorization` header (bearer token, required) — Skaitra API key (`skt_…`).
- `Authorization` header (bearer token, required) — OAuth 2.1 access token issued for the Skaitra resource (`/mcp`); see /.well-known/oauth-protected-resource.

## Request

### Headers

- `Idempotency-Key` (string, optional) — Any unique value; a retry with the same key returns the first result.

### Body (application/json)

This endpoint expects an object.

- `url` (string, required) — An https:// address.
- `eventTypes` (list of WebhookEndpointsPostRequestBodyContentApplicationJsonSchemaEventTypesItems, required)
- `description` (string, optional)

## Response

### 201

OK

- `endpoint` (WebhookEndpoint, required)
- `secret` (string, required)

## Errors

### 400 Bad Request Error

The request is invalid; `error.details.issues` lists the problems.

- `error` (ErrorError, required)

### 401 Unauthorized Error

The API key is missing, invalid, expired or revoked.

- `error` (ErrorError, required)

### 403 Forbidden Error

The key lacks a scope or access to the company.

- `error` (ErrorError, required)

### 404 Not Found Error

Not found, or not visible to this key.

- `error` (ErrorError, required)

### 409 Conflict Error

A request with the same Idempotency-Key is still running.

- `error` (ErrorError, required)

### 412 Precondition Failed Error

The resource changed since you read it (If-Match).

- `error` (ErrorError, required)

### 422 Unprocessable Entity Error

The Idempotency-Key was used for a different request.

- `error` (ErrorError, required)

### 428 Precondition Error

The operation needs If-Match.

- `error` (ErrorError, required)

## Types

### WebhookEndpointsPostRequestBodyContentApplicationJsonSchemaEventTypesItems

### WebhookEndpoint

- `id` (string, required)
- `url` (string, required)
- `description` (string, required, nullable)
- `eventTypes` (list of WebhookEndpointEventTypesItems, required)
- `enabled` (boolean, required)
- `createdAt` (string, required)
- `lastSuccessAt` (string, required, nullable)
- `lastFailureAt` (string, required, nullable)

### ErrorError

- `code` (enum, required)
  - Allowed values: `INVALID_API_KEY`, `INSUFFICIENT_SCOPE`, `COMPANY_ACCESS_DENIED`, `NOT_FOUND`, `VALIDATION_ERROR`, `INVALID_CURSOR`, `METHOD_NOT_ALLOWED`, `PRECONDITION_REQUIRED`, `PRECONDITION_FAILED`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_KEY_IN_USE`, `CONFLICT`, `PAYLOAD_TOO_LARGE`, `UNSUPPORTED_MEDIA_TYPE`, `STORAGE_UNAVAILABLE`, `FORBIDDEN`, `FEATURE_NOT_INCLUDED`, `RATE_LIMITED`, `APPROVAL_REQUIRED`, `APPROVAL_PENDING`, `APPROVAL_REJECTED`, `INTERNAL_ERROR`
- `message` (string, required)
- `hint` (string, optional)
- `details` (map from string to any, optional)

### WebhookEndpointEventTypesItems

## Examples

**Request**

```json
{
  "url": "string",
  "eventTypes": [
    "document.received"
  ]
}
```

**Response**

```json
{
  "endpoint": {
    "id": "string",
    "url": "string",
    "description": "string",
    "eventTypes": [
      "document.received"
    ],
    "enabled": true,
    "createdAt": "string",
    "lastSuccessAt": "string",
    "lastFailureAt": "string"
  },
  "secret": "string"
}
```

**SDK Code**

```python
import requests

url = "https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints"

payload = {
    "url": "string",
    "eventTypes": ["document.received"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"url":"string","eventTypes":["document.received"]}'
};

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

```go
package main

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

func main() {

	url := "https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints"

	payload := strings.NewReader("{\n  \"url\": \"string\",\n  \"eventTypes\": [\n    \"document.received\"\n  ]\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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
require 'uri'
require 'net/http'

url = URI("https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"string\",\n  \"eventTypes\": [\n    \"document.received\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"string\",\n  \"eventTypes\": [\n    \"document.received\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints', [
  'body' => '{
  "url": "string",
  "eventTypes": [
    "document.received"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"string\",\n  \"eventTypes\": [\n    \"document.received\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "url": "string",
  "eventTypes": ["document.received"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://jusu-agentura.skaitra.com/api/v1/webhook-endpoints")! 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()
```