Skip to main content

Get Your API Key

Start by getting your SnakeQuery API key from the dashboard.

Step 1: Sign Up

  1. Visit SnakeQuery Dashboard
  2. Sign up with your email or Google account
New users get free credits to start experimenting!
  1. Navigate to the Setup section in your dashboard
  2. Copy your API key
Keep your API key secure! Never commit it to public repositories.

Choose Your Setup

Select the integration method that works best for your project.

JavaScript Setup

Use SnakeQuery directly in the browser with Fetch API:
// Set up environment variable (recommended)
const API_KEY = 'your-api-key-here';

async function queryWithSnakeQuery() {
  const response = await fetch('https://app.snakequery.com/api/query', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${API_KEY}`
    },
    body: JSON.stringify({
      query: 'Find products under $100',
      data: [
        { name: 'iPhone', price: 999 },
        { name: 'Coffee Mug', price: 19 },
        { name: 'Notebook', price: 15 }
      ]
    })
  });
  
  const result = await response.json();
  console.log(result.response);
}

queryWithSnakeQuery();

Learn More

Complete Fetch API documentation

Node.js Setup

Install and use the official Node.js SDK:
npm install snake-query
const SnakeQuery = require('snake-query');
const { SchemaBuilder } = SnakeQuery;

// Initialize client
const client = new SnakeQuery('your-api-key-here');

// Your first query
async function firstQuery() {
  const products = [
    { name: 'iPhone', price: 999, category: 'electronics' },
    { name: 'Shoes', price: 129, category: 'fashion' },
    { name: 'Book', price: 19, category: 'books' }
  ];
  
  const result = await client.query({
    query: 'Find products under $200',
    data: products
  });
  
  console.log('Results:', result.response);
  console.log('Tokens used:', result.usageCount.totalTokens);
}

firstQuery();

Learn More

Complete Node.js SDK documentation

Python Setup

Install and use the official Python SDK:
pip install snake-query-sdk
from snake_query_sdk import SnakeQuery, SchemaBuilder
import os

# Initialize client
client = SnakeQuery(api_key='your-api-key-here')

# Your first query
products = [
    {'name': 'iPhone', 'price': 999, 'category': 'electronics'},
    {'name': 'Shoes', 'price': 129, 'category': 'fashion'},
    {'name': 'Book', 'price': 19, 'category': 'books'}
]

result = client.query(
    query='Find products under $200',
    data=products
)

print('Results:', result['response'])
print('Tokens used:', result['usageCount']['totalTokens'])

Learn More

Complete Python SDK documentation

Your First Query

Let’s run a simple query to see SnakeQuery in action:
const result = await client.query({
  query: 'Find the most expensive product and show its name and price',
  data: [
    { name: 'iPhone 14', price: 999 },
    { name: 'MacBook Pro', price: 2399 },
    { name: 'AirPods', price: 179 }
  ]
});

console.log(result.response);
// Expected output: [{ name: 'MacBook Pro', price: 2399 }]

Add Structure with Schemas

For production applications, always define response schemas for consistent results:
const productSchema = SchemaBuilder.create()
  .array(
    SchemaBuilder.create()
      .object()
      .addStringProperty('productName')
      .addNumberProperty('price', { minimum: 0 })
      .required(['productName', 'price'])
      .build()
  )
  .build();

const result = await client.query({
  query: 'Find products under $500',
  data: products,
  responseSchema: productSchema
});

Query External APIs

You can also query data from external REST APIs:
const result = await client.query({
  query: 'Show me 5 products with their titles and prices',
  fetchUrl: 'https://api.escuelajs.co/api/v1/products',
  responseSchema: productSchema
});

Next Steps

Now that you’ve made your first query, explore these advanced features:

Common Use Cases

Here are some popular ways developers use SnakeQuery:
const result = await client.query({
  query: 'Find electronics under $500, sort by rating, show top 10',
  fetchUrl: 'https://api.store.com/products'
});
result = client.query(
    query='Calculate monthly sales trends and growth percentage',
    fetch_url='https://api.company.com/sales'
)
const result = await client.query({
  query: 'List active users from last 30 days with their roles',
  fetchUrl: 'https://api.company.com/users'
});
Need help? Join our community or reach out to support@snakequery.com.
I