Get a list of patients for a site

GET /api/v1/patients

Retrieve a list of patients with optional sorting, pagination, and filtering.

Query parameters

  • site_id integer Required

    ID of the site to retrieve patients for.

  • per_page integer

    Number of items per page.

  • fields string(csv)

    Comma-separated list of fields to be returned in the response. Only 'id', 'first_name', 'last_name', 'mrn', 'dob', 'gender', 'phone', 'address', 'address_line2, 'zip', 'is_frozen', 'created_at', 'updated_at' columns are allowed.

  • filter object

    Filter criteria to narrow down the list of patients. The filter parameter is an object with key-value pairs where the key is the field to filter by and the value is '{operator}{value}'. The operator is optional and defaults to '='. (e.g. '/patients?site_id=1&filter[id]=>100&filter[created_at]=>2021-01-01')

    Hide filter attributes Show filter attributes object
    • id string

      Filter by ID with operators '>', '<', '>=', or '<='.

    • first_name string

      Filter by first name with partial matching.

    • last_name string

      Filter by last name with partial matching.

    • mrn string

      Filter by medical record number with partial matching.

    • dob string

      Filter by date of birth with operators '>', '<', '>=', or '<='.

    • gender string

      Filter by gender.

    • phone string

      Filter by phone number.

    • address string

      Filter by address with partial matching.

    • zip string

      Filter by zip code.

    • is_frozen boolean

      Filter by frozen status (true or false).

    • created_at string

      Filter by date with operators '>', '<', '>=', or '<='.

  • sort string

    Field to sort the results by. Only 'id' and 'created_at' columns are allowed, prefixed with a minus sign (-) for descending order and without for ascending order.

    Values are id, -id, created_at, or -created_at.

Responses

  • 200 application/json

    Successful operation

    Hide response attributes Show response attributes object
    • data array[object]
      Hide data attributes Show data attributes object
      • id integer

        Unique identifier for the patient

      • mrn string

        Medical record number

      • first_name string
      • last_name string
      • dob string(date)

        Date of birth

      • gender string

        Values are M, F, O, or Null.

      • phone string
      • address string
      • address_line2 string
      • zip string
      • is_frozen boolean

        Whether the patient is frozen

      • created_at string(date-time)

        Date and time the patient was created (UTC time)

      • updated_at string(date-time)

        Date and time the patient was last updated (UTC time)

    • metadata object
      Hide metadata attributes Show metadata attributes object
      • current_page integer
      • last_page integer
      • per_page integer
      • total integer
      • next_page_url string
      • prev_page_url string
  • 404 application/json

    Resource Not Found

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_cde number
  • 403 application/json

    Forbidden

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_code number
  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_code number
  • 422 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • error string
    • message string
    • error_code number
GET /api/v1/patients
curl \
 --request GET 'https://publicapi.ekareinc.com/api/v1/patients?site_id=42' \
 --header "X-API-KEY: $API_KEY"
Response examples (200)
{
  "data": [
    {
      "id": 3098,
      "mrn": "123456",
      "first_name": "John",
      "last_name": "Doe",
      "dob": "1990-01-01",
      "gender": "M",
      "phone": "+(1) 123-456-7890",
      "address": "123 Main St",
      "address_line2": "Apt 1",
      "zip": "12345",
      "is_frozen": false,
      "created_at": "2021-01-01 00:00:00",
      "updated_at": "2021-01-01 00:00:00"
    }
  ],
  "metadata": {
    "current_page": 1,
    "last_page": 55,
    "per_page": 2,
    "total": 110,
    "next_page_url": "http://publicapi.ekareinc.com/api/v1/patients?site_id=1&page=2",
    "prev_page_url": "string"
  }
}
Response examples (404)
{
  "error": "Not Found",
  "message": "Specified site not found.",
  "error_cde": "104"
}
Response examples (403)
{
  "error": "Access denied",
  "message": "Forbidden. You do not have permission to access this resource.",
  "error_code": "101"
}
Response examples (401)
{
  "error": "Invalid API token",
  "message": "Unauthorized. Please provide a valid API token.",
  "error_code": "100"
}
Response examples (422)
{
  "error": "Bad Request",
  "message": "The given data was invalid.",
  "error_code": "102"
}