Hamlet API: News Reporting Revolution in 2026

Listen to this article · 12 min listen

The Hamlet API is a practical tool for journalists and researchers who need to pull structured data from messy public meeting transcripts. It speeds up the reporting process by programmatically identifying who is speaking, what they’re talking about, and what decisions are being made. Instead of reading for hours, you could instantly find every time “veteran housing initiatives” was mentioned in a year of city council meetings, which is exactly the kind of shortcut this API provides.

Key Takeaways

  • Set up Hamlet API searches with date ranges and keywords to zero in on the data you need from public meeting transcripts.
  • Let the API’s named entity recognition (NER) automatically pull out speakers, organizations, and locations from the text.
  • Use Hamlet’s sentiment analysis to get a read on the general tone of a discussion about a specific topic or person.
  • Export the processed data as JSON or CSV so you can easily plug it into other analysis tools or your own databases.
  • Tweak your API query parameters based on the first few results to make sure the information you’re getting is precise and relevant for your story.

1. Accessing the Hamlet API and Initial Setup

Before you can analyze any transcripts, you first have to connect with the Hamlet API. You’ll need to register on their developer portal to get an API key which is the credential you’ll use for every request, so keep it safe. If you’re using Python, the `requests` library is the standard way to do this, so just `pip install requests` if you don’t have it. Here’s a quick snippet to get authenticated and check the connection: “`python
import requests
import json API_KEY = “YOUR_HAMLET_API_KEY” # Replace with your actual API key
BASE_URL = “https://api.hamlet.io/v1/” headers = { “Authorization”: f”Bearer {API_KEY}”, “Content-Type”: “application/json”
} try: response = requests.get(f”{BASE_URL}status”, headers=headers) response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx) print(“API Status:”, response.json())
except requests.exceptions.RequestException as e: print(f”API connection error: {e}”) This quick call to the `status` endpoint is just to make sure your API key works and you can reach the server. If you get a good response, you’re ready to go. If not, nothing else will work.

Pro Tip: Seriously, don’t hardcode your API key in your scripts. Store it as an environment variable instead. It’s much more secure and prevents you from accidentally leaking it if you share your code.

2. Uploading Public Meeting Transcripts

Hamlet works by processing transcripts you upload, with `.txt` and `.pdf` files being the most common formats it supports. To get the best results, you need to feed it clean transcripts. Getting good data out of a file cluttered with weird formatting or watermarks is just as hard as trying to read a coffee-stained document. Garbage in, garbage out. To send a transcript up, you’ll hit the upload endpoint with a local file like this: “`python
import requests
import json API_KEY = “YOUR_HAMLET_API_KEY”
BASE_URL = “https://api.hamlet.io/v1/”
headers = { “Authorization”: f”Bearer {API_KEY}” # Content-Type is set automatically for file uploads
} file_path = “path/to/your/meeting_transcript.txt” # Example: “data/city_council_2026_03_15.txt”
meeting_title = “Fulton County Board of Commissioners Meeting – March 15, 2026”
meeting_date = “2026-03-15″ try: with open(file_path, ‘rb’) as f: files = {‘file’: (file_path.split(‘/’)[-1], f, ‘text/plain’)} data = { ‘title’: meeting_title, ‘date’: meeting_date, ‘source_type’: ‘public_meeting’, ‘tags’: ‘city council, veterans affairs’ } response = requests.post(f”{BASE_URL}transcripts/upload”, headers=headers, files=files, data=data) response.raise_for_status() upload_result = response.json() print(“Upload successful:”, upload_result) # Store the transcript_id for later processing transcript_id = upload_result.get(‘transcript_id’) print(f”Uploaded transcript ID: {transcript_id}”)
except requests.exceptions.RequestException as e: print(f”Transcript upload error: {e}”)
except FileNotFoundError: print(f”Error: File not found at {file_path}”) The `transcript_id` you get back is the key to everything else. It’s the unique ID for that document, and you’ll need it for all future analysis calls.

Common Mistake: Getting the `Content-Type` header wrong on file uploads. The `requests` library is pretty good at handling this for you when you use the `files` parameter, but if you’re building the request by hand, make sure you’re setting the header to `multipart/form-data`.

VA Home Loan Options

Veteran homeowners. Want to lower your monthly payments?

See if a VA Cash Out Loan or VA Home Loan can put cash in your pocket or help you buy with $0 down. A specialist will review your options, free.

  • VA Cash Out Loan: use up to 100% of your home’s equity
  • VA Home Loan: buy a home with $0 down payment
  • No cost, no obligation eligibility check
