Desearch API SDK

    Desearch API SDK

    Introduction

    This page covers the official Desearch SDKs for Python and JavaScript and helps you pick one.

    Both SDKs handle authentication, typed responses, and error handling, so you do not write raw HTTP requests.

    Supported Languages

    Python SDK

    Good fit for:

    • Data science and machine learning applications
    • Backend services and APIs
    • Automation scripts and bots
    • Jupyter notebooks
    • AI agent frameworks (LangChain, LlamaIndex, CrewAI)

    Features:

    • Async client support with asyncio
    • Pydantic models for type validation
    • Python 3.8+

    View Python SDK Documentation →

    JavaScript/TypeScript SDK

    Good fit for:

    • Node.js backend applications
    • React, Vue, or Angular frontends
    • Serverless functions (AWS Lambda, Vercel, Cloudflare Workers)
    • Full-stack TypeScript projects

    Features:

    • TypeScript type definitions
    • Promise-based async API
    • Tree-shakeable

    View JavaScript SDK Documentation →

    Quick Comparison

    FeaturePython SDKJavaScript SDK
    Async Support✅ asyncio✅ Promises
    Type Safety✅ Pydantic✅ TypeScript
    Browser Support❌✅
    Node.js Support❌✅
    Framework IntegrationsLangChain, LlamaIndexReact, Vue, Next.js

    Common Features

    Both SDKs cover the search methods below. Extract differs by package. See the Python SDK and JavaScript SDK.

    Search Endpoints

    • AI Contextual Search: Multi-source semantic search with optional AI-generated summaries
    • AI Web Links Search: Raw link search across web sources without AI summaries
    • AI X Posts Links Search: AI-powered X (Twitter) post link search
    • X Search: X (Twitter) search with filtering options
    • SERP Web Search: Paginated web search replicating a typical search engine

    X (Twitter) Data Endpoints

    • Fetch Posts by URLs: Retrieve full post data for a list of X post URLs
    • Retrieve Post by ID: Fetch a single X post by its unique ID
    • Search X Posts by User: Search posts from a specific user with optional keyword filtering
    • Get Retweeters of a Post: List users who retweeted a specific post
    • Get X Posts by Username: Retrieve a user's timeline posts
    • Fetch User's Tweets and Replies: Fetch tweets and replies from a specific user
    • Retrieve Replies for a Post: Fetch replies to a specific X post

    Extract API

    • Extract a URL: Fetch page content as plain text or HTML

    People Search

    • X Profile Search, YouTube Creator Search, LinkedIn Profile Search, TikTok Creator Search: Start a background search for people who match a plain-language description
    • Tasks: Poll a search, read its results page by page, pause, resume, or cancel it, and export CSV or JSON Lines
    • Profiles library: List and export everyone your searches found, with filters such as has=email

    People Search methods ship in desearch-py 1.4.0 and desearch-js 1.6.0. metadata labels on searches and on the task list need desearch-py 1.5.0 or desearch-js 1.7.0. The result fields (completion_reason, coverage_limited, warnings, criteria_checks, fully_verified, enrichment) are typed in desearch-py 1.6.1 and desearch-js 1.8.1. See People Search.

    On PyPI desearch-py 1.2.1, call web_crawl (there is no extract() on that release). On desearch-js 1.5.1, call extract(). webCrawl() remains a deprecated alias. The canonical REST endpoint for new integrations is GET /web/extract. See the Extract API.

    Getting Started

    Step 1: Get Your API Key

    1. Visit console.desearch.ai
    2. Create an account or sign in
    3. Open the API Keys section
    4. Generate a new API key
    5. Copy and store it securely

    Step 2: Choose Your SDK

    Step 3: Install

    Python:

    bash
    pip install desearch-py

    JavaScript:

    bash
    npm install desearch-js # or yarn add desearch-js

    desearch-js requires Node.js 20.18.1 or later.

    Step 4: Make Your First Request

    Python:

    python
    import asyncio from desearch_py import Desearch async def main(): async with Desearch(api_key="your_api_key") as desearch: result = await desearch.ai_search( prompt="Latest developments in AI", tools=["web", "twitter"], ) print(result) asyncio.run(main())

    JavaScript:

    typescript
    import Desearch from "desearch-js"; const desearch = new Desearch("your-api-key"); desearch .aiSearch({ prompt: "Latest developments in AI", tools: ["web", "twitter"], }) .then((response) => { console.log(response); });

    Support and Resources