Skip to main content

metalift-sdk

Official Python SDK for Metalift — turn any URL into agent-ready markdown, HTML, or structured data.

Install

pip install metalift-sdk

Requires Python 3.10+.

Quick start

from metalift_sdk import Metalift

client = Metalift(api_key="YOUR_API_KEY")

result = client.scrape(
    "https://example.com",
    formats=["markdown"],
)
print(result["data"]["markdown"])

Get an API key from the Metalift dashboard. New accounts receive 1,000 free credits/month.

Web search (decoupled from scrape)

Search returns top 10 SERP snippets (2 credits). See Release notes for availability on Metalift Cloud.

serp = client.search("docker docs")
page = client.scrape(serp["results"][0]["url"], formats=["markdown"])

If search returns Not Found on api.metalift.ai, upgrade to metalift-sdk>=1.0.6 for a clearer error message.

Configuration

from metalift_sdk import Metalift

client = Metalift(
    api_url="https://api.metalift.ai",  # default
    api_key="YOUR_API_KEY",
    timeout=60.0,
)

Environment variables are also supported:

Variable Description
METALIFT_API_URL API base URL (default: https://api.metalift.ai)
METALIFT_API_KEY Bearer token for authenticated requests

Metalift Cloud requires X-B2B-Attestation: I-confirm-B2B-use on authenticated requests. metalift-sdk ≥ 1.0.11 sends this header automatically.

API

Scrape

client.scrape(
    "https://example.com",
    formats=["markdown"],
    render="auto",
    only_main_content=True,
    strategy="default",
)

Batch scrape

client.batch(
    ["https://example.com", "https://example.org"],
    async_=True,
    scrape_options={"formats": ["markdown"]},
)

Crawl and map

crawl_job = client.crawl("https://example.com", limit=50)
map_result = client.map("https://example.com", limit=100)

Async jobs

job = client.crawl("https://example.com", limit=20)
completed = client.wait_for_job(job["job_id"])
print(completed["status"], completed.get("data"))

Strategies and protected sites

strategies = client.list_strategies()
protection = client.list_protection_types()

client.scrape(
    "https://www.walmart.com/ip/EXAMPLE",
    strategy="retail",
    formats=["markdown"],
)

client.fetch_session(url="https://www.walmart.com/", domain="www.walmart.com")

Session cookies

client.seed_session(
    domain="example.com",
    cookies=[{"name": "session", "value": "...", "domain": "example.com", "path": "/"}],
)

Errors

API failures raise MetaliftError:

from metalift_sdk import Metalift, MetaliftError

try:
    client.scrape("https://example.com")
except MetaliftError as exc:
    print(exc.status_code, exc.detail)

Links

License & distribution

metalift-sdk is proprietary software licensed under the terms in LICENSE. Use, copying, modification, and redistribution are not permitted except as expressly authorized by Metalift.

The package is published on the public Python Package Index (PyPI) so customers can install it with pip install metalift-sdk. Publishing on PyPI does not make the software open source: the wheel and source archive are publicly downloadable, but legal use remains governed by the proprietary license.

Do not commit API keys or other credentials into your application code. Pass them at runtime via the api_key argument or the METALIFT_API_KEY environment variable.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metalift_sdk-1.0.11.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metalift_sdk-1.0.11-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file metalift_sdk-1.0.11.tar.gz.

File metadata

  • Download URL: metalift_sdk-1.0.11.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for metalift_sdk-1.0.11.tar.gz
Algorithm Hash digest
SHA256 13da51da7d81f4ce6c99b9602dc46e322862d81febf0805accc77fc28a2fe0d2
MD5 a47f36f80e0c322778b5f939506155f8
BLAKE2b-256 93a3e02d2b12976a3f1efda82888b9c68fc2f180a5daa98447bc2ea618dbe122

See more details on using hashes here.

File details

Details for the file metalift_sdk-1.0.11-py3-none-any.whl.

File metadata

  • Download URL: metalift_sdk-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for metalift_sdk-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 50869aab7d812f592d5837371b35074f1f7c05d341d005aa6ae2fe300a0eaf51
MD5 1654ab0f42c8329a8bf958bc16592c7a
BLAKE2b-256 fbe7674b9697a29627499edcb43f180df38b4d7bbf58c1922c3855869a234ee6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page