---
raw: true
search:
  tags:
    - Activity
    - POST
seo:
  description: >-
    Creates a webhook delivering the selected activity events to a public HTTPS
    endpoint. The… Reference for the POST /v1/webhooks endpoint in the Spacefast
    API.
sidebar:
  label: Create a webhook
  badge: POST
title: Create a webhook
type: openapi-operation
---
Creates a webhook delivering the selected activity events to a public HTTPS endpoint. The signing secret is returned only in this response.

`POST /v1/webhooks`

**Request body** (`application/json`, required)

- `teamId` (string)
- `url` (string<uri>, required)
- `events` (string[])

Request body example:

```json
{
  "teamId": "string",
  "url": "http://example.com",
  "events": [
    "*"
  ]
}
```

**Responses**

- `201` — Response for status 201
- `default` — Problem details (RFC 9457). Any 4xx/5xx response is one \`application/problem+json\` document.

Response example, 201:

```json
{
  "$schema": "http://example.com",
  "data": {
    "id": "string",
    "url": "http://example.com",
    "events": [
      "string"
    ],
    "status": "active",
    "secret": "string",
    "secretPreview": "string",
    "previousSecretExpiresAt": "2019-08-24T14:15:22Z",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z"
  }
}
```
