Working with Jailbase Public API using JavaScript

Jailbase Public API is a great resource for getting real-time information on recent arrests. You can use this API to access various information like bookings, mugshots, charges, and much more. In this article, we will explore how to use Jailbase Public API using JavaScript.

Before we get started, make sure you have an API key. You can get your API key by signing up on the Jailbase API website. Once you have your API key, you can start using the API.

API Endpoints

Jailbase Public API provides several endpoints for accessing different information. Here are some of the endpoints available in the API:

  • /recent: Returns the list of recent bookings.
  • /bookings/{id}: Returns the booking details for the given booking ID.
  • /mugshots/{id}: Returns the mugshot for the given booking ID.
  • /charges/{id}: Returns the charges for the given booking ID.

API Request

To use the Jailbase Public API, we need to send an HTTP request to the appropriate endpoint. For example, to get the list of recent bookings, we need to send a GET request to the https://api.jailbase.com/api/1/recent/?source_id={source_id}&source_token={source_token} endpoint. Here is an example of what the request should look like:

const sourceId = '1234';
const sourceToken = 'ABCD';
const url = `https://api.jailbase.com/api/1/recent/?source_id=${sourceId}&source_token=${sourceToken}`;

    .then((response) => response.json())
    .then((data) => console.log(data));

In this example, we are using the fetch function to send an HTTP GET request to the https://api.jailbase.com/api/1/recent/ endpoint with the required parameters (source ID and source token). The response is then converted to JSON format and logged to the console.

API Response

The API response contains the requested information in JSON format. The structure of the response depends on the endpoint used. Here is an example of the response for the /recent endpoint:

    "records": [
            "id": 1234,
            "book_date": "2021-01-01",
            "source_id": 5678,
            "source_name": "County Jail",
            "source_url": "https://countyjail.com",
            "state": "CA",
            "county": "Los Angeles",
            "first_name": "John",
            "last_name": "Doe",
            "age": 30,
            "gender": "Male",
            "race": "White",
            "charges": [
                    "charge": "DUI",
                    "url": "https://countyjail.com/charges/DUI"
            "id": 5678,
            "book_date": "2021-01-03",
            "source_id": 9012,
            "source_name": "City Jail",
            "source_url": "https://cityjail.com",
            "state": "CA",
            "county": "San Francisco",
            "first_name": "Jane",
            "last_name": "Doe",
            "age": 25,
            "gender": "Female",
            "race": "Black",
            "charges": [
                    "charge": "Assault",
                    "url": "https://cityjail.com/charges/Assault"
    "count": 2,
    "page": 1,
    "nextPage": true

As you can see, the records array contains information about each booking, including the ID, booking date, source ID and name, state, county, first name, last name, age, gender, race, and charges.


We have successfully explored how to use Jailbase Public API using JavaScript. With the right API key, you can use this API to get real-time information about recent arrests. By using the various endpoints, you can get bookings, mugshots, and charges. With this information, you can create applications that use the data provided by the Jailbase Public API.