Enigma API Client
The Enigma Python SDK, enigma-api-client, sends GraphQL queries to the Enigma GraphQL API and turns questions in plain English into those queries. This page gets you started, and the Python SDK guide covers the rest.
Before You Begin
- An Enigma API key. Find yours in the Enigma Console under Settings > Account > API keys.
- Python 3.11 or later.
The examples read your Enigma API key from the ENIGMA_API_KEY environment variable:
export ENIGMA_API_KEY="your-api-key"
Install
pip install enigma-api-client
The examples on this page need no extra. The guide's quickstart lists the optional extras for generating queries on your own machine, and its Choose a strategy section gives the time each strategy takes to write a query.
The experimental TurboStrategy writes queries on your machine with a small model and no LLM call. The turbo extra installs its model, the enigma-turbo-model package, and the libraries that run it:
pip install "enigma-api-client[turbo]"
Quickstart
Ask a Question
import asyncio
import os
from enigma_api_client import Client, ClientConfig
async def main():
config = ClientConfig(enigma_api_key=os.environ["ENIGMA_API_KEY"])
async with Client(config) as client:
response = await client.search(prompt="Tell me about Chipotle")
if not response.is_success():
raise RuntimeError(f"HTTP {response.status_code}: {response.errors}")
brand = response.data["search"][0]
print(brand["names"]["edges"][0]["node"]["name"]) # CHIPOTLE MEXICAN GRILL
print(brand["__url"]) # the brand's profile in the Enigma Console
asyncio.run(main())
The SDK turns the question into a GraphQL query, runs it, and returns the result. By default, Enigma's hosted query service writes the query, so your Enigma API key is all you need.
Send a GraphQL Query
import asyncio
import os
from enigma_api_client import Client, ClientConfig
QUERY = """
query Brand($name: String!) {
search(searchInput: { name: $name, entityType: BRAND, conditions: { limit: 1 } }) {
... on Brand {
names(first: 1) { edges { node { name } } }
websites(first: 1) { edges { node { website } } }
}
}
}
"""
async def main():
config = ClientConfig(enigma_api_key=os.environ["ENIGMA_API_KEY"])
async with Client(config) as client:
response = await client.search(query=QUERY, variables={"name": "Chipotle"})
if not response.is_success():
raise RuntimeError(f"HTTP {response.status_code}: {response.errors}")
brand = response.data["search"][0]
print(brand["names"]["edges"][0]["node"]["name"]) # CHIPOTLE MEXICAN GRILL
print(brand["websites"]["edges"][0]["node"]["website"]) # https://www.chipotle.com
asyncio.run(main())
A name can match many entities, so conditions: { limit: 1 } keeps only the first.
Python SDK Guide
- Quickstart: install the SDK, ask a question in plain English, and send your first GraphQL query.
- Configure the client and read responses: set up the client, read what a search returns, handle errors, and page through connections.
- Generate queries from questions: the questions the SDK answers, the strategies that turn them into GraphQL, and the data each access tier returns.
- Customize query generation: pick the LLM provider, write your own provider or strategy, control the query shape cache, and read the token usage of each call.
- Look up addresses and government records: find what is at a street address and get the government records of a business, person, or address.
- Python SDK reference: environment variables, logging, what the SDK sends off your machine, and the rules for GraphQL you write by hand.
- Upgrade notes: what changes for your code when you upgrade the SDK from an earlier release.
GraphQL API
- GraphQL quickstart: how a GraphQL query reads Enigma data, with a first search.
- GraphQL reference: every keyword of the schema.
- API basics: the endpoint, authentication, status codes, rate limits, and credits.
- How Enigma models a business: brands, legal entities, operating locations, people, and addresses, and how they connect.
- Ask a question in plain English: send a question to the API, which writes and runs the search.
- Gov Archive records: government records about a business, a person, or an address.
Support
For help, write to Enigma support.
Metadata
Release files for enigma-api-client 0.15.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enigma_api_client-0.15.3-py3-none-any.whl | Python 3 | none | any | Details for enigma_api_client-0.15.3-py3-none-any.whl |
Release files / enigma_api_client-0.15.3-py3-none-any.whl
| Download URL | enigma_api_client-0.15.3-py3-none-any.whl |
|---|---|
| Size | 359.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a18e91aefa4cbdbf2cc532f3af4c4ec61becc91e7dcb73db306a1bd6da33ad1b
|
|
BLAKE2b-256 checksum How to use checksums |
acc6d056507c704da072767c8741f0094a6e579dde7a5be9074929d8f91e202b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Security for enigma-api-client 0.15.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.