---
title: "createRepoWebhookSubscription"
---

> Documentation Index
> Fetch the complete documentation index at: https://buildrforge.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# createRepoWebhookSubscription

Path: Forge API › webhooks

`POST /repos/{repo_id}/webhooks/{extension_name}/{webhook}/subscription`

Subscribe the repo to a webhook, which gives it the URL to give the provider. A webhook whose secret Forge makes answers its first secret, the one time it is shown; subscribing again answers the same URL and no secret.

## Path parameters

- `repo_id` (`createRepoWebhookSubscription.path.repo_id`; string, required)
  - pattern: `^repo_[0-7][0-9a-hjkmnp-tv-z]{25}$`
- `extension_name` (`createRepoWebhookSubscription.path.extension_name`; string, required)
  - maxLength: `129` · pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*\.[a-z0-9]+(?:-[a-z0-9]+)*$`
- `webhook` (`createRepoWebhookSubscription.path.webhook`; string, required)
  - maxLength: `128` · pattern: `^[A-Za-z_][A-Za-z0-9_]*$`

## Code samples

### cURL

```bash
curl --request POST \
  --url '<base-url>/repos/<repo_id>/webhooks/<extension_name>/<webhook>/subscription'
```

### TypeScript

```typescript
const url = '<base-url>/repos/<repo_id>/webhooks/<extension_name>/<webhook>/subscription';
const options = {method: 'POST'};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/repos/<repo_id>/webhooks/<extension_name>/<webhook>/subscription"

response = requests.post(url)

print(response.text)
```

## Responses

### 201

RepoWebhookSubscription

#### Example

```json
{
  "url": "string",
  "secret": "string",
  "secret_set_at": "string"
}
```

- `url` (`createRepoWebhookSubscription.response.201.url`; string, required)
- `secret` (`createRepoWebhookSubscription.response.201.secret`; any of, required)
  - any of the following: `string`, `null`
- `secret_set_at` (`createRepoWebhookSubscription.response.201.secret_set_at`; any of, required)
  - any of the following: `string`, `null`

### 400

InvalidRequest

#### Example

```json
{
  "_tag": "InvalidRequest",
  "part": "path",
  "issues": [
    {
      "path": [
        "string"
      ],
      "message": "string"
    }
  ]
}
```

- `_tag` (`createRepoWebhookSubscription.response.400._tag`; string, required)
  - one of `"InvalidRequest"`
- `part` (`createRepoWebhookSubscription.response.400.part`; string, required)
  - one of `"path"`, `"query"`, `"headers"`, `"body"`
- `issues` (`createRepoWebhookSubscription.response.400.issues`; array of object, required)
  - `path` (`createRepoWebhookSubscription.response.400.issues.path`; array\<any of\>, required)
    - any of the following: `string`, `integer`
  - `message` (`createRepoWebhookSubscription.response.400.issues.message`; string, required)

### 401

InvalidCredentials

#### Example

```json
{
  "_tag": "InvalidCredentials"
}
```

- `_tag` (`createRepoWebhookSubscription.response.401._tag`; string, required)
  - one of `"InvalidCredentials"`

### 403

Forbidden | ForbiddenOrigin | RequiresPersonalSession | RunBranchRequired

#### Example

```json
{
  "_tag": "Forbidden",
  "message": "string"
}
```

Any of the following:

- `ForbiddenEncoded`
  - `_tag` (`ForbiddenEncoded._tag`; string, required)
    - one of `"Forbidden"`
  - `message` (`ForbiddenEncoded.message`; string, required)
- `ForbiddenOriginEncoded`
  - `_tag` (`ForbiddenOriginEncoded._tag`; string, required)
    - one of `"ForbiddenOrigin"`
- `RequiresPersonalSessionEncoded`
  - `_tag` (`RequiresPersonalSessionEncoded._tag`; string, required)
    - one of `"RequiresPersonalSession"`
- `RunBranchRequiredEncoded`
  - `_tag` (`RunBranchRequiredEncoded._tag`; string, required)
    - one of `"RunBranchRequired"`
  - `branch` (`RunBranchRequiredEncoded.branch`; string, required)
    - minLength: `1`
  - `message` (`RunBranchRequiredEncoded.message`; string, required)

### 404

ExtensionWebhookNotFound | RepoNotFound

#### Example

```json
{
  "_tag": "ExtensionWebhookNotFound",
  "extension_name": "string",
  "webhook": "string"
}
```

Any of the following:

- `ExtensionWebhookNotFoundEncoded`
  - `_tag` (`ExtensionWebhookNotFoundEncoded._tag`; string, required)
    - one of `"ExtensionWebhookNotFound"`
  - `extension_name` (`ExtensionWebhookNotFoundEncoded.extension_name`; string, required)
    - minLength: `1`
  - `webhook` (`ExtensionWebhookNotFoundEncoded.webhook`; string, required)
    - minLength: `1`
- `RepoNotFoundEncoded`
  - `_tag` (`RepoNotFoundEncoded._tag`; string, required)
    - one of `"RepoNotFound"`

### 409

RepoArchived

#### Example

```json
{
  "_tag": "RepoArchived"
}
```

- `_tag` (`createRepoWebhookSubscription.response.409._tag`; string, required)
  - one of `"RepoArchived"`

### 413

WriteTooLarge

#### Example

```json
{
  "_tag": "WriteTooLarge",
  "message": "string"
}
```

- `_tag` (`createRepoWebhookSubscription.response.413._tag`; string, required)
  - one of `"WriteTooLarge"`
- `message` (`createRepoWebhookSubscription.response.413.message`; string, required)

### 429

RateLimited

#### Example

```json
{
  "_tag": "RateLimited"
}
```

- `_tag` (`createRepoWebhookSubscription.response.429._tag`; string, required)
  - one of `"RateLimited"`

### 500

RepoFailure | OrgFailure

#### Example

```json
{
  "_tag": "RepoFailure",
  "reason": "string"
}
```

Every option has:

- `reason` (`<option>.reason`; string, required)

Any of the following, each adding:

- `RepoFailureEncoded`
  - `_tag` (`RepoFailureEncoded._tag`; string, required)
    - one of `"RepoFailure"`
- `OrgFailureEncoded`
  - `_tag` (`OrgFailureEncoded._tag`; string, required)
    - one of `"OrgFailure"`

### 503

ExtensionWebhookUnavailable | RepoBusy | SessionUnavailable | RateLimitUnavailable

#### Example

```json
{
  "_tag": "ExtensionWebhookUnavailable",
  "extension_name": "string",
  "webhook": "string"
}
```

Any of the following:

- `ExtensionWebhookUnavailableEncoded`
  - `_tag` (`ExtensionWebhookUnavailableEncoded._tag`; string, required)
    - one of `"ExtensionWebhookUnavailable"`
  - `extension_name` (`ExtensionWebhookUnavailableEncoded.extension_name`; string, required)
    - minLength: `1`
  - `webhook` (`ExtensionWebhookUnavailableEncoded.webhook`; string, required)
    - minLength: `1`
- `RepoBusyEncoded`
  - `_tag` (`RepoBusyEncoded._tag`; string, required)
    - one of `"RepoBusy"`
  - `message` (`RepoBusyEncoded.message`; string, required)
- `SessionUnavailableEncoded`
  - `_tag` (`SessionUnavailableEncoded._tag`; string, required)
    - one of `"SessionUnavailable"`
- `RateLimitUnavailableEncoded`
  - `_tag` (`RateLimitUnavailableEncoded._tag`; string, required)
    - one of `"RateLimitUnavailable"`


Source: https://buildrforge.com/docs/api/create-repo-webhook-subscription/index.md
