## Create

**post** `/teams/{teamId}/webhook-endpoints`

Register a new webhook endpoint for the team, at most 10 of them. The response carries the secret, which is never returned again

### Path Parameters

- `teamId: string`

### Body Parameters

- `enabledEvents: array of "*" or "asset.download.completed" or "asset.download.created" or 16 more`

  The events that trigger the webhook. ['*'] indicates that all events are enabled

  - `"*"`

  - `"asset.download.completed"`

  - `"asset.download.created"`

  - `"asset.download.failed"`

  - `"generation.completed"`

  - `"generation.created"`

  - `"generation.failed"`

  - `"inference.cancelled"`

  - `"inference.completed"`

  - `"inference.created"`

  - `"inference.failed"`

  - `"model.download.completed"`

  - `"model.download.created"`

  - `"model.download.failed"`

  - `"model.training.cancelled"`

  - `"model.training.completed"`

  - `"model.training.failed"`

  - `"model.training.started"`

  - `"team.credit.threshold.crossed"`

- `url: string`

  The URL of the webhook endpoint. Must be an absolute http(s) URL

- `description: optional string`

  A description of the webhook endpoint

### Returns

- `webhookEndpoint: object { id, createdAt, enabled, 9 more }`

  The creation response, and the only one that carries the secret: it is
  generated once and never returned again, so a client that loses it has to
  recreate the endpoint.

  - `id: string`

    The ID of the webhook endpoint

  - `createdAt: string`

    The date and time the webhook endpoint was created

  - `enabled: boolean`

    Whether the webhook is enabled

  - `enabledEvents: array of "*" or "asset.download.completed" or "asset.download.created" or 16 more`

    The events that trigger the webhook. ['*'] indicates that all events are enabled

    - `"*"`

    - `"asset.download.completed"`

    - `"asset.download.created"`

    - `"asset.download.failed"`

    - `"generation.completed"`

    - `"generation.created"`

    - `"generation.failed"`

    - `"inference.cancelled"`

    - `"inference.completed"`

    - `"inference.created"`

    - `"inference.failed"`

    - `"model.download.completed"`

    - `"model.download.created"`

    - `"model.download.failed"`

    - `"model.training.cancelled"`

    - `"model.training.completed"`

    - `"model.training.failed"`

    - `"model.training.started"`

    - `"team.credit.threshold.crossed"`

  - `nbFailedCalls: number`

    The number of calls to the webhook endpoint that have failed

  - `nbTotalCalls: number`

    The number of calls to the webhook endpoint

  - `ownerId: string`

    The ID of the owner of the webhook endpoint: a project id for job
    lifecycle events, a team id for alert events

  - `ownerType: "project" or "team"`

    Whether the owner is a project or a team. Required to tell them apart: a
    project created before the team/project split shares its team's id

    - `"project"`

    - `"team"`

  - `secret: string`

    The endpoint's secret, used to generate webhook signatures

  - `updatedAt: string`

    The date and time the webhook endpoint was updated

  - `url: string`

    The URL of the webhook endpoint

  - `description: optional string`

    A description of the webhook endpoint

### Example

```http
curl https://api.cloud.scenario.com/v1/teams/$TEAM_ID/webhook-endpoints \
    -H 'Content-Type: application/json' \
    -u "$SCENARIO_SDK_API_KEY:SCENARIO_SDK_API_SECRET" \
    -d '{
          "enabledEvents": [
            "*"
          ],
          "url": "url"
        }'
```

#### Response

```json
{
  "webhookEndpoint": {
    "id": "id",
    "createdAt": "createdAt",
    "enabled": true,
    "enabledEvents": [
      "*"
    ],
    "nbFailedCalls": 0,
    "nbTotalCalls": 0,
    "ownerId": "ownerId",
    "ownerType": "project",
    "secret": "secret",
    "updatedAt": "updatedAt",
    "url": "url",
    "description": "description"
  }
}
```
