Skip to content

RegLens Jurisdiction Database API

I need to integrate with an external jurisdiction data API. Here's the complete API specification:

Base URL

https://reglens-database.replit.app

Authentication

All API requests require an API key passed in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Available Endpoints

1. Get All Regions

Endpoint: GET /api/regions

Description: Retrieve all available regions

Response Example:

[
  {
    "id": "uuid",
    "original_id": 1,
    "name": "Region Name"
  }
]

2. Get Jurisdictions by Region

Endpoint: GET /api/regions/:regionId/jurisdictions

Description: Get all jurisdictions within a specific region

Parameters:

regionId:
  in: path
  type: string
  format: uuid
  description: UUID of the Region

Response Example:

[
  {
    "id": "uuid",
    "original_id": 1,
    "name": "Jurisdiction Name",
    "region_name": "Region Name",
    "agencychannel": 123,
    "jurisdictionchannel": 456
  }
]

3. Get Agencies by Jurisdiction

Endpoint: GET /api/jurisdictions/:jurisdictionId/agencies

Description: Get all agencies within a specific jurisdiction

Parameters:

jurisdictionId:
  in: path
  type: string
  format: uuid
  description: UUID of the Jurisdiction

Response Example:

[
  {
    "id": "uuid",
    "original_id": 1,
    "name": "Agency Name",
    "jurisdiction_name": "Jurisdiction Name",
    "region_name": "Region Name"
  }
]

4. Get Contributors by Jurisdiction

Endpoint: GET /api/jurisdictions/:jurisdictionId/contributors

Description: Get all contributors within a specific jurisdiction

Parameters:

jurisdictionId:
  in: path
  type: string
  format: uuid
  description: UUID of the Jurisdiction

Response Example:

[
  {
    "id": "uuid",
    "original_id": 1,
    "name": "Contributor Name",
    "jurisdiction_name": "Jurisdiction Name",
    "region_name": "Region Name"
  }
]

5. Get Sources by Contributor

Endpoint: GET /api/contributors/:contributorId/sources

Description: Get all sources for a specific contributor

Parameters:

contributorId:
  in: path
  type: string
  format: uuid
  description: UUID of the Contributor

Response Example:

[
  {
    "id": "uuid",
    "original_id": 1,
    "name": "Source Name",
    "contributor_name": "Contributor Name",
    "jurisdiction_name": "Jurisdiction Name",
    "region_name": "Region Name"
  }
]

Implementation Requirements

Please create a feature that:

  • Stores the API key securely (use environment variable JURISDICTION_API_KEY)
  • Fetches and displays the list of regions
  • Allows users to select a region and view jurisdictions
  • Allows users to select a jurisdiction and view its agencies
  • Allows users to select a jurisdiction and view its contributors with sources

Example Code Pattern

Here's a pattern for making API calls:

JavaScript/TypeScript:

const API_BASE_URL = 'YOUR_APP_URL';
const API_KEY = process.env.JURISDICTION_API_KEY;
async function fetchRegions() {
  const response = await fetch(`${API_BASE_URL}/api/regions`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  });
  return await response.json();
}
async function fetchJurisdictionsByRegion(regionId) {
  const response = await fetch(`${API_BASE_URL}/api/regions/${regionId}/jurisdictions`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  });
  return await response.json();
}
async function fetchAgenciesByJurisdiction(jurisdictionId) {
  const response = await fetch(`${API_BASE_URL}/api/jurisdictions/${jurisdictionId}/agencies`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  });
  return await response.json();
}
async function fetchContributorsByJurisdiction(jurisdictionId) {
  const response = await fetch(`${API_BASE_URL}/api/jurisdictions/${jurisdictionId}/contributors`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  });
  return await response.json();
}
async function fetchSourcesByContributor(contributorId) {
  const response = await fetch(`${API_BASE_URL}/api/contributors/${contributorId}/sources`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`
    }
  });
  return await response.json();
}

Python:

import os
import requests
API_BASE_URL = 'YOUR_APP_URL'
API_KEY = os.getenv('JURISDICTION_API_KEY')
headers = {
    'Authorization': f'Bearer {API_KEY}'
}
def fetch_regions():
    response = requests.get(f'{API_BASE_URL}/api/regions', headers=headers)
    return response.json()
def fetch_jurisdictions_by_region(region_id):
    response = requests.get(f'{API_BASE_URL}/api/regions/{region_id}/jurisdictions', headers=headers)
    return response.json()
def fetch_agencies_by_jurisdiction(jurisdiction_id):
    response = requests.get(f'{API_BASE_URL}/api/jurisdictions/{jurisdiction_id}/agencies', headers=headers)
    return response.json()
def fetch_contributors_by_jurisdiction(jurisdiction_id):
    response = requests.get(f'{API_BASE_URL}/api/jurisdictions/{jurisdiction_id}/contributors', headers=headers)
    return response.json()
def fetch_sources_by_contributor(contributor_id):
    response = requests.get(f'{API_BASE_URL}/api/contributors/{contributor_id}/sources', headers=headers)
    return response.json()

Error Handling

401 Unauthorized: Invalid or missing API key 404 Not Found: Resource doesn't exist 500 Internal Server Error: Server issue

Please implement proper error handling for all API calls.

To use this prompt:

  1. Copy the entire text above
  2. Replace [YOUR_APP_URL] with your actual deployed app URL
  3. Paste it into the new Replit app's chat
  4. The agent will understand the API structure and can build the integration

This prompt provides everything needed: authentication details, all relevant endpoints with examples, code patterns in multiple languages, and error handling guidance.


Last update: November 14, 2025
Back to top