> ## Documentation Index
> Fetch the complete documentation index at: https://developers.partoo.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> How to configure and subscribe to webhooks in Partoo.

You can set up webhooks either via the **Partoo interface** or through the **API**.

<AccordionGroup>
  <Accordion title="Set up via the app (Settings > Integrations > Webhooks)">
    From the app interface:

    <Frame>
      <img src="https://mintcdn.com/partoo/P_Jb4Af_6Al7QkYi/assets/images/guides/api/resources/settings/webhooks/page-webhook.png?fit=max&auto=format&n=P_Jb4Af_6Al7QkYi&q=85&s=f705d11a0e4cdd1ce6e3c5a9e8facc6d" alt="Webhook listing in the Partoo interface" width="2866" height="1012" data-path="assets/images/guides/api/resources/settings/webhooks/page-webhook.png" />
    </Frame>

    1. Go to **Settings > Integrations > Webhooks**
    2. Click **Create** to add a new webhook
    3. Provide a valid **callback URL** and choose one or more **event types**
    4. Optionally, test the endpoint before saving

    <Frame>
      <img src="https://mintcdn.com/partoo/P_Jb4Af_6Al7QkYi/assets/images/guides/api/resources/settings/webhooks/create-webhook.png?fit=max&auto=format&n=P_Jb4Af_6Al7QkYi&q=85&s=5f08acbb5dbc13eb2a1b48d45444d2f4" alt="Webhook creation form with callback URL and event type" width="2866" height="1232" data-path="assets/images/guides/api/resources/settings/webhooks/create-webhook.png" />
    </Frame>

    <Warning>
      The same URL can be reused for multiple events.\
      You cannot create multiple webhooks for the same event and `org_id` using different URLs.
    </Warning>
  </Accordion>

  <Accordion title="Set up via API">
    <Steps>
      <Step title="Choose the events you want to subscribe to">
        Each event type is independent. Choose only the ones you need.
      </Step>

      <Step title="Provide your webhook URL">
        You must supply a valid HTTPS URL that can receive `POST` requests.

        <Warning>
          The same URL can be reused for multiple events.\
          You cannot create multiple webhooks for the same event and `org_id` using different URLs.
        </Warning>
      </Step>

      <Step title="Include your org_id and event types">
        We use the `org_id` to ensure events go to the right organization.

        Required fields:

        * `url` – your endpoint
        * `org_id` – your organization ID
        * `event_type` – the event to subscribe to

        Optional fields:

        * `custom_headers` – custom HTTP headers to forward with each webhook request (e.g. for authentication). Keys must start with `X-` and must not use the `X-Partoo` prefix. Maximum 5 headers. Key max length: 128 characters. Value max length: 512 characters. The following characters are forbidden in header keys: space, `(`, `)`, `<`, `>`, `@`, `,`, `;`, `:`, `\`, `"`, `/`, `[`, `]`, `?`, `=`, `{`, `}`.
      </Step>

      <Step title="Verify response behavior">
        You must return a `200 OK` response to acknowledge receipt.

        <Warning>
          If your server returns a `5xx` error, we retry the request up to 5 times with exponential backoff.\
          For other errors (4xx), no retries occur.
        </Warning>
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>
