Skip to main content

GraphQL and Enigma’s Data Model

Enigma has aggregated the most comprehensive and accurate data set on U.S. businesses. Enigma's data model captures the complex nature of a businesses and the relationships between them. This data is exposed via a GraphQL API that enables you to explore and retrieve it expressively and intuitively.

Query Enigma with GraphQL

You can interact with Enigma's GraphQL API through various means. Here, we will walk through a few common ones.

GraphQL Playground

Head over to the API Playground in the Enigma Console. Click on the “Execute query” button to run the example query.

Programmatic Access

Authentication

All API requests require an API key. Include it in the x-api-key header:

{
"x-api-key": "YOUR_API_KEY"
}

Replace YOUR_API_KEY in the examples below with your actual API key:

Curl
curl -i 'https://api.enigma.com/graphql' \
-H 'content-type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{"query":"query{search(searchInput:{name:\"Enigma\",entityType:BRAND,address:{state:\"NY\",city:\"New York\"}}){... on Brand{names{edges{node{name}}}operatingLocations{edges{node{addresses(first:1){edges{node{fullAddress}}}}}}}}}"}'
Python
import requests

query = f"""
query brandSearch($searchInput: SearchInput!) {{
search(
searchInput: $searchInput
) {{
... on Brand {{
names {{
edges {{
node {{
name
}}
}}
}}
operatingLocations {{
edges {{
node {{
addresses(first: 1) {{
edges {{
node {{
fullAddress
}}
}}
}}
}}
}}
}}
}}
}}
}}
"""

variables = {
"searchInput": {
"name": "Enigma",
"entityType": "BRAND",
"address": { "state": "NY", "city": "New York" }
}
}

response=requests.post(
'https://api.enigma.com/graphql',
headers={"x-api-key":"YOUR_API_KEY"},
json={"query": query, "variables": variables}
)

print(response.json())
Details

Postman Postman provides handy tools for working with GraphQL requests. Refer to Postman's documentation on how to set up GraphQL requests on Postman.