> For the complete documentation index, see [llms.txt](https://manual.personr.co/api-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.personr.co/api-documentation/workspaces/webhook-configuration.md).

# Webhook Configuration

Easily configure your webhook URL, and authorisation token using this endpoint. Alternatively, webhooks can also be setup within the [Dev Space](https://enterprise.personr.co/dashboard/dev-space) of the platform.

Personr supports one webhook endpoint per account/workspace. All requests will be sent to the endpoint provided.

{% hint style="info" %}
This endpoint can only be used by users with the Administrator role.
{% endhint %}

## Setup a webhook

<mark style="color:green;">`POST`</mark> `/api-webhook-configuration`

**Headers**

| Name          | Value                 |
| ------------- | --------------------- |
| Content-Type  | `multipart/form-data` |
| Authorization | `Bearer YOUR_TOKEN`   |

**Body**

| Name            | Type    | Description                                                                                                           |
| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
| `webhookUrl`    | string  | The endpoint you'd like requests posted to <mark style="color:red;">(Required)</mark>                                 |
| `generateToken` | boolean | Generate a bearer token that can be sent within the header of each request <mark style="color:red;">(Required)</mark> |
| `headerToken`   | boolean | Send the bearer token in the header of each request <mark style="color:red;">(Required)</mark>                        |

#### Request

{% tabs %}
{% tab title="cURL" %}

```sh
curl --location 'https://enterprise.personr.co/api/1.1/wf/api-webhook-configuration' \
--form 'webhookUrl="https://your-webhook-endpoint.com/abc"' \
--form 'generateToken="true"' \
--form 'headerToken="true"'
```

{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200 - OK" %}

```json
{
    "status": "success",
    "response": {
        "webhookUrl": "https://your-webhook-endpoint.com/abc",
        "token": "SK_f8aFpWUe430000000wHfDNBlS",
        "headerToken": true
    }
}
```

{% endtab %}

{% tab title="200 - Error" %}

```json
{
"error": "Unauthorised. User does not have permissions."
}
```

{% endtab %}
{% endtabs %}

Within the response, you'll receive the webhook endpoint you provided as confirmation, the bearer token that will be sent in the header of each request, and a boolean to confirm whether the token will be sent within the header.

If you choose not to generate a token within the request, the `token` in the response will be one of the following:

* The current (previously generated) token in use
* If no token has ever been generated on the account, then the response will be `null`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://manual.personr.co/api-documentation/workspaces/webhook-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
