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

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

# Create subscription

POST https://api.plextera.com/api/public/v1/event-subscriptions
Content-Type: application/json

Creates an active webhook subscription and returns its generated signing secret.

- The Public API returns the secret only in this response.
- Delivery to `endpointUrl` starts immediately.
- Each workspace can have up to 50 subscriptions.


Reference: https://docs.plextera.com/api/api-reference/event-subscriptions/create-event-subscription

## Authentication

- `Authorization` header (required) — Use the API key format: `api-key <token>`.

## Request

### Body (application/json)

This endpoint expects a CreateEventSubscriptionRequest.

- `endpointUrl` (string, required) — HTTPS URL Plextera POSTs events to. Plain http, embedded user credentials, and fragments are rejected. Maximum length: 2048 characters.
- `eventTypes` (list of enum, required) — Event types to deliver. At least one is required.
  - Allowed values: `document-insights.extraction.completed`, `document-insights.extraction.failed`, `document-insights.extraction.rejected`, `workflow.run.completed`, `workflow.run.failed`
- `name` (string, optional) — Optional human-readable name used to distinguish subscriptions. When provided, it must not be blank; surrounding whitespace is removed. Maximum length: 128 characters.
- `filters` (EventSubscriptionFilter, optional) — Optional delivery filters. Currently supports `workflowId` for workflow events.

## Response

### 201

Subscription created and active. Includes the server-generated signing secret in this Public API response.

- `id` (string, required) — Subscription identifier.
- `status` (enum, required) — `active` after creation.
  - Allowed values: `active`, `paused`
- `endpointUrl` (string, required) — HTTPS URL events are delivered to.
- `eventTypes` (list of enum, required) — Event types this subscription receives.
  - Allowed values: `document-insights.extraction.completed`, `document-insights.extraction.failed`, `document-insights.extraction.rejected`, `workflow.run.completed`, `workflow.run.failed`
- `createdAt` (datetime, required) — UTC timestamp when the subscription was created.
- `updatedAt` (datetime, required) — UTC timestamp of the last subscription change.
- `signingSecret` (string, required) — Server-generated 256-bit secret used to verify webhook signatures. The Public API returns it only in the successful create response and has no reveal operation; authorized Plextera dashboard users can explicitly reveal the current secret. Store it securely. Plextera sends `X-Plextera-Signature` as `t=<unix timestamp>,v1=<HMAC-SHA256(timestamp + '.' + raw request body)>`.
- `name` (string, optional) — Optional human-readable name used to distinguish subscriptions.
- `filters` (EventSubscriptionFilter, optional) — Delivery filters. Omitted when none are configured.

## Errors

### 400 Bad Request Error

INVALID_REQUEST — The request is malformed: unreadable JSON, an invalid parameter value, or a bad multipart body.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 401 Unauthorized Error

UNAUTHORIZED — The API key is missing, malformed, or revoked.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 403 Forbidden Error

FORBIDDEN — The API key is valid but not allowed to perform this operation.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 405 Method Not Allowed Error

METHOD_NOT_ALLOWED — The HTTP method is not supported for this path.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 406 Not Acceptable Error

NOT_ACCEPTABLE — The requested response media type is not supported.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 409 Conflict Error

CONFLICT — The workspace has reached its event-subscription quota. Delete an unused subscription before creating another one.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 422 Unprocessable Entity Error

VALIDATION_FAILED — one or more request fields are invalid. See `details`.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 429 Too Many Requests Error

RATE_LIMITED — Too many requests in a short window. 429 responses are enforced at the network edge; the body may be plain text instead of this envelope, so rely on the status code and the Retry-After header.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

### 500 Internal Server Error

INTERNAL_ERROR — Unexpected failure inside Plextera. Retry with backoff; contact support with the requestId if it persists.

- `error` (ApiError, optional) — Machine-readable error details shared by every error response.

## Types

### EventSubscriptionFilter

Optional delivery filters for a subscription.

- `workflowId` (string, optional) — Optional workflow id filter. Applies only to workflow events. Unsupported filter fields are rejected instead of being silently ignored.

### ApiError

Machine-readable error details shared by every error response.

- `code` (string, optional) — Stable machine-readable error code. Branch your handling on this, not on `message`.
- `message` (string, optional) — Human-readable explanation. Wording may change; do not parse it.
- `requestId` (string, optional) — Unique request identifier, also returned in the X-Request-Id response header. Include it in support requests.
- `retryable` (boolean, optional) — True when retrying the same request later may succeed.
- `details` (list of ApiErrorDetail, optional) — Field-level validation issues. Present only for VALIDATION_FAILED.

### ApiErrorDetail

Field-level validation issue.

- `field` (string, optional) — Name of the invalid request field.
- `issue` (string, optional) — What is wrong with the field value.

## Examples

**Request**

```json
{
  "endpointUrl": "https://example.com/webhooks/plextera",
  "eventTypes": [
    "document-insights.extraction.completed"
  ]
}
```

**Response**

```json
{
  "id": "sub_01JY7MA0Q2D9V64ZFD0Y2J5K3T",
  "status": "active",
  "endpointUrl": "https://example.com/webhooks/plextera",
  "eventTypes": [
    "document-insights.extraction.completed",
    "document-insights.extraction.failed",
    "document-insights.extraction.rejected"
  ],
  "createdAt": "2026-04-07T10:00:00Z",
  "updatedAt": "2026-04-07T10:00:00Z",
  "signingSecret": "whsec_7AeR8m5nV2Yp4Lq6Jc9Tf3Ks1Dw0BxUoGhEiNzMaPQs",
  "name": "Production document events"
}
```

**SDK Code**

```python Created subscription
import requests

url = "https://api.plextera.com/api/public/v1/event-subscriptions"

payload = {
    "endpointUrl": "https://example.com/webhooks/plextera",
    "eventTypes": ["document-insights.extraction.completed"]
}
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Created subscription
const url = 'https://api.plextera.com/api/public/v1/event-subscriptions';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"endpointUrl":"https://example.com/webhooks/plextera","eventTypes":["document-insights.extraction.completed"]}'
};

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

```go Created subscription
package main

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

func main() {

	url := "https://api.plextera.com/api/public/v1/event-subscriptions"

	payload := strings.NewReader("{\n  \"endpointUrl\": \"https://example.com/webhooks/plextera\",\n  \"eventTypes\": [\n    \"document-insights.extraction.completed\"\n  ]\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 Created subscription
require 'uri'
require 'net/http'

url = URI("https://api.plextera.com/api/public/v1/event-subscriptions")

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  \"endpointUrl\": \"https://example.com/webhooks/plextera\",\n  \"eventTypes\": [\n    \"document-insights.extraction.completed\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.plextera.com/api/public/v1/event-subscriptions")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"endpointUrl\": \"https://example.com/webhooks/plextera\",\n  \"eventTypes\": [\n    \"document-insights.extraction.completed\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.plextera.com/api/public/v1/event-subscriptions', [
  'body' => '{
  "endpointUrl": "https://example.com/webhooks/plextera",
  "eventTypes": [
    "document-insights.extraction.completed"
  ]
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Created subscription
using RestSharp;

var client = new RestClient("https://api.plextera.com/api/public/v1/event-subscriptions");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"endpointUrl\": \"https://example.com/webhooks/plextera\",\n  \"eventTypes\": [\n    \"document-insights.extraction.completed\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Created subscription
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "endpointUrl": "https://example.com/webhooks/plextera",
  "eventTypes": ["document-insights.extraction.completed"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.plextera.com/api/public/v1/event-subscriptions")! 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()
```