Quotas¶
Resource description¶
Quotas define how many times an item can be sold. The quota resource contains the following public fields:
Field |
Type |
Description |
|---|---|---|
id |
integer |
Internal ID of the quota |
name |
string |
The internal name of the quota |
size |
integer |
The size of the quota or |
items |
list of integers |
List of item IDs this quota acts on. |
variations |
list of integers |
List of item variation IDs this quota acts on. |
subevent |
integer |
ID of the date inside an event series this quota belongs to (or |
close_when_sold_out |
boolean |
If |
closed |
boolean |
Whether the quota is currently closed (see above field). |
release_after_exit |
boolean |
Whether the quota regains capacity as soon as some tickets have been scanned at an exit. |
available |
boolean |
Whether this quota is available. Only returned if |
available_number |
integer |
Number of available tickets. Only returned if |
Changed in version 3.10: The attribute release_after_exit has been added.
Changed in version 4.1: The with_availability query parameter has been added.
Endpoints¶
-
GET/api/v1/organizers/(organizer)/events/(event)/quotas/¶ Returns a list of all quotas within a given event.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/quotas/ 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": 1, "name": "Ticket Quota", "size": 200, "items": [1, 2], "variations": [1, 4, 5, 7], "subevent": null, "close_when_sold_out": false, "closed": false } ] }
- Query Parameters
page (integer) – The page number in case of a multi-page result set, default is 1
ordering (string) – Manually set the ordering of results. Valid fields to be used are
idandposition. Default:positionsubevent (integer) – Only return quotas of the sub-event with the given ID.
subevent__in (integer) – Only return quotas of sub-events with one the given IDs (comma-separated).
with_availability (string) – Set to
trueto get availability information. Can lead to increased answer times.
- Parameters
organizer – The
slugfield of the organizer to fetchevent – The
slugfield of the event to fetch
- Status Codes
200 OK – no error
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to view this resource.
-
GET/api/v1/organizers/(organizer)/events/(event)/quotas/(id)/¶ Returns information on one quota, identified by its ID.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/quotas/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": 1, "name": "Ticket Quota", "size": 200, "items": [1, 2], "variations": [1, 4, 5, 7], "subevent": null, "close_when_sold_out": false, "closed": false }
- Parameters
organizer – The
slugfield of the organizer to fetchevent – The
slugfield of the event to fetchid – The
idfield of the quota to fetch
- Query Parameters
with_availability (string) – Set to
trueto get availability information. Can lead to increased answer times.
- Status Codes
200 OK – no error
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to view this resource.
-
POST/api/v1/organizers/(organizer)/events/(event)/quotas/¶ Creates a new quota
Example request:
POST /api/v1/organizers/bigevents/events/sampleconf/quotas/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript Content-Type: application/json { "name": "Ticket Quota", "size": 200, "items": [1, 2], "variations": [1, 4, 5, 7], "subevent": null, "close_when_sold_out": false, "closed": false }
Example response:
HTTP/1.1 201 Created Vary: Accept Content-Type: application/json { "id": 1, "name": "Ticket Quota", "size": 200, "items": [1, 2], "variations": [1, 4, 5, 7], "subevent": null, "close_when_sold_out": false, "closed": false }
- Parameters
organizer – The
slugfield of the organizer of the event/item to create a quota forevent – The
slugfield of the event to create a quota for
- Status Codes
201 Created – no error
400 Bad Request – The quota could not be created due to invalid submitted data.
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to create this resource.
-
PATCH/api/v1/organizers/(organizer)/events/(event)/quotas/(id)/¶ Update a quota. You can also use
PUTinstead ofPATCH. WithPUT, you have to provide all fields of the resource, other fields will be reset to default. WithPATCH, you only need to provide the fields that you want to change.You can change all fields of the resource except the
idfield.Example request:
PATCH /api/v1/organizers/bigevents/events/sampleconf/quotas/1/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript Content-Type: application/json Content-Length: 94 { "name": "New Ticket Quota", "size": 100, }
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "id": 2, "name": "New Ticket Quota", "size": 100, "items": [ 1, 2 ], "variations": [ 1, 2 ], "subevent": null, "close_when_sold_out": false, "closed": false }
- Parameters
organizer – The
slugfield of the organizer to modifyevent – The
slugfield of the event to modifyid – The
idfield of the quota rule to modify
- Status Codes
200 OK – no error
400 Bad Request – The quota could not be modified due to invalid submitted data
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to change this resource.
-
DELETE/api/v1/organizers/(organizer)/events/(event)/quota/(id)/¶ Delete a quota. Note that if you delete a quota the items the quota acts on might no longer be available for sale.
Example request:
DELETE /api/v1/organizers/bigevents/events/sampleconf/quotas/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
slugfield of the organizer to modifyevent – The
slugfield of the event to modifyid – The
idfield of the quotas to delete
- Status Codes
204 No Content – no error
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to delete this resource.
-
GET/api/v1/organizers/(organizer)/events/(event)/quotas/(id)/availability/¶ Returns availability information on one quota, identified by its ID.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/quotas/1/availability/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "available": true, "available_number": 419, "total_size": 1000, "pending_orders": 25, "paid_orders": 423, "exited_orders": 0, "cart_positions": 7, "blocking_vouchers": 126, "waiting_list": 0 }Note that
total_sizeandavailable_numberarenullin case of unlimited quotas.- Parameters
organizer – The
slugfield of the organizer to fetchevent – The
slugfield of the event to fetchid – The
idfield of the quota to fetch
- Status Codes
200 OK – no error
401 Unauthorized – Authentication failure
403 Forbidden – The requested organizer/event does not exist or you have no permission to view this resource.