Create and setup your API key

Get your Exa API key


Create a .env file

Create a file called .env in the root of your project and add the following line.

EXA_API_KEY=your api key without quotes

Make an API request

Use our python or javascript SDKs, or call the API directly with cURL.

Install the python SDKs with pip. If you want to store your API key in a .env file, make sure to install the dotenv library.

pip install exa-py
pip install openai
pip install python-dotenv

Once you’ve installed the SDKs, create a file called exa.py and add the code below.

Get a list of results and their full text content.

python
from exa_py import Exa
from dotenv import load_dotenv

import os

# Use .env to store your API key or paste it directly into the code
load_dotenv()
exa = Exa(os.getenv('EXA_API_KEY'))

result = exa.search_and_contents(
  "An article about the state of AGI",
  type="auto",
  text=True,
)

print(result)