Memberships

Resource description

The membership resource contains the following public fields:

Field

Type

Description

id

integer

Internal ID of the membership

customer

string

Identifier of the customer associated with this membership (can’t be changed)

testmode

boolean

Whether this is a test membership

membership_type

integer

Internal ID of the membership type

date_start

datetime

Start of validity

date_end

datetime

End of validity

attendee_name_parts

object

JSON representation of components of an attendee name (configuration dependent)

Endpoints

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

Returns a list of all memberships within a given organizer.

Example request:

GET /api/v1/organizers/bigevents/memberships/ 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,
      "customer": "EGR9SYT",
      "membership_type": 1,
      "testmode": false,
      "date_start": "2021-04-19T00:00:00+02:00",
      "date_end": "2021-04-20T00:00:00+02:00",
      "attendee_name_parts": {
          "_scheme": "title_given_family",
          "family_name": "Doe",
          "given_name": "John",
          "title": ""
      }
    }
  ]
}
Query Parameters
  • page (integer) – The page number in case of a multi-page result set, default is 1

  • customer (string) – A customer identifier to filter for

  • membership_type (integer) – A membership type ID to filter for

  • testmode (boolean) – Filter for memberships that are (not) in test mode.

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

Status Codes
GET /api/v1/organizers/(organizer)/memberships/(id)/

Returns information on one membership, identified by its ID.

Example request:

GET /api/v1/organizers/bigevents/memberships/2/ 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,
  "customer": "EGR9SYT",
  "membership_type": 1,
  "testmode": false,
  "date_start": "2021-04-19T00:00:00+02:00",
  "date_end": "2021-04-20T00:00:00+02:00",
  "attendee_name_parts": {
      "_scheme": "title_given_family",
      "family_name": "Doe",
      "given_name": "John",
      "title": ""
  }
}
Parameters
  • organizer – The slug field of the organizer to fetch

  • id – The id field of the membership to fetch

Status Codes
POST /api/v1/organizers/(organizer)/memberships/

Creates a new membership

Example request:

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

{
  "membership_type": 2,
  "customer": "EGR9SYT",
  "testmode": false,
  "date_start": "2021-04-19T00:00:00+02:00",
  "date_end": "2021-04-20T00:00:00+02:00",
  "attendee_name_parts": {
      "_scheme": "title_given_family",
      "family_name": "Doe",
      "given_name": "John",
      "title": ""
  }
}

Example response:

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

{
  "id": 3,
  "membership_type": 2,
  "customer": "EGR9SYT",
  "testmode": false,
  "date_start": "2021-04-19T00:00:00+02:00",
  "date_end": "2021-04-20T00:00:00+02:00",
  "attendee_name_parts": {
      "_scheme": "title_given_family",
      "family_name": "Doe",
      "given_name": "John",
      "title": ""
  }
}
Parameters
  • organizer – The slug field of the organizer to create a membership for

Status Codes
PATCH /api/v1/organizers/(organizer)/memberships/(id)/

Update a membership. 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, customer, and testmode fields.

Example request:

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

{
  "membership_type": 3
}

Example response:

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

{
  "id": 1,
  "membership_type": 3,
  …
}
Parameters
  • organizer – The slug field of the organizer to modify

  • id – The id field of the membership to modify

Status Codes
  • 200 OK – no error

  • 400 Bad Request – The membership 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.