Join 100,000+ Veterans
Check my VA loan options
No obligation  ·  2 minutes  ·  100% confidential

3. Extracting Key Information: Speakers and Topics

Once the transcript is uploaded, you can hit the analysis endpoints of the Hamlet API. This is where you actually pull out the useful structured data, like who said what and the main topics they covered. For a reporter on a deadline, this is a huge help because you can instantly see which speakers talked about a specific issue. To get that speaker and topic data, you’ll run a query against the analysis endpoint using your `transcript_id`: “`python
import requests
import json API_KEY = “YOUR_HAMLET_API_KEY”
BASE_URL = “https://api.hamlet.io/v1/”
headers = { “Authorization”: f”Bearer {API_KEY}”, “Content-Type”: “application/json”
} # Assume transcript_id was obtained from the upload step
transcript_id = “your_previously_obtained_transcript_id” try: analysis_payload = { “features”: [“speakers”, “topics”, “keywords”], “transcript_id”: transcript_id } response = requests.post(f”{BASE_URL}transcripts/analyze”, headers=headers, json=analysis_payload) response.raise_for_status() analysis_results = response.json() print(“\n, – Analysis Results, -“) print(“Speakers identified:”) for speaker in analysis_results.get(‘speakers’, []): print(f”- {speaker.get(‘name’)} (Role: {speaker.get(‘role’, ‘N/A’)})”) print(“\nTop topics identified:”) for topic in analysis_results.get(‘topics’, []): print(f”- {topic.get(‘name’)} (Relevance: {topic.get(‘relevance’, 0):.2f})”) print(“\nKeywords extracted:”) for keyword in analysis_results.get(‘keywords’, []): print(f”- {keyword.get(‘text’)} (Score: {keyword.get(‘score’, 0):.2f})”) except requests.exceptions.RequestException as e: print(f”Analysis request error: {e}”) You’ll get back a `speakers` array that lists names and sometimes their roles (if the transcript is good enough) and a `topics` array with the main subjects and a relevance score. Just getting that list of topics can save you hours of reading. I’ve used this exact feature to track which council members always bring up zoning and which ones are more focused on public safety. It’s surprisingly effective.

4. Advanced Querying and Filtering for News Reporting

Sometimes just getting the main speakers and topics isn’t enough for a specific story. You might need to find every single mention of a phrase or see how people are reacting to a new policy, so the Hamlet API has advanced search functions to help you pinpoint that stuff. It’s great for tracking the progress of a specific bill or gauging public reaction to something new. For instance, if you were covering veterans’ affairs in Atlanta and needed to find every discussion about “veteran homelessness” that also mentioned “funding” in the first quarter of the year, your query would look like this: “`python
import requests
import json API_KEY = “YOUR_HAMLET_API_KEY”
BASE_URL = “https://api.hamlet.io/v1/”
headers = { “Authorization”: f”Bearer {API_KEY}”, “Content-Type”: “application/json”
} search_query = { “query”: “(\”veteran homelessness\” AND funding)”, “date_range”: { “start_date”: “2026-01-01”, “end_date”: “2026-03-31” }, “source_types”: [“public_meeting”], “limit”: 10, # Number of results to return “offset”: 0 # For pagination
} try: response = requests.post(f”{BASE_URL}search”, headers=headers, json=search_query) response.raise_for_status() search_results = response.json() print(“\n, – Search Results, -“) if search_results.get(‘total_hits’, 0) > 0: for hit in search_results.get(‘hits’, []): print(f”Transcript ID: {hit.get(‘transcript_id’)}”) print(f” Meeting Title: {hit.get(‘title’)}”) print(f” Date: {hit.get(‘date’)}”) print(f” Snippet: \”…{hit.get(‘snippet’)}…\””) print(“-” * 20) else: print(“No matching results found for your query.”) except requests.exceptions.RequestException as e: print(f”Search request error: {e}”) This kind of query uses boolean operators like `AND` so you only get results where both phrases show up together. The `snippet` it returns is the most useful part, since you can quickly see if a result is relevant without having to pull down and read the entire transcript. If the speaker data is indexed, you could even filter down to just what Councilwoman Emily Chen said about the grant for veterans’ services in that Fulton County budget.

Pro Tip: Don’t just stick with `AND`. Play around with `OR`, `NOT`, and proximity searches (like `”veteran homelessness” NEAR/5 funding`, if Hamlet supports it) to really dial in your search and find more subtle connections in the text.

5. Integrating with Newsroom Workflows and Reporting Tools

The whole point of using the Hamlet API is to get from raw transcripts to a published story faster. Since the API gives you clean JSON, you can feed that structured data directly into other newsroom tools and databases. Once you’ve extracted what you need, the next step is doing something with it. For example:

  1. Store in a Database: Dump the JSON into a PostgreSQL or MongoDB database so multiple journalists can query it over the long term.
  2. Visualize Data: Use Python libraries like `pandas` and `matplotlib` or BI tools like Tableau to make charts that show discussion trends or word clouds of terms from a meeting.
  3. Automate Alerts: Why manually check for news? Set up a script that queries the Hamlet API for new transcripts with keywords like “infrastructure project funding” in Cobb County meetings and have it send you a Slack or email alert.
  4. Generate Drafts: The API can’t write the story for you, but the extracted quotes, speaker names, and topic summaries are a fantastic head start for a draft, saving you a ton of time on basic research.

Here’s a quick example showing how to dump those search results into a pandas DataFrame, which is usually the first step I take before doing any other kind of visualization or deeper analysis: “`python
import pandas as pd
import requests
import json API_KEY = “YOUR_HAMLET_API_KEY”
BASE_URL = “https://api.hamlet.io/v1/”
headers = { “Authorization”: f”Bearer {API_KEY}”, “Content-Type”: “application/json”
} # Re-using the previous search_query for demonstration
search_query = { “query”: “(\”veteran homelessness\” AND funding)”, “date_range”: { “start_date”: “2026-01-01”, “end_date”: “2026-03-31” }, “source_types”: [“public_meeting”], “limit”: 50
} try: response = requests.post(f”{BASE_URL}search”, headers=headers, json=search_query) response.raise_for_status() search_results = response.json() if search_results.get(‘total_hits’, 0) > 0: data_for_df = [] for hit in search_results.get(‘hits’, []): data_for_df.append({ ‘transcript_id’: hit.get(‘transcript_id’), ‘title’: hit.get(‘title’), ‘date’: hit.get(‘date’), ‘snippet’: hit.get(‘snippet’) }) df = pd.DataFrame(data_for_df) print(“\n, – DataFrame of Search Results, -“) print(df.head()) # Further processing: df.to_csv(‘veteran_homelessness_funding_mentions.csv’, index=False) # Or connect to a visualization tool else: print(“No data to process into DataFrame.”) except requests.exceptions.RequestException as e: print(f”Error processing search results for DataFrame: {e}”) This shows how simple it is to get the extracted data into a table so you can start working with it. Being able to access and script against this information is a huge advantage for any kind of data-driven journalism.

Common Mistake: Forgetting about error handling and rate limits. Your code will break. Always wrap your API calls in `try-except` blocks and pay attention to the API’s rate limits so you don’t get your IP address temporarily banned. Most APIs will send back a header like `X-RateLimit-Remaining` to help you out.

Using the Hamlet API means newsrooms don’t have to rely on someone manually reading and highlighting transcripts which dramatically cuts down on research time. This lets journalists do their real job, analyzing information and telling a story, instead of just digging for quotes. That saved time means you can publish smarter, faster news coverage.

What types of public meeting transcripts can the Hamlet API process?

It’s built for a wide range of public meeting transcripts, from city council and county commission hearings to school board meetings and legislative sessions. As long as you have a plain text or PDF file, it can usually extract the spoken dialogue.

How accurate is the speaker identification feature?

The accuracy really depends on the quality of the transcript you feed it. If the text clearly labels speakers with their names, the API’s accuracy is very high. On messier transcripts it has to guess based on conversational flow, so for anything critical you should probably double-check its work.

Can I use the Hamlet API to track specific legislative changes?

Yes, absolutely. If you upload transcripts from legislative sessions, you can use the search and keyword features to track specific bill numbers, amendments, or policy names. You could even write a script to run searches periodically and alert you when something new pops up.

What data formats does the Hamlet API output?

It mostly outputs JSON which is structured, machine-readable, and perfect for feeding into other applications, databases, or analysis tools.

Are there any limitations on the size or number of transcripts I can upload?

The limits on file size and daily uploads usually depend on your subscription plan. You’ll need to check the official Hamlet API documentation or your service agreement to get the exact numbers for your account.

Editorial Team

The Editorial Team at Veteran Finance Guide is a group of writers and editors who cover veterans' benefits, careers, and personal finance. They research each story and publish under a shared desk byline — experts in their fields, working as one team.