Search

Unified full-text search across facilities, enforcement cases, and violations. Returns ranked results with text snippets.

Endpoint

GET/v1/search

Full-text search across all entity types.

Query Parameters

qrequiredstring

Search query text

e.g. ACME Chemical Houston
typestring

Filter results by entity type: facility, case, violation. Default: all types.

e.g. facility
statestring

Narrow results by state

e.g. TX
per_pageinteger

Results per page (max 50, default 25)

Example

Request
curl "https://api.parley.dev/v1/search?q=ACME+Chemical&state=TX" \  -H "X-API-Key: prl_YOUR_KEY_HERE"
200OKapplication/json
{  "data": [    {      "type": "facility",      "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",      "name": "ACME CHEMICAL PLANT",      "snippet": "ACME CHEMICAL PLANT, Houston, TX",      "score": null,      "url": "/v1/facilities/f47ac10b-..."    },    {      "type": "case",      "id": "c9d8e7f6-...",      "name": "United States v. ACME Chemical Inc.",      "snippet": "CIVIL — SETTLED",      "score": null,      "url": "/v1/cases/c9d8e7f6-..."    },    {      "type": "violation",      "id": "a1b2c3d4-...",      "name": "HPV - Emission Standard Failure",      "snippet": "Failure to meet emission standard for volatile organic compounds...",      "score": null,      "url": "/v1/facilities/f47ac10b-.../violations"    }  ],  "pagination": {    "total": 14,    "page": 1,    "per_page": 25,    "has_more": false  }}

How search works

Ranking

Facility results are ranked using PostgreSQL full-text search (tsvector). Exact name matches and FRS ID matches are prioritized. Cases and violations use case-insensitive text matching and are ordered by recency.

Snippets

The snippet field contains a short text summary of the matched result (e.g., facility name and location, case type and status, or violation description).

Indexed fields

Search indexes facility names and addresses (via full-text search), case names and numbers, and violation types and descriptions. All text matching is case-insensitive.

Filtering by type

Use the type parameter to restrict results to a single entity type:

Search only facilities
curl "https://api.parley.dev/v1/search?q=chemical+plant&type=facility" \  -H "X-API-Key: prl_YOUR_KEY_HERE"
Search only enforcement cases
curl "https://api.parley.dev/v1/search?q=Clean+Air+Act&type=case" \  -H "X-API-Key: prl_YOUR_KEY_HERE"