Webhooks

Note

This page is about how to modify webhook settings themselves through the REST API. If you just want to know how webhooks work, go here: Webhooks

Resource description

The webhook resource contains the following public fields:

Field

Type

Description

id

integer

Internal ID of the webhook

enabled

boolean

If false, this webhook will not receive any notifications

target_url

string

The URL to call

all_events

boolean

If true, this webhook will receive notifications on all events of this organizer

limit_events

list of strings

If all_events is false, this is a list of event slugs this webhook is active for

action_types

list of strings

A list of action type filters that limit the notifications sent to this webhook. See below for valid values

comment

string

Internal comment on this webhook, default null

The following values for action_types are valid with pretix core:

  • pretix.event.order.placed

  • pretix.event.order.placed.require_approval

  • pretix.event.order.paid

  • pretix.event.order.canceled

  • pretix.event.order.reactivated

  • pretix.event.order.expired

  • pretix.event.order.expirychanged

  • pretix.event.order.modified

  • pretix.event.order.contact.changed

  • pretix.event.order.changed.*

  • pretix.event.order.refund.created

  • pretix.event.order.refund.created.externally

  • pretix.event.order.refund.requested

  • pretix.event.order.refund.done

  • pretix.event.order.refund.canceled

  • pretix.event.order.refund.failed

  • pretix.event.order.payment.confirmed

  • pretix.event.order.approved

  • pretix.event.order.denied

  • pretix.event.orders.waitinglist.added

  • pretix.event.orders.waitinglist.changed

  • pretix.event.orders.waitinglist.deleted

  • pretix.event.orders.waitinglist.voucher_assigned

  • pretix.event.checkin

  • pretix.event.checkin.reverted

  • pretix.event.added

  • pretix.event.changed

  • pretix.event.deleted

  • pretix.subevent.added

  • pretix.subevent.changed

  • pretix.subevent.deleted

  • pretix.event.item.*

  • pretix.event.live.activated

  • pretix.event.live.deactivated

  • pretix.event.testmode.activated

  • pretix.event.testmode.deactivated

  • pretix.customer.created

  • pretix.customer.changed

  • pretix.customer.anonymized

Installed plugins might register more valid values.

Endpoints

GET /api/v1/organizers/(organizer)/webhooks/

Returns a list of all webhooks within a given organizer.

Example request:

GET /api/v1/organizers/bigevents/webhooks/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 2,
      "enabled": true,
      "target_url": "https://httpstat.us/200",
      "all_events": false,
      "limit_events": ["democon"],
      "action_types": ["pretix.event.order.modified", "pretix.event.order.changed.*"],
      "comment": null
    }
  ]
}
Query Parameters:
  • page (integer) – The page number in case of a multi-page result set, default is 1

Parameters:
  • organizer – The slug field of the organizer to fetch

Status Codes:
GET /api/v1/organizers/(organizer)/webhooks/(id)/

Returns information on one webhook, identified by its ID.

Example request:

GET /api/v1/organizers/bigevents/webhooks/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
  "id": 2,
  "enabled": true,
  "target_url": "https://httpstat.us/200",
  "all_events": false,
  "limit_events": ["democon"],
  "action_types": ["pretix.event.order.modified", "pretix.event.order.changed.*"],
  "comment": null
}
Parameters:
  • organizer – The slug field of the organizer to fetch

  • id – The id field of the webhook to fetch

Status Codes:
POST /api/v1/organizers/(organizer)/webhooks/

Creates a new webhook

Example request:

POST /api/v1/organizers/bigevents/webhooks/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json

{
  "enabled": true,
  "target_url": "https://httpstat.us/200",
  "all_events": false,
  "limit_events": ["democon"],
  "action_types": ["pretix.event.order.modified", "pretix.event.order.changed.*"],
  "comment": "Called for changes"
}

Example response:

HTTP/1.1 201 Created
Vary: Accept
Content-Type: application/json

{
  "id": 3,
  "enabled": true,
  "target_url": "https://httpstat.us/200",
  "all_events": false,
  "limit_events": ["democon"],
  "action_types": ["pretix.event.order.modified", "pretix.event.order.changed.*"],
  "comment": "Called for changes"
}
Parameters:
  • organizer – The slug field of the organizer to create a webhook for

Status Codes:
PATCH /api/v1/organizers/(organizer)/webhooks/(id)/

Update a webhook. You can also use PUT instead of PATCH. With PUT, you have to provide all fields of the resource, other fields will be reset to default. With PATCH, you only need to provide the fields that you want to change.

You can change all fields of the resource except the id field.

Example request:

PATCH /api/v1/organizers/bigevents/webhooks/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript
Content-Type: application/json
Content-Length: 94

{
  "enabled": false
}

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

{
  "id": 1,
  "enabled": false,
  "target_url": "https://httpstat.us/200",
  "all_events": false,
  "limit_events": ["democon"],
  "action_types": ["pretix.event.order.modified", "pretix.event.order.changed.*"],
  "comment": null
}
Parameters:
  • organizer – The slug field of the organizer to modify

  • id – The id field of the webhook to modify

Status Codes:
  • 200 OK – no error

  • 400 Bad Request – The webhook could not be modified due to invalid submitted data

  • 401 Unauthorized – Authentication failure

  • 403 Forbidden – The requested organizer does not exist or you have no permission to change this resource.

DELETE /api/v1/organizers/(organizer)/webhook/(id)/

Delete a webhook. Currently, this will not delete but just disable the webhook.

Example request:

DELETE /api/v1/organizers/bigevents/webhooks/1/ HTTP/1.1
Host: pretix.eu
Accept: application/json, text/javascript

Example response:

HTTP/1.1 204 No Content
Vary: Accept
Parameters:
  • organizer – The slug field of the organizer to modify

  • id – The id field of the webhook to delete

Status Codes: