Data fields¶
Note
This API is part of an upcoming larger change to our API. The API documentation already reflects the future
version. Until the change, please keep using the endpoints at /questions/.
The new version is expected to be released for hosted pretix early December and for self-hosted pretix with
version 2027.1.
You can find more information on our blog.
Resource description¶
Data fields define additional fields related to an order or an order position. By referencing data fields in a questionnaire, you can have customers or staff fill them out – during or after checkout (web or POS), during check-in in the ticket scanner app, or in the backend.
There are two different resource paths for data fields, depending on whether the data field is attached to orders or order positions. Therefore, each endpoint below has two different URLs.
The data field resource contains the following public fields:
Field |
Type |
Description |
|---|---|---|
id |
integer |
Internal ID of the data field |
internal_name |
string |
Required. An internal field label |
identifier |
string |
An arbitrary string that can be used for matching with other sources. Must be unique per event, across all types of data fields. |
type |
string |
Required. The expected type of data. Valid options:
|
show_during_checkin |
boolean |
If |
print_on_invoice |
boolean |
If |
print_on_invoice_label |
multi-lingual string |
Required if ``print_on_invoice`` is ``true``. Label to print on the invoice before the value of this field. Otherwise null. |
options |
list of objects |
In case of data field type |
├ id |
integer |
Internal ID of the option |
├ position |
integer |
An integer, used for sorting |
├ identifier |
string |
An arbitrary string that can be used for matching with other sources. |
└ answer |
multi-lingual string |
The displayed value of this option |
valid_number_min |
string |
Minimum value for number fields (optional) |
valid_number_max |
string |
Maximum value for number fields (optional) |
valid_date_min |
date |
Minimum value for date fields (optional) |
valid_date_max |
date |
Maximum value for date fields (optional) |
valid_datetime_min |
datetime |
Minimum value for date and time fields (optional) |
valid_datetime_max |
datetime |
Maximum value for date and time fields (optional) |
valid_file_portrait |
boolean |
Turn on file validation for portrait photos |
valid_string_length_min |
integer |
Minimum length for string fields (optional) |
valid_string_length_max |
integer |
Maximum length for string fields (optional) |
referenced_by_questionnaires |
list of integers |
Read-only. List of questionnaire IDs that reference this data field |
Endpoints¶
- GET /api/v1/organizers/(organizer)/events/(event)/datafields/position/¶
- GET /api/v1/organizers/(organizer)/events/(event)/datafields/order/¶
Returns a list of all data fields within a given event.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/datafields/position/ 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, "internal_name": "T-Shirt size", "type": "C", "identifier": "WY3TP9SL", "show_during_checkin": false, "print_on_invoice": false, "print_on_invoice_label": null, "valid_number_min": null, "valid_number_max": null, "valid_date_min": null, "valid_date_max": null, "valid_datetime_min": null, "valid_datetime_max": null, "valid_string_length_min": null, "valid_string_length_max": null, "valid_file_portrait": false, "options": [ { "id": 1, "identifier": "LVETRWVU", "position": 0, "answer": {"en": "S"} }, { "id": 2, "identifier": "DFEMJWMJ", "position": 1, "answer": {"en": "M"} }, { "id": 3, "identifier": "W9AH7RDE", "position": 2, "answer": {"en": "L"} } ], "referenced_by_questionnaires": [1] } ] }
- 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:positionidentifier (string) – Only return questions with the given identifier string
ask_during_checkin (boolean) – Only return questions that are or are not to be asked during check-in
required (boolean) – Only return questions that are or are not required to fill in
- 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)/datafields/position/(id)/¶
- GET /api/v1/organizers/(organizer)/events/(event)/datafields/order/(id)/¶
Returns information on one data field, identified by its ID.
Example request:
GET /api/v1/organizers/bigevents/events/sampleconf/datafields/position/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, "internal_name": "T-Shirt size", "type": "C", "identifier": "WY3TP9SL", "show_during_checkin": false, "print_on_invoice": false, "print_on_invoice_label": null, "valid_number_min": null, "valid_number_max": null, "valid_date_min": null, "valid_date_max": null, "valid_datetime_min": null, "valid_datetime_max": null, "valid_string_length_min": null, "valid_string_length_max": null, "valid_file_portrait": false, "options": [ { "id": 1, "identifier": "LVETRWVU", "position": 0, "answer": {"en": "S"} }, { "id": 2, "identifier": "DFEMJWMJ", "position": 1, "answer": {"en": "M"} }, { "id": 3, "identifier": "W9AH7RDE", "position": 2, "answer": {"en": "L"} } ], "referenced_by_questionnaires": [1] }
- Parameters:
organizer – The
slugfield of the organizer to fetchevent – The
slugfield of the event to fetchid – The
idfield of the question 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.
- POST /api/v1/organizers/(organizer)/events/(event)/datafields/position/¶
- POST /api/v1/organizers/(organizer)/events/(event)/datafields/order/¶
Create a new question
Example request:
POST /api/v1/organizers/bigevents/events/sampleconf/datafields/position/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript Content-Type: application/json { "internal_name": "T-Shirt size", "type": "C", "show_during_checkin": false, "print_on_invoice": false, "print_on_invoice_label": null, "options": [ { "answer": {"en": "S"} }, { "answer": {"en": "M"} }, { "answer": {"en": "L"} } ] }
Example response:
HTTP/1.1 201 Created Vary: Accept Content-Type: application/json { "id": 1, "internal_name": "T-Shirt size", "type": "C", "identifier": "WY3TP9SL", "show_during_checkin": false, "print_on_invoice": false, "print_on_invoice_label": null, "valid_number_min": null, "valid_number_max": null, "valid_date_min": null, "valid_date_max": null, "valid_datetime_min": null, "valid_datetime_max": null, "valid_string_length_min": null, "valid_string_length_max": null, "valid_file_portrait": false, "options": [ { "id": 1, "identifier": "LVETRWVU", "position": 0, "answer": {"en": "S"} }, { "id": 2, "identifier": "DFEMJWMJ", "position": 1, "answer": {"en": "M"} }, { "id": 3, "identifier": "W9AH7RDE", "position": 2, "answer": {"en": "L"} } ], "referenced_by_questionnaires": [1] }
- Parameters:
organizer – The
slugfield of the organizer of the event to create an item forevent – The
slugfield of the event to create an item for
- Status Codes:
201 Created – no error
400 Bad Request – The item 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)/datafields/position/(id)/¶
- PATCH /api/v1/organizers/(organizer)/events/(event)/datafields/order/(id)/¶
Update a data field. 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
optionsfield. If you need to update/delete options please use the nested dedicated endpoints.Example request:
PATCH /api/v1/organizers/bigevents/events/sampleconf/datafields/position/1/ HTTP/1.1 Host: pretix.eu Accept: application/json, text/javascript Content-Type: application/json Content-Length: 94 { "internal_name": "Clothing size" }
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "id": 1, "internal_name": "Clothing size", "type": "C", "identifier": "WY3TP9SL", "show_during_checkin": false, "print_on_invoice": false, "print_on_invoice_label": null, "valid_number_min": null, "valid_number_max": null, "valid_date_min": null, "valid_date_max": null, "valid_datetime_min": null, "valid_datetime_max": null, "valid_string_length_min": null, "valid_string_length_max": null, "valid_file_portrait": false, "options": [ { "id": 1, "identifier": "LVETRWVU", "position": 0, "answer": {"en": "S"} }, { "id": 2, "identifier": "DFEMJWMJ", "position": 1, "answer": {"en": "M"} }, { "id": 3, "identifier": "W9AH7RDE", "position": 2, "answer": {"en": "L"} } ], "referenced_by_questionnaires": [1] }
- Parameters:
organizer – The
slugfield of the organizer to modifyevent – The
slugfield of the event to modifyid – The
idfield of the question to modify
- Status Codes:
200 OK – no error
400 Bad Request – The question 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)/datafields/position/(id)/¶
- DELETE /api/v1/organizers/(organizer)/events/(event)/datafields/order/(id)/¶
Delete a data field.
Example request:
DELETE /api/v1/organizers/bigevents/events/sampleconf/datafields/position/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 question 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.