> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.goodflag.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.goodflag.com/_mcp/server.

# Créer un webhook global

POST https://workflow-manager/api/tenants/{tenantId}/webhooks
Content-Type: application/json

Crée un webhook recevant les événements de tous les parapheurs du tenant.

`tenantManager`

Reference: https://docs.goodflag.com/wm/api-reference/documentation-api/token-portail/webhooks/create-global-webhook

## Authentication

- `Authorization` header (bearer token, required) — Authentification Bearer par jeton utilisateur ou jeton d'accès : `Authorization: Bearer <token>`.

## Request

### Path parameters

- `tenantId` (string, required) — L'identifiant du tenant.

### Body (application/json)

This endpoint expects an object.

- `endpointUrl` (string, required) — L'URL de l'endpoint du webhook.
- `notifiedEvents` (list of string, required) — Les types d'événements notifiés au webhook.

## Response

### 200

Créer un webhook global

- `created` (long, required) — La date de création de l'entité.
- `endpointUrl` (string, required) — L'URL de l'endpoint du webhook.
- `id` (string, required) — L'identifiant du webhook.
- `notifiedEvents` (list of string, required) — Les types d'événements notifiés au webhook.
- `tenantId` (string, required) — L'identifiant du tenant auquel appartient le webhook.
- `updated` (long, required) — La date de dernière modification de l'entité.
- `customHeaders` (map from string to any, optional) — Une liste d'en-têtes personnalisés, chacun composé d'une clé et d'une valeur.
- `userId` (string, optional) — L'identifiant de l'utilisateur auquel appartient le webhook, dans le cas d'un webhook utilisateur.

## Errors

### 400 Bad Request Error

InvalidRequestField : Un champ de la requête porte une valeur incorrecte.

- `status` (integer, required) — Le code de statut HTTP.
- `error` (string, required) — Le message de statut HTTP.
- `message` (string, required) — Le message d'erreur.
- `code` (string, required) — Le code d'erreur.

### 403 Forbidden Error

AuthenticatedUserDisabled : L'utilisateur authentifié est désactivé. ; MissingBearerToken : Un jeton Bearer est requis. ; TenantInactive : Le tenant est inactif et n'autorise aucune opération. ; UserGroupDisabled : Le groupe de l'utilisateur spécifié est désactivé. ; UserNotAllowed : L'utilisateur authentifié n'est pas autorisé à effectuer cette opération.

- `status` (integer, required) — Le code de statut HTTP.
- `error` (string, required) — Le message de statut HTTP.
- `message` (string, required) — Le message d'erreur.
- `code` (string, required) — Le code d'erreur.

## Examples

**Request**

```json
{
  "endpointUrl": "https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T",
  "notifiedEvents": [
    "commentCreated",
    "recipientRefused",
    "recipientFinished",
    "workflowStarted",
    "workflowStopped",
    "coManagerRemoved",
    "coManagerAdded",
    "workflowFinished"
  ]
}
```

**Response**

```json
{
  "created": 1782821302480,
  "endpointUrl": "https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T",
  "id": "wbh_BJCJtTyKUJfVfu4TFuRt86BR",
  "notifiedEvents": [
    "commentCreated",
    "recipientRefused",
    "recipientFinished",
    "workflowStarted",
    "workflowStopped",
    "workflowFinished",
    "coManagerRemoved",
    "coManagerAdded"
  ],
  "tenantId": "ten_Hm5gqY6oKADYdg9cjhsVbQDH",
  "updated": 1782821302480,
  "customHeaders": {}
}
```

**SDK Code**

```python Requête réussie.
import requests

url = "https://workflow-manager/api/tenants/tenantId/webhooks"

payload = {
    "endpointUrl": "https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T",
    "notifiedEvents": ["commentCreated", "recipientRefused", "recipientFinished", "workflowStarted", "workflowStopped", "coManagerRemoved", "coManagerAdded", "workflowFinished"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Requête réussie.
const url = 'https://workflow-manager/api/tenants/tenantId/webhooks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"endpointUrl":"https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T","notifiedEvents":["commentCreated","recipientRefused","recipientFinished","workflowStarted","workflowStopped","coManagerRemoved","coManagerAdded","workflowFinished"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Requête réussie.
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://workflow-manager/api/tenants/tenantId/webhooks"

	payload := strings.NewReader("{\n  \"endpointUrl\": \"https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T\",\n  \"notifiedEvents\": [\n    \"commentCreated\",\n    \"recipientRefused\",\n    \"recipientFinished\",\n    \"workflowStarted\",\n    \"workflowStopped\",\n    \"coManagerRemoved\",\n    \"coManagerAdded\",\n    \"workflowFinished\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Requête réussie.
require 'uri'
require 'net/http'

url = URI("https://workflow-manager/api/tenants/tenantId/webhooks")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"endpointUrl\": \"https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T\",\n  \"notifiedEvents\": [\n    \"commentCreated\",\n    \"recipientRefused\",\n    \"recipientFinished\",\n    \"workflowStarted\",\n    \"workflowStopped\",\n    \"coManagerRemoved\",\n    \"coManagerAdded\",\n    \"workflowFinished\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Requête réussie.
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://workflow-manager/api/tenants/tenantId/webhooks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"endpointUrl\": \"https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T\",\n  \"notifiedEvents\": [\n    \"commentCreated\",\n    \"recipientRefused\",\n    \"recipientFinished\",\n    \"workflowStarted\",\n    \"workflowStopped\",\n    \"coManagerRemoved\",\n    \"coManagerAdded\",\n    \"workflowFinished\"\n  ]\n}")
  .asString();
```

```php Requête réussie.
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://workflow-manager/api/tenants/tenantId/webhooks', [
  'body' => '{
  "endpointUrl": "https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T",
  "notifiedEvents": [
    "commentCreated",
    "recipientRefused",
    "recipientFinished",
    "workflowStarted",
    "workflowStopped",
    "coManagerRemoved",
    "coManagerAdded",
    "workflowFinished"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Requête réussie.
using RestSharp;

var client = new RestClient("https://workflow-manager/api/tenants/tenantId/webhooks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"endpointUrl\": \"https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T\",\n  \"notifiedEvents\": [\n    \"commentCreated\",\n    \"recipientRefused\",\n    \"recipientFinished\",\n    \"workflowStarted\",\n    \"workflowStopped\",\n    \"coManagerRemoved\",\n    \"coManagerAdded\",\n    \"workflowFinished\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Requête réussie.
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "endpointUrl": "https://my-company.com/CUWoWaoqnWqdenkXCCFW9i2T",
  "notifiedEvents": ["commentCreated", "recipientRefused", "recipientFinished", "workflowStarted", "workflowStopped", "coManagerRemoved", "coManagerAdded", "workflowFinished"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://workflow-manager/api/tenants/tenantId/webhooks")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```