- Docs
- Guides
- Build with Enigma
- GraphQL API
Ask a question in plain English
Send a question in plain English, and the API writes and runs the query for you.
Prompt search answers a question written in plain English. Put the question in searchInput.prompt and leave out the selection set (the { ... on Brand { ... } } block that usually follows search(...)). Enigma’s prompt search writes a GraphQL query for the question, the API runs that query, and the results come back in data.
The generated query sets the entity type, the filters, and the fields to return, so the shape of the results and the keys they come back under depend on the question. When prompt is set, the other SearchInput fields, such as entityType, conditions, and output, are ignored, except promptQueryStrategy. Prompt search picks a template for the question by default; set promptQueryStrategy: "generative" to have it write the whole query instead, or "turbo" (experimental) to have a small model pick the template. The generated query is billed like any other search.
A prompt search took 0.7 s (1.7 s) by default, 1.9 s (3.4 s) with "generative", and 0.3 s (1.8 s) with "turbo": the median, with the 90th percentile in parentheses, over sample questions, the first time the API ran each query. The times are measured on Enigma’s servers, so they leave out the latency between the caller and the API.
Ask about a specific business by its name or website, for example:
- “Give me a company profile for chipotle.com.”
- “Find the Shake Shack (shakeshack.com) locations in Boston, MA with their addresses and phone numbers.”
Prompt search also answers counts, such as “How many coffee shops are in Austin, Texas?”
Example
Section titled “Example”query { search(searchInput: { prompt: "Give me a company profile for chipotle.com." })}{ "data": { "search": [ { "__typename": "Brand", "id": "825ce859-b742-49cb-9787-b9b32f674f25", "names": { "edges": [ { "node": { "id": "000000d0-0003-cd6a-0000-0a8000000000", "__typename": "BrandName", "name": "CHIPOTLE MEXICAN GRILL" } } ] }, "websites": { "edges": [ { "node": { "id": "0000002a-0010-6545-0000-0a8000000000", "__typename": "Website", "website": "https://www.chipotle.com", "domain": "chipotle", "firstObservedDate": "2013-05-01 15:36:40+00", "lastObservedDate": "2026-11-11 01:57:12+00", "websiteContents": { "edges": [ { "node": { "id": "00000356-0007-348c-0000-0b8000000000", "__typename": "WebsiteContent", "httpStatusCode": "200" } } ] } } } ] }, "industries": { "edges": [ { "node": { "id": "00000002-0000-052e-0000-098000000000", "__typename": "Industry", "industryDesc": "Full-Service Restaurants", "industryCode": "722511", "industryType": "naics_2022_code" } }, { "node": { "id": "00000000-0000-008f-0000-028000000000", "__typename": "Industry", "industryDesc": "mexican restaurant", "industryCode": null, "industryType": "enigma_industry_description" } } ] }, "operatingLocations": { "edges": [ { "node": { "__typename": "OperatingLocation", "id": "b4c3ecb6-2622-4046-8d14-9488e637b7d4", "names": { "edges": [ { "node": { "id": "0000006c-0002-25e2-0000-0a8000000000", "__typename": "OperatingLocationName", "name": "CHIPOTLE MEXICAN GRILL" } } ] }, "addresses": { "edges": [ { "node": { "id": "000002ea-0002-5127-0000-0b8000000000", "__typename": "Address", "fullAddress": "610 NEWPORT CENTER DR STE 1100 NEWPORT BEACH CA 92660", "streetAddress1": "610 NEWPORT CENTER DR", "city": "NEWPORT BEACH", "state": "CA", "zip": "92660" } } ] }, "phoneNumbers": { "edges": [ { "node": { "id": "00000038-0002-9f24-0000-0a8000000000", "__typename": "PhoneNumber", "phoneNumber": "+13032222541" } } ] }, "operatingStatuses": { "edges": [ { "node": { "id": "0000007a-0008-185c-0000-0a8000000000", "__typename": "OperatingLocationOperatingStatus", "operatingStatus": "Open" } } ] } } } ] }, "legalEntities": { "edges": [ { "node": { "__typename": "LegalEntity", "id": "10f7ec29-9724-49af-afaa-ffd8508bfc9b", "names": { "edges": [ { "node": { "id": "0000041a-0003-802c-0000-0b8000000000", "__typename": "LegalEntityName", "name": "CHIPOTLE MEXICAN GRILL, INC.", "legalEntityType": "Corporation" } } ] }, "types": { "edges": [ { "node": { "id": "0000014a-0006-7566-0000-0b8000000000", "__typename": "LegalEntityType", "legalEntityType": "Corporation" } } ] } } }, { "node": { "__typename": "LegalEntity", "id": "1adce9c8-6ff7-ac0c-0000-10c000000000", "names": { "edges": [ { "node": { "id": "000000be-0002-27d0-0000-0a8000000000", "__typename": "LegalEntityName", "name": "CHIPOTLE MEXICAN GRILL OF COLORADO, LLC", "legalEntityType": "Limited Liability Company" } } ] }, "types": { "edges": [ { "node": { "id": "000003a6-0003-5686-0000-0b8000000000", "__typename": "LegalEntityType", "legalEntityType": "Limited Liability Company" } } ] } } }, { "node": { "__typename": "LegalEntity", "id": "6badbac0-4bb5-5e4b-0000-10c000000000", "names": { "edges": [ { "node": { "id": "00000460-0004-730d-0000-0b8000000000", "__typename": "LegalEntityName", "name": "CHIPOTLE SERVICES, LLC", "legalEntityType": "Limited Liability Company" } } ] }, "types": { "edges": [ { "node": { "id": "00000320-0005-bccb-0000-0b8000000000", "__typename": "LegalEntityType", "legalEntityType": "Limited Liability Company" } } ] } } } ] } } ] }}Unsupported requests
Section titled “Unsupported requests”| Request | Result |
|---|---|
prompt with a selection set |
HTTP 400 with the error 'prompt' cannot be combined with a selection set |
prompt beside another field or operation |
HTTP 400 with the error a 'prompt' search must be the only field of the only operation in the query |
searchInput passed whole in a GraphQL variable |
Not supported. Write searchInput inline; the question in it can be a variable, as in searchInput: { prompt: $question }. |
prompt in an aggregate query |
HTTP 400 with the error 'prompt' is not supported for aggregate queries |
| A question that lists businesses by category, such as “List all the coffee shops in Austin, Texas.” | HTTP 400 with an error saying that category discovery is not supported |
When prompt search declines a question, the API returns HTTP 400 with the reason in errors. When writing and running the query takes too long, the API returns HTTP 504. If prompt search is busy, the API returns HTTP 429 or 529; retry after a short wait.
Python SDK
Section titled “Python SDK”The Enigma Python SDK, enigma-api-client, sends your question to the API as a prompt search with your API key and returns the results, with the generated query in response.extensions["generatedQueries"]. It requires Python 3.11 or later.
pip install enigma-api-clientimport asynciofrom enigma_api_client import Client, ClientConfig
async def main(): async with Client(ClientConfig(enigma_api_key="YOUR_API_KEY")) as client: response = await client.search(prompt="Give me a company profile for chipotle.com.") print(response.status_code, response.data)
asyncio.run(main())To see the generated query and its variables without running them, call ServiceStrategy.generate_query:
import asynciofrom enigma_api_client.strategies import ServiceStrategy
async def main(): strategy = ServiceStrategy(enigma_api_key="YOUR_API_KEY") try: generated = await strategy.generate_query("Give me a company profile for chipotle.com.") print(generated.query) print(generated.variables) finally: await strategy.aclose()
asyncio.run(main())The Python SDK guide covers the other ways the SDK turns a question into a query.