Skip to content

Patrons Pro

GET /patrons

Retrieve a list of all existing patrons on your site. Returns 50 patrons at a time with pagination support.

bash
curl --location 'https://api.libib.com/patrons?page=1' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'
php
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons?page=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_CONNECTTIMEOUT => 5,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

// Valid responses are always in JSON
$data = json_decode($response);
python
import requests

url = "https://api.libib.com/patrons"

headers = {
  'x-api-key': 'YOUR_API_KEY',
  'x-api-user': 'YOUR_API_USER',
}

params = {
  'page': 1
}

response = requests.get(url, headers=headers, params=params)

data = response.json()

Query Parameters

FieldDescription
pagePage number to return (50 patrons per page).

JSON Result Details

FieldDescription
totalTotal number of patrons on the account.
pagesTotal number of pages available.
max_per_pageNumber of patrons per page (currently fixed at 50).
patronsArray of patron objects. barcode, first_name, last_name, email, notification_emails, tags, patron_id, phone, address1, address2, city, state, country, zip, freeze
json
{
  "total": 2,
  "pages": 1,
  "max_per_page": 50,
  "patrons": [
    {
      "barcode": "2020000000013",
      "first_name": "Mary",
      "last_name": "Shelley",
      "email": "frankenstein@example.com",
      "notification_emails": null,
      "tags": null,
      "patron_id": "mshelley",
      "phone": "555-123-4567",
      "address1": null,
      "address2": null,
      "city": "Augusta",
      "state": "KS",
      "country": "US",
      "zip": null,
      "freeze": null
    },
    {
      "barcode": "2020000000037",
      "first_name": "Marcus",
      "last_name": "Aurelius",
      "email": "meditiations@example.com",
      "notification_emails": null,
      "tags": null,
      "patron_id": null,
      "phone": null,
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "country": "US",
      "zip": null,
      "freeze": 1
    }
  ]
}

GET patrons/{id}

Retrieve a single patron by passing the patron's barcode or email as an id.

bash
curl --location 'https://api.libib.com/patrons/2020000000013' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'
php
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons/2020000000013",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_CONNECTTIMEOUT => 5,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

// Valid responses are always in JSON
$data = json_decode($response);
python
import requests

url = "https://api.libib.com/patrons/2020000000013"

headers = {
  'x-api-key': 'YOUR_API_KEY',
  'x-api-user': 'YOUR_API_USER',
}

response = requests.get(url, headers=headers)

data = response.json()

JSON Result Details

FieldDescription
barcodeThe assigned identifier for the patron.
first_namePatron's first name.
last_namePatron's last name.
emailLogin credential and contact address for checkouts/holds.
notification_emailsOptional emails which override the email when sending out notifications. Up to 3 emails allowed, comma separated.
tagsTags that have been assigned to this patron, comma separated.
patron_idCustom identifier assigned by the managers.
phoneContact telephone number.
address1Street address line 1.
address2Street address line 2.
cityCity.
stateThe state will be a 2-character abbreviation for US addresses. Otherwise it is dependant on manager input.
country2-character country code.
zipPostal code.
freezeReturns 1 (true) if patron has been frozen.
json
{
  "barcode": "2020000000013",
  "first_name": "Mary",
  "last_name": "Shelley",
  "email": "frankenstein@example.com",
  "notification_emails": null,
  "tags": null,
  "patron_id": "mshelley",
  "phone": "555-123-4567",
  "address1": null,
  "address2": null,
  "city": "Augusta",
  "state": "KS",
  "country": "US",
  "zip": null,
  "freeze": null
}

POST /patrons

Create a new patron in the account.

bash
curl --location --request POST 'https://api.libib.com/patrons?first_name=Mary&last_name=Shelley&email=frankenstein@example.com&password=2ab3940as94ikd2394k' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'
php
<?php
$curl = curl_init();

$params = array(
  'first_name' => 'Mary',
  'last_name' => 'Shelley',
  'email' => 'frankenstein@example.com',
  'notification_emails' => 'frankenstein@example.com,another.email@example.com',
  'password' => '2ab3940as94ikd2394k'
);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons?" . http_build_query($params),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

// Valid responses are always in JSON
$data = json_decode($response);
python
import requests

url = "https://api.libib.com/patrons"

headers = {
  'x-api-key': 'YOUR_API_KEY',
  'x-api-user': 'YOUR_API_USER',
}

params = {
  'first_name': 'Mary',
  'last_name': 'Shelley',
  'email': 'frankenstein@example.com',
  'password': '2ab3940as94ikd2394k'
}

response = requests.post(url, headers=headers, params=params)

data = response.json()

Query Parameters

FieldRequiredDescription
first_nameYesPatron's first name.
last_nameYesPatron's last name.
emailNoMust be unique.
passwordNoRequired for patron login and item checkout/holds.
notification_emailsNoUp to 3 comma-separated emails for notifications.
tagsNoComma-separated patron tags.
patron_idNoCustom ID assignment (not required to be unique).
phoneNoContact phone number.
address1NoStreet address line 1.
address2NoStreet address line 2.
cityNoCity.
stateNoState (2-character abbreviation for US).
countryNo2-character country code.
zipNoPostal code.
freezeNoSet to 1 to freeze patron account.
barcodeNo5-15 digits. THIS SHOULD GENERALLY NOT BE USED! Libib will automatically create a custom barcode for each patron. If a barcode is included in the parameters, it will be used to create the new patron. However, the barcode you create may not work with our system and we can not provide support for it. A possible use case for this field is if you need to re-instate a deleted patron and want to use their previously assigned barcode.

