Bernstein Webhook API
The Webhook API from Bernstein — 2 operation(s) for webhook.
The Webhook API from Bernstein — 2 operation(s) for webhook.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/bernstein-run:bernstein-run-webhook-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Bernstein Task Server Webhook API
description: 'Bernstein REST API - the open-source governance layer for AI agents, one git worktree per task.
## Authentication
Authentication is ENABLED by default. Include a Bearer token in all requests:
```
Authorization: Bearer
```
To run without auth (development only), set `BERNSTEIN_AUTH_DISABLED=1` - this logs a loud warning and passes every request through.
Public endpoints (no auth required): `/health`, `/health/ready`, `/health/live`, `/ready`, `/alive`, `/.well-known/agent.json`, `/docs`, `/openapi.json`, and the auth-flow endpoints (`/auth/login`, `/auth/oidc/callback`, etc.).
Webhook and hook endpoints (`/webhook`, `/webhooks/*`, `/hooks/{session_id}`) authenticate via HMAC-SHA256 signatures - they do NOT accept Bearer tokens.
## Base URL
Default: `http://127.0.0.1:8052`. Override with env vars `BERNSTEIN_HOST` and `BERNSTEIN_PORT`.
## Error Format
All errors return JSON with a `detail` field:
```json
{"detail": "Task not found: task-xyz"}
```
| Status | Meaning |
|--------|---------|
| 400 | Bad request (validation error) |
| 401 | Unauthorized (missing/invalid token) |
| 403 | Forbidden (IP not in allowlist) |
| 404 | Resource not found |
| 409 | Conflict (task already in terminal state) |
| 429 | Rate limited - respect the `Retry-After` header |
| 500 | Internal server error |'
version: 3.22.0
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
contact:
name: Alex Chernysh
url: https://github.com/sipyourdrink-ltd/bernstein
servers:
- url: http://{host}:{port}
description: Task server started by the Bernstein CLI on the operator's own machine. There is no hosted instance; substitute the host and port of your install.
variables:
host:
default: 127.0.0.1
description: Interface the task server binds to. Loopback by default.
port:
default: '8052'
description: Task server port. Override with BERNSTEIN_PORT.
tags:
- name: Webhook
paths:
/webhook:
post:
summary: Generic Webhook
description: 'Create a task directly from a generic inbound webhook payload.
The endpoint is intentionally small and separate from the trigger-manager
flow: callers POST a task-shaped payload and Bernstein creates one task.
``BERNSTEIN_WEBHOOK_SECRET`` must be configured (fail-closed; )
and each request must carry a fresh ``X-Bernstein-Timestamp`` header
plus a matching ``X-Bernstein-Webhook-Signature-256`` HMAC over
``f"{timestamp}.".encode() + body``. The plaintext
``X-Bernstein-Webhook-Secret`` fallback has been removed; callers
relying on it must upgrade to the HMAC + timestamp flow.
Automation bridge (#2512): an admitted trigger returns a signed,
chain-anchored trigger receipt in ``receipt`` so the calling platform holds
a proof of what it asked for rather than a bare task reference. A trigger
that fails authentication, or that replays a trigger id already admitted,
is refused with its own signed refusal receipt (HTTP 401 and 409
respectively) -- the negative path leaves a record, never a silent drop.'
operationId: generic_webhook_webhook_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookTaskCreate'
required: true
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookTaskResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Webhook
/api/v1/webhook:
post:
summary: Generic Webhook
description: 'Create a task directly from a generic inbound webhook payload.
The endpoint is intentionally small and separate from the trigger-manager
flow: callers POST a task-shaped payload and Bernstein creates one task.
``BERNSTEIN_WEBHOOK_SECRET`` must be configured (fail-closed; )
and each request must carry a fresh ``X-Bernstein-Timestamp`` header
plus a matching ``X-Bernstein-Webhook-Signature-256`` HMAC over
``f"{timestamp}.".encode() + body``. The plaintext
``X-Bernstein-Webhook-Secret`` fallback has been removed; callers
relying on it must upgrade to the HMAC + timestamp flow.
Automation bridge (#2512): an admitted trigger returns a signed,
chain-anchored trigger receipt in ``receipt`` so the calling platform holds
a proof of what it asked for rather than a bare task reference. A trigger
that fails authentication, or that replays a trigger id already admitted,
is refused with its own signed refusal receipt (HTTP 401 and 409
respectively) -- the negative path leaves a record, never a silent drop.'
operationId: generic_webhook_api_v1_webhook_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookTaskCreate'
required: true
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/WebhookTaskResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Webhook
components:
schemas:
CompletionSignalSchema:
properties:
type:
type: string
enum:
- path_exists
- glob_exists
- test_passes
- file_contains
- llm_review
- llm_judge
title: Type
value:
type: string
title: Value
type: object
required:
- type
- value
title: CompletionSignalSchema
description: Pydantic schema for a single completion signal in API requests.
WebhookTaskResponse:
properties:
task:
$ref: '#/components/schemas/TaskResponse'
receipt:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Receipt
type: object
required:
- task
title: WebhookTaskResponse
description: 'Serialized task returned by POST /webhook.
``receipt`` carries the signed, chain-anchored trigger receipt for the
admitted trigger (#2512) so the calling automation platform stores a proof
of what it asked for, not just a task reference. It is optional: an install
whose bridge state is unavailable still creates the task and returns
``None`` rather than failing the caller.'
ProgressEntry:
properties:
timestamp:
type: number
title: Timestamp
message:
type: string
title: Message
percent:
type: integer
title: Percent
type: object
required:
- timestamp
- message
- percent
title: ProgressEntry
description: Single entry in a task's progress_log.
TaskResponse:
properties:
id:
type: string
title: Id
title:
type: string
title: Title
description:
type: string
title: Description
role:
type: string
title: Role
tenant_id:
type: string
title: Tenant Id
priority:
type: integer
title: Priority
scope:
type: string
title: Scope
complexity:
type: string
title: Complexity
eu_ai_act_risk:
type: string
title: Eu Ai Act Risk
approval_required:
type: boolean
title: Approval Required
risk_level:
type: string
title: Risk Level
estimated_minutes:
anyOf:
- type: integer
- type: 'null'
title: Estimated Minutes
status:
type: string
title: Status
depends_on:
items:
type: string
type: array
title: Depends On
parent_task_id:
anyOf:
- type: string
- type: 'null'
title: Parent Task Id
depends_on_repo:
anyOf:
- type: string
- type: 'null'
title: Depends On Repo
owned_files:
items:
type: string
type: array
title: Owned Files
assigned_agent:
anyOf:
- type: string
- type: 'null'
title: Assigned Agent
result_summary:
anyOf:
- type: string
- type: 'null'
title: Result Summary
cell_id:
anyOf:
- type: string
- type: 'null'
title: Cell Id
repo:
anyOf:
- type: string
- type: 'null'
title: Repo
task_type:
type: string
title: Task Type
upgrade_details:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Upgrade Details
model:
anyOf:
- type: string
- type: 'null'
title: Model
effort:
anyOf:
- type: string
- type: 'null'
title: Effort
cli:
anyOf:
- type: string
- type: 'null'
title: Cli
batch_eligible:
type: boolean
title: Batch Eligible
default: false
completion_signals:
items:
additionalProperties:
type: string
type: object
type: array
title: Completion Signals
slack_context:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Slack Context
metadata:
additionalProperties: true
type: object
title: Metadata
created_at:
type: number
title: Created At
claimed_at:
anyOf:
- type: number
- type: 'null'
title: Claimed At
completed_at:
anyOf:
- type: number
- type: 'null'
title: Completed At
closed_at:
anyOf:
- type: number
- type: 'null'
title: Closed At
deadline:
anyOf:
- type: number
- type: 'null'
title: Deadline
progress_log:
items:
$ref: '#/components/schemas/ProgressEntry'
type: array
title: Progress Log
version:
type: integer
title: Version
default: 1
parent_session_id:
anyOf:
- type: string
- type: 'null'
title: Parent Session Id
retry_count:
type: integer
title: Retry Count
default: 0
max_retries:
type: integer
title: Max Retries
default: 3
retry_delay_s:
type: number
title: Retry Delay S
default: 0
terminal_reason:
anyOf:
- type: string
- type: 'null'
title: Terminal Reason
max_output_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Output Tokens
meta_messages:
items:
type: string
type: array
title: Meta Messages
max_turns:
anyOf:
- type: integer
- type: 'null'
title: Max Turns
artifact_spec:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Artifact Spec
type: object
required:
- id
- title
- description
- role
- tenant_id
- priority
- scope
- complexity
- eu_ai_act_risk
- approval_required
- risk_level
- estimated_minutes
- status
- depends_on
- parent_task_id
- depends_on_repo
- owned_files
- assigned_agent
- result_summary
- cell_id
- repo
- task_type
- upgrade_details
- model
- effort
- created_at
title: TaskResponse
description: Serialised task returned by every task endpoint.
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
WebhookTaskCreate:
properties:
id:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Id
title:
type: string
maxLength: 500
title: Title
description:
type: string
maxLength: 100000
title: Description
role:
type: string
title: Role
default: backend
tenant_id:
type: string
maxLength: 1000
title: Tenant Id
default: default
priority:
type: integer
title: Priority
default: 2
scope:
type: string
maxLength: 1000
title: Scope
default: medium
complexity:
type: string
maxLength: 1000
title: Complexity
default: medium
eu_ai_act_risk:
type: string
maxLength: 1000
title: Eu Ai Act Risk
default: minimal
approval_required:
type: boolean
title: Approval Required
default: false
risk_level:
type: string
maxLength: 1000
title: Risk Level
default: low
estimated_minutes:
anyOf:
- type: integer
- type: 'null'
title: Estimated Minutes
depends_on:
items:
type: string
type: array
maxItems: 100
title: Depends On
parent_task_id:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Parent Task Id
depends_on_repo:
anyOf:
- type: string
maxLength: 4096
- type: 'null'
title: Depends On Repo
owned_files:
items:
type: string
type: array
maxItems: 100
title: Owned Files
cell_id:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Cell Id
repo:
anyOf:
- type: string
maxLength: 4096
- type: 'null'
title: Repo
task_type:
type: string
maxLength: 1000
title: Task Type
default: standard
upgrade_details:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Upgrade Details
model:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Model
effort:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Effort
cli:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Cli
batch_eligible:
type: boolean
title: Batch Eligible
default: false
completion_signals:
items:
$ref: '#/components/schemas/CompletionSignalSchema'
type: array
maxItems: 100
title: Completion Signals
slack_context:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Slack Context
metadata:
additionalProperties: true
type: object
title: Metadata
deadline:
anyOf:
- type: number
- type: 'null'
title: Deadline
parent_session_id:
anyOf:
- type: string
maxLength: 1000
- type: 'null'
title: Parent Session Id
parent_context:
anyOf:
- type: string
maxLength: 100000
- type: 'null'
title: Parent Context
retry_count:
anyOf:
- type: integer
- type: 'null'
title: Retry Count
max_retries:
anyOf:
- type: integer
- type: 'null'
title: Max Retries
retry_delay_s:
anyOf:
- type: number
- type: 'null'
title: Retry Delay S
terminal_reason:
anyOf:
- type: string
maxLength: 100000
- type: 'null'
title: Terminal Reason
max_output_tokens:
anyOf:
- type: integer
- type: 'null'
title: Max Output Tokens
meta_messages:
anyOf:
- items:
type: string
type: array
maxItems: 100
- type: 'null'
title: Meta Messages
max_turns:
anyOf:
- type: integer
maximum: 10000
minimum: 1
- type: 'null'
title: Max Turns
artifact_spec:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Artifact Spec
type: object
required:
- title
- description
title: WebhookTaskCreate
description: Body for POST /webhook.