Skip to main content

Introduction

The TypeScript SDK exposes the full Linkup API surface. Use it to integrate Search, Fetch, Research and Tasks. You can use our playground to have interactive examples and see how to implement them with the SDK.

Github

Repository (feel free to contribute)

PyPi

PyPi page

Quickstart

Get started with our Python SDK in less than 5 minutes!

Get your API key

Create a Linkup account for free to get your API key.

Installation

You can install the Linkup Python SDK as any Python package, for instance using pip:

Usage

Here is a basic usage example showing how to use the Linkup Python SDK:

Search parameters

Query

The query parameter is the core input string that defines your search intent. It represents the question or information request that you want Linkup to answer. How you formulate this query significantly impacts the quality and relevance of results. Effective queries should be:
  • Clear and specific: “What were the key findings of NASA’s James Webb telescope in 2023?” provides better results than “Tell me about space discoveries”
  • Contextually rich: Include relevant context when needed (“What are the environmental impacts of lithium mining for EV batteries?”)
  • Naturally phrased: Write as you would ask a knowledgeable person, not with keywords
For optimal results, consider reviewing our prompting guide, which provides detailed strategies for crafting effective queries.

Depth

The depth field is used to select the type of search you want to perform:
  • "fast" (beta): the fastest mode. A single-pass, keyword-like search with no LLM involvement for query interpretation, reformulation, or evaluation. Optimized for conversational use cases where low latency is key (e.g. “weather in Paris today”)
  • "standard": the search will leverage agentic search for a fast yet accurate result, suited for queries that do not rely on sequential steps being performed or several pages being scraped (e.g. “What’s the weather in Paris today?”)
  • "deep": the search will use a full agentic workflow with up to 10 iterations to solve more complex queries (e.g. “First, find Linkup website domain. Then scrape the homepage, product page, and about us page. Then search for recent news. Consolidate the output in a comprehensive company profile”). Runs longer than the other depths.

Output type

The type of output which is expected:
  • "sourcedAnswer": provides a comprehensive natural language answer to the query along with citations to the source material. Ideal for when you need well-formed responses with verifiable information and transparent sourcing.
  • "searchResults": returns the raw search context data without synthesis, giving you direct access to the underlying information. Useful for custom processing, or when you need to implement your own answer generation logic.
  • "structured": allows you to receive responses in a custom format based on the format provided in structured_output_schema. If you want a full guide on how to use it, you can check it here

Structured output schema

Linkup’s structured output feature allows you to receive responses in a custom format that you define. This is particularly useful when you need to integrate Linkup’s responses directly into your application’s data structure or when you want to ensure consistency in the response format. To do that, you have to use the structured_output_schema field. Supported formats are a pydantic.BaseModel or a string representing a valid object JSON schema. If you want a full guide on how to use it, you can check it here

Include images

The include_images parameter allows you to receive image results alongside text results in your search responses. When set to True, Linkup will return relevant images related to your query, each with a URL and metadata. This is particularly useful for:
  • Creating visual search experiences
  • Building content that combines text and images
  • Researching topics where visual information is important
Image results are returned with the same structure as text results but with type: "image".

From date

The from_date parameter filters search results to only include content published after the specified date. This helps you:
  • Focus on recent information
  • Exclude outdated content
The date should be a datetime.date type, for example: datetime.date(2025, 3, 1).

To date

The to_date parameter complements from_date by restricting search results to only include content published or updated before the specified date. This is useful for:
  • Historical research on specific time periods
  • Analyzing content published within a specific date range
  • Avoiding more recent information that might skew results
Like from_date, the date should be a datetime.date type, for example: date(2025, 3, 15). When used together, from_date and to_date create a date range filter for your search results.

Exclude domains

The exclude_domains parameter allows you to specify a list of domains that should be excluded from the search results. This is useful for:
  • Filtering out unwanted sources
  • Avoiding results from specific domains that may not be relevant or trustworthy.

Include domains

The include_domains parameter allows you to specify a list of domains that must be included in the search results. This is useful for:
  • focus on specific sources
  • ensure that results come from trusted domains.

Include inline citations

The include_inline_citations parameter is specifically designed for use with the "sourcedAnswer" output type. When enabled, it embeds citations directly within the answer text, making it easier to identify which parts of the response correspond to specific sources. This is particularly useful for:
  • Academic or research applications where source attribution is critical
  • Creating content that needs verifiable claims with clear sourcing
  • Building applications where users need to quickly verify information
When include_inline_citations is set to True, the answer will contain inline references like [1], [2] that correspond to the sources in the response.

Include sources

The include_sources parameter is specifically designed for use with the "structured" output type. When enabled, it modifies the schema of the structured response to include source information alongside your custom data structure. This is particularly useful for:
  • Applications that need both structured data and source attribution
  • Building systems that require traceability of information
  • Creating responses where you want to maintain both custom format and source verification
When include_sources is set to True, the response will be wrapped in a LinkupSearchStructuredResponse object containing both your structured data and source information.

max_results

The max_results parameter allows you to specify the maximum number of results to return. This is useful for:
  • Limiting the number of results returned
  • Reducing the context size

Fetch parameters

URL

The url parameter specifies the web page URL that you want to fetch content from. This should be a fully qualified URL including the protocol (http:// or https://). The fetch endpoint will retrieve the page content and return it in a cleaned up mardown, making it easy to process the web page by AI agents or other applications.

Include raw HTML

The include_raw_html parameter controls whether the raw HTML source code of the web page is included in the response alongside the cleaned up markdown content. This is useful for applications that need to perform custom HTML parsing, preserve specific formatting, or access elements that might be filtered out during the standard content extraction process.

Render JS

The render_js parameter determines whether JavaScript should be executed when fetching the web page. When set to True, the API will render the page in a browser-like environment, executing JavaScript code and waiting for dynamic content to load before extracting the content. This is essential for modern web applications that rely heavily on JavaScript for content generation, such as single-page applications (SPAs) or pages with dynamically loaded content. Rendering takes longer than the default.

x402 payment

You can use the x402 payment protocol instead of an API key. No account needed.
api_key and x402_signer cannot be used together. Use one or the other.

Examples

This example show you how to combine the standard search with a sourced answer

Example response:

This example shows you how to use the deep with a relative complexe structured output:

Example response:

This example shows you how to use the standard with a search results:

Example response:

This example return text and images sources

Exemple response

This example shows you how to use the dates filter:

Example response:

Additional resources

Prompting guide

We strongly recommend you to read our prompting guide to best prompt the Linkup API and get optimal results. Even small improvements in how you structure your prompts can dramatically enhance the quality of responses and the overall user experience.

Structured output guide

We strongly recommend you to read our structured output guide to ensure consistency in the response format. Mastering structured outputs allows you to fully leverage Linkup’s capabilities while maintaining complete control over how the information is presented and processed in your application.

Tutorials

Don’t hesitate to check our tutorials for other ideas of what to build with Linkup! You’re ready to use the Linkup SDK in your project.
Need help? Email support@linkup.so, ping us on Discord, or talk to us.