Custom Barcodes

Barcodes are always auto-assigned by Libib. Overriding this behavior by assigning your own barcodes often prevents Libib from working as expected. Libib is unable to support any issues that arise from using non-supported barcodes.

JSON Result Details

Password is never returned in result set.

json
{
    "barcode": "2020000000051",
    "first_name": "Mary",
    "last_name": "Shelley",
    "email": "frankenstein@example.com",
    "notification_emails": "frankenstein@example.com,another.email@example.com",
    "tags": null,
    "patron_id": null,
    "phone": null,
    "address1": null,
    "address2": null,
    "city": null,
    "state": null,
    "country": "US",
    "zip": null,
    "freeze": null
}

POST /patrons/{id}

Update specific fields for an existing patron. Pass the patron's barcode or email as the id.

bash
curl --location --request POST 'https://api.libib.com/patrons/2020000000051?email=satoshi.kon@example.com&password=2ab3940as94ikd2394k&notification_emails=' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'
php
<?php
$curl = curl_init();

$params = array(
  'email' => 'satoshi.kon@example.com',
  'password' => '2ab3940as94ikd2394k',
  'notification_emails' => ''
);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons/2020000000051?" . http_build_query($params),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

// Valid responses are always in JSON
$data = json_decode($response);
python
import requests

url = "https://api.libib.com/patrons/2020000000051"

headers = {
  'x-api-key': 'YOUR_API_KEY',
  'x-api-user': 'YOUR_API_USER',
}

params = {
  'email': 'satoshi.kon@example.com',
  'password': '2ab3940as94ikd2394k',
  'notification_emails': ''
}

response = requests.post(url, headers=headers, params=params)

data = response.json()

Query Parameters

Empty string values remove existing data. Omit parameters you don't want to change.

FieldDescription
first_namePatron's first name.
last_namePatron's last name.
emailMust be unique.
passwordLogin credential for patron portal.
notification_emailsUp to 3 comma-separated emails for notifications.
tagsComma-separated patron tags.
patron_idCustom ID (non-unique).
phonePhone number.
address1Street address line 1.
address2Street address line 2.
cityCity.
stateState (2-character abbreviation for US).
country2-character country code.
zipPostal code.
freezeSet to 1 to freeze account.
barcode5-15 digits. THIS SHOULD GENERALLY NOT BE USED! Libib will have automatically assigned a custom barcode for each patron (unless previously overwritten). If a barcode is included in the parameters, it will be used to update the patron’s barcode. However, the barcode you create may not work with our system and we can not provide support for it. A possible use case for this field is if you need to correct an overwritten barcode. (If included, can not be empty)

Custom Barcodes

Barcodes are always auto-assigned by Libib. Overriding this behavior by assigning your own barcodes often prevents Libib from working as expected. Libib is unable to support any issues that arise from using non-supported barcodes.

JSON Result Details

Password is never returned in result set.

json
{
  "barcode": "2020000000051",
  "first_name": "Satoshi",
  "last_name": "Kon",
  "email": "satoshi.kon@example.com",
  "notification_emails": null,
  "tags": null,
  "patron_id": "skon",
  "phone": null,
  "address1": null,
  "address2": null,
  "city": null,
  "state": null,
  "country": "JP",
  "zip": null,
  "freeze": null
}

PATCH /patrons/{id}

Restore a previously deleted patron. Patrons can be restored within 30 days of deletion. Pass the patron's barcode or email as the id.

bash
curl --location --request PATCH 'https://api.libib.com/patrons/2020000000051' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'
php
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons/2020000000051",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_CONNECTTIMEOUT => 5,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
curl_close($curl);

// Valid responses are always in JSON
$data = json_decode($response);
python
import requests

url = "https://api.libib.com/patrons/2020000000051"

headers = {
  'x-api-key': 'YOUR_API_KEY',
  'x-api-user': 'YOUR_API_USER',
}

response = requests.patch(url, headers=headers)

data = response.json()

Restoration Limitations

Restoration will fail if the patron's email has been reassigned to a new user account.

Response

A successful restoration returns status code 200 with no body content.

DELETE patrons/{id}

Remove a single patron by passing the patron's barcode or email as the id. Deleting a patron dissociates their entire lending/hold history.

bash
curl --location --request DELETE 'https://api.libib.com/patrons/2020000000013' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'
php
<?php
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons/2020000000013",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_CONNECTTIMEOUT => 5,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "x-api-key: YOUR_API_KEY",
    "x-api-user: YOUR_API_USER"
  ),
));

$response = curl_exec($curl);
curl_close($curl);
python
import requests

url = "https://api.libib.com/patrons/2020000000013"

headers = {
  'x-api-key': 'YOUR_API_KEY',
  'x-api-user': 'YOUR_API_USER',
}

response = requests.delete(url, headers=headers)

Active Checkouts

Patrons with active checkouts cannot be deleted. Attempting to do so will return a 400 error.

Response

A successful deletion returns status code 204 with no body content.