Skip to main content
POST
/
api
/
v1
/
webhooks
Create Webhook
curl --request POST \
  --url https://api.example.com/api/v1/webhooks
Create a new webhook to receive notifications when test runs complete.

Request

POST /api/v1/webhooks
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Body Parameters

ParameterTypeRequiredDescription
urlstringYesDestination URL for webhook deliveries
secretstringNoHMAC signing secret for verification
descriptionstringNoOptional description
agent_idstringNoAgent UUID for agent-level webhook
is_enabledbooleanNoWhether the webhook is active (default: true)
Each organization can have one org-level webhook (no agent_id) and one webhook per agent.

Response (201)

FieldTypeDescription
idstringWebhook UUID
urlstringDestination URL
descriptionstringDescription (or null)
agent_idstringAgent UUID (or null for org-level)
is_enabledbooleanWhether the webhook is active
created_atstringISO-8601 creation timestamp
updated_atstringISO-8601 last update timestamp

Examples

# Create org-level webhook
curl -X POST "https://app.preclinical.dev/api/v1/webhooks" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhook",
    "secret": "my-signing-secret",
    "description": "Main notification webhook"
  }'

# Create agent-specific webhook
curl -X POST "https://app.preclinical.dev/api/v1/webhooks" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/webhook/agent1",
    "agent_id": "agent-uuid",
    "secret": "agent-specific-secret"
  }'

Success Response

{
  "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
  "url": "https://example.com/webhook",
  "description": "Main notification webhook",
  "agent_id": null,
  "is_enabled": true,
  "created_at": "2026-01-30T10:00:00Z",
  "updated_at": "2026-01-30T10:00:00Z"
}

Errors

CodeDescription
MISSING_REQUIRED_FIELDURL is required
INVALID_FIELD_VALUEInvalid URL format
ALREADY_EXISTSA webhook already exists for this scope
NOT_FOUNDAgent not found (if agent_id provided)