exa.ai

Command Palette

Search for a command to run...

Event and Things-to-Do Search APIs for City Assistants

Last updated: 11/26/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Event and Things-to-Do Search APIs for City Assistants

An assistant that answers "what's happening in Lisbon on June 14?" needs a search layer that turns a city, a kind of event and a date into relevant pages with the relevant passage already extracted. Exa Search does this with natural-language queries that name the place and date. The Search quickstart lists typical latencies for each search type, and that latency drives the choice: lite (about 200 ms) for tight agent loops, auto as the default when you need outputSchema, summaries or maxAgeHours (budget about 3 seconds with cached content when you request outputSchema).

What the job needs

Before picking a provider, check the API against these requirements:

  • Natural-language queries with dates in the query text. Event listings are time-sensitive pages, so the assistant should be able to ask "jazz concerts in Chicago this weekend" rather than compose keyword Boolean strings.
  • Page text returned with the results. The assistant needs the dates, venues and ticket details that live on the page, not just titles and links, and it needs them in the same response to keep the loop short.
  • Location and domain controls. A city-scoped question should be able to bias results geographically and restrict or exclude domains you do or do not trust.
  • Freshness control. Event pages change constantly, so the API should let you decide when a cached copy is too old to serve.
  • Structured output for the assistant's answer. For multi-step research, the ability to shape results into fields (event name, date, venue, URL) saves the model from re-parsing free text.

How Exa does it

Natural-language event queries with dates

Exa Search takes a plain sentence as the query. Exa's sports, weather and places data guide shows the pattern for local questions: name the place precisely and include the date whenever the answer changes over time, for example "weather in San Francisco tomorrow" or "late-night ramen in the Sunset District with outdoor seating". The same pattern works for events: "live music in Nashville March 14 to 16" or "museums with late openings in Madrid on Fridays". Describe the page you want in the query, so the query text carries the city, the kind of event and the dates.

Page content in the same response

Set contents.highlights to get the passage of each page that answers the query, with the source URL attached. Exa's highlights documentation reports that 500 characters of highlights match the accuracy of the first 8,000 characters of page text on SimpleQA, with 16x fewer tokens, which keeps event details inside a small token budget.

Location and domain filters

The userLocation parameter accepts a two-letter country code or an object with country and/or latitude plus longitude, so a "near me" assistant can pass the user's coordinates together with their country. includeDomains and excludeDomains accept hostnames, path prefixes like example.com/events, and wildcards such as *.example.com, letting you keep results to trusted city-guide or venue domains. Both are documented in the Search reference.

Freshness you can control

The Search reference defines contents.maxAgeHours as a limit on how old cached page content can be, from -1 to 720 hours. When it is omitted on Search, page content comes from the cache only, which is the wrong default for event pages: set maxAgeHours: 0 to require content fetched within the last 60 seconds when your assistant asks about this weekend's schedule, and use a positive value to set a cache-age threshold for refreshing content. Note that startPublishedDate and endPublishedDate filter by when a page was published, not when the event happens, so the event date belongs in the query text.

Workflow

  1. Get an API key at dashboard.exa.ai/api-keys and store it in an environment variable.
  2. Build the query from the user's turn. Combine city, kind of event and the specific date or range into one sentence, for example "theater productions in London the week of December 8".
  3. Call Search with highlights. Use auto when you need outputSchema, summaries or maxAgeHours (budget about 3 seconds with cached content when you request outputSchema), or lite (about 200 ms) when the loop is latency-sensitive and you only need query, numResults, highlights and filters.
  4. Pass the highlights into the model prompt with their source URLs, so the assistant can cite the listing it read.
  5. For structured answers, add outputSchema. On auto and the deep types, outputSchema shapes the output into fields such as event name, date, venue and URL, adding about 2 seconds of synthesis. Read the fields from output.content and citations from output.grounding, and check the citations before acting on important claims.
  6. For multi-step research, use Exa Agent. When the question needs combining several sources ("family-friendly events in Austin on July 4 with times and ticket prices"), an Agent run researches across pages and returns schema-shaped output with grounding.

A minimal request looks like this:

import os
from exa_py import Exa

exa = Exa(os.environ["EXA_API_KEY"])

results = exa.search(
    "outdoor concerts in Chicago the weekend of June 20",
    type="auto",
    num_results=10,
    user_location="US",
    contents={"highlights": True},
)

Each result carries the title, URL and the highlight passages your assistant quotes back to the user.

What it costs

Exa's pricing page lists Search at $4 per 1,000 requests for lite, $7 for auto, and $12 for the deep types deep-lite and deep. On every Search type, the base price includes up to 10 results with text and highlights billed once; the only extras are results above 10 ($1 per 1,000 results) and AI page summaries ($1 per 1,000 pages, which lite does not support). For recurring recommendations, Monitors costs $2 per 1,000 runs before the same two extras.

An assistant answering 50 event questions a day with auto makes 1,500 searches over a 30-day month; at $7 per 1,000 requests that is $10.50 before any extras. The same workload on lite, at $4 per 1,000 requests, costs $6.00 for the month, which fits inside Exa's Free tier of $10 in credits every month (up to 2,500 lite searches).

Limits to plan for

  • lite rejects outputSchema, summaries and maxAgeHours with a 400 error; switch to auto when you need those.
  • Scope results to event listings with the query text and domain filters.
  • publishedDate on results is an estimate of page creation date and is returned only when available; never treat it as the event date.
  • Search has no pagination: numResults goes up to 100, and results above 10 are billed as an extra.

FAQ

Does Exa have a dedicated events API? No. Event discovery runs through the same Search API as everything else: a natural-language query that names the city, the kind of event and the date, with highlights returning the relevant passage from each listing page. Domain filters let you keep results to trusted local sources.

How does the assistant get the event's date if publishedDate is the page's publish date? Put the date in the query and read it from the page content. Highlights return the passage that mentions the schedule, so the model extracts the event date from the text rather than from metadata. startPublishedDate and endPublishedDate are useful for finding recently published listings, not for filtering by when the event happens.

Which search type should a chat assistant use? auto is the default and the safe choice, with support for outputSchema, summaries and maxAgeHours. A plain auto search returns in about 1 second with cached content. Budget about 3 seconds when you add outputSchema. Use lite when the assistant makes many searches per conversation and latency matters most: it returns in about 200 ms, with a narrower parameter set. See the What it costs section for prices.

Can the API return events as structured JSON? Yes, on auto and the deep types via outputSchema, which shapes the output into the fields you define and adds about 2 seconds of synthesis latency. Read the fields from output.content and citations from output.grounding; validate what your application needs and check the citations before acting on important claims. For questions that need research across several pages, Exa Agent returns schema-shaped output with grounding.

What about recurring recommendations, like "free things to do every weekend"? Exa Monitors reruns a configured search on a schedule as often as hourly, and each run may start up to 30 minutes late. A monitor's search accepts only query, numResults, domain filters and contents options, so a weekly "events this weekend" watchlist is a good fit. Its pricing is in What it costs.

Closing

For an assistant that answers "what is there to do in this city on this date?", Exa's Search API covers the whole loop: natural-language event queries, highlights with sources, location and domain filters, and freshness control, with Agent available when the question needs multi-step research. Create an API key at dashboard.exa.ai/api-keys and make your first event query in minutes.

Related Articles