Skip to main content

Create your API key

Contact our team to obtain your API key.

Create a .env file

Create a file called .env in the root of your project and add the following line.
CATALOG_API_KEY=<YOUR_API_KEY>

Make an API request

Use Python or JavaScript, or call the API directly with cURL.
Install the required Python packages. If you want to store your API key in a .env file, make sure to install the dotenv library.
pip install requests
pip install python-dotenv
Once you’ve installed the dependencies, choose an endpoint below to get started:
Extract high-quality, real-time product data.
import os
import requests
import time
from dotenv import load_dotenv

# Use .env to store your API key or paste it directly into the code
load_dotenv()

# Start async extraction with URLs
response = requests.post(
    'https://api.getcatalog.ai/v2/extract',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': os.getenv('CATALOG_API_KEY')
    },
    json={
        'urls': [
            'https://www.nike.com/t/air-force-1-07-mens-shoes-5QFp5Z/CW2288-111'
        ],
        'enable_enrichment': False,
        'country_code': 'us'
    }
)

data = response.json()
execution_id = data['execution_id']
print(f"Started extraction with execution ID: {execution_id}")

# Poll for results
while True:
    status_response = requests.get(
        f'https://api.getcatalog.ai/v2/extract/{execution_id}',
        headers={'x-api-key': os.getenv('CATALOG_API_KEY')}
    )
    status_data = status_response.json()
    
    if status_data['status'] == 'completed':
        product = status_data['data'][0]
        if product['success']:
            print(f"Product title: {product['product']['title']}")
        break
    elif status_data['status'] == 'failed':
        print(f"Extraction failed: {status_data.get('error', 'Unknown error')}")
        break
    else:
        progress = status_data.get('meta', {}).get('progress', {})
        print(f"Progress: {progress.get('percent_complete', 0)}%")
        time.sleep(5)  # Wait 5 seconds before next poll