> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.salamoonder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

> Learn by doing. Each example below demonstrates a specific use case with production-ready code you can adapt immediately.

## Before You Build.

The first two pages covered the fundamentals. Now let's show you what's actually possible with Salamoonder, whether you're a seasoned developer or just getting started.

Below are sample projects meant to make a point, along with community examples. These are rhetorical use cases, not real world deployments. They exist to explain ideas and prompt discussion, not to act as live projects you can reference.

If you're ready to code, jump straight to the next section. But take a minute here first. You might discover something that sparks your next build. Here's what you can do with [Salamoonder](https://salamoonder.com/).

<Accordion title="Automate your social media growth and revenue.">
  Want to scale on Kick, Twitch, or Whatnot? You need automation, but every platform throws captchas at you immediately. Salamoonder handles it. Build tools that create accounts, boost followers, and drive revenue at real speed. This is how top streamers scale.
</Accordion>

<Accordion title="Track product pricing without the blocks.">
  Monitoring Nike, Canada Goose, Footlocker? Kasada will kill your scrapers instantly. Salamoonder solves the protection layer so you can build price tracking that actually works. Get the data you need, consistently.
</Accordion>

<Accordion title="Win every limited drop.">
  Arc’teryx just dropped. Nike’s releasing in 60 seconds. You need checkout automation or you’re getting nothing. Salamoonder handles every captcha instantly. Build bots that complete orders in seconds while others are still loading the page.
</Accordion>

## **Ready to build?**

Now that you see what’s possible, let’s build. Below are working examples to get you started fast. These use our [Software Development Kit](https://apidocs.salamoonder.com/sdk/official), so make sure it’s included in your project. If something breaks, let us know. We don’t monitor these actively, so your feedback keeps them running.

### Kasada Standard Examples

```python expandable theme={null}
import asyncio
import salamoonder

API_KEY = "sr-YOUR-KEY"

async with salamoonder.Salamoonder(API_KEY) as client:
    task_id = await client.task.createTask(
        task_type="KasadaCaptchaSolver", 
        pjs_url="https://example.com/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/p.js",
        cd_only="false"
    )

    result = await client.task.getTaskResult(task_id)

    if "x-kpsdk-ct" not in result:
        print(f"Failed to solve challenge: {result}")
        return

    print(result)

```

### Kasada Payload Examples

```python expandable theme={null}
import asyncio
import salamoonder

# Keep in mind not using the same USER-AGENT as displayed as our docs will result in bad responses.
# https://apidocs.salamoonder.com/tasks/kasada/payload

URL = "https://example.com/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fp?x-kpsdk-v=j-1.2.170"
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36"
PROXY = "http://user:pass@ip:port"
API_KEY = "sr-YOUR-KEY"

async with salamoonder.Salamoonder(API_KEY) as client:
    data = await client.kasada.parse_kasada_script(url=URL, user_agent=USER_AGENT, proxy=PROXY)

    task_id = await client.task.createTask(
        task_type="KasadaPayloadSolver",
        url="https://example.com",
        script_url=data["script_url"],
        script_content=data["script_content"],
    )

    result = await client.task.getTaskResult(task_id)

    post_solution = await client.kasada.post_payload(
        url="https://example.com",
        solution=result,
        user_agent=USER_AGENT,
        proxy=PROXY,
        mfc=False
    )

    print(post_solution)
```

### Akamai Web Examples

<CodeGroup>
  ```python web.py expandable theme={null}
  import asyncio
  from salamoonder import Salamoonder

  # Configuration
  URL = "https://example.com/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
  PROXY = "http://user:pass@ip:port"
  API_KEY = "sr-YOUR-KEY"

  HEADERS = {
      "User-Agent": USER_AGENT,
      "sec-ch-ua": '"Google Chrome";v="141", "Not-A.Brand";v="8", "Chromium";v="141"',
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": '"Windows"',
      "accept-language": "en-US,en;q=0.9",
  }

  async with Salamoonder(API_KEY) as client:
      akamai_data = await client.akamai.fetch_and_extract(website_url=URL, user_agent=USER_AGENT, proxy=PROXY)

      if not akamai_data:
          print("Failed to retrieve Akamai data")
          return

      # Solve 3 sensors (requires 3 API calls, you pay per sensor)
      data = ""
      for i in range(3):
          task_id = await client.task.createTask(
              task_type="AkamaiWebSensorSolver",
              url=akamai_data['base_url'],
              abck=akamai_data['abck'],
              bmsz=akamai_data['bm_sz'],
              script=akamai_data['script_data'],
              sensor_url=akamai_data['akamai_url'],
              user_agent=USER_AGENT,
              count=i,
              data=data
          )
          
          result = await client.task.getTaskResult(task_id)
          payload = result['payload']
          data = result['data']

          cookie = await client.akamai.post_sensor(
              akamai_url=akamai_data['akamai_url'],
              sensor_data=payload,
              user_agent=USER_AGENT,
              website_url=URL,
              proxy=PROXY
          )

      print(f"Successfully solved Akamai on {URL}")

      for k, v in cookie.items():
          client.session.cookies.set(k, str(v), domain=".example.com")
  ```

  ```python sbsd.py expandable theme={null}
  import asyncio
  from salamoonder import Salamoonder

  # Configuration
  URL = "https://example.com/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
  PROXY = "http://user:pass@ip:port" 
  API_KEY = "sr-YOUR-KEY"

  HEADERS = {
      "User-Agent": USER_AGENT,
      "sec-ch-ua": '"Google Chrome";v="141", "Not-A.Brand";v="8", "Chromium";v="141"',
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": '"Windows"',
      "accept-language": "en-US,en;q=0.9",
  }

  async with Salamoonder(API_KEY) as client:
      akamai_data = await client.akamai_sbsd.fetch_and_extract(
          website_url=URL,
          user_agent=USER_AGENT,
          proxy=PROXY
      )

      if not akamai_data:
          print("Failed to retrieve Akamai SBSD data")
          return

      task_id = await client.task.createTask(
          task_type="AkamaiSBSDSolver",
          url=akamai_data['base_url'],
          cookie=akamai_data['cookie_value'],
          sbsd_url=akamai_data['sbsd_url'],
          script=akamai_data['script_data']
      )

      result = await client.task.getTaskResult(task_id)

      cookie = await client.akamai_sbsd.post_sbsd(
          sbsd_payload=result['payload'],
          post_url=akamai_data['sbsd_url'],
          user_agent=result['user-agent'],
          website_url=URL,
          proxy=PROXY
      )

      if cookie:
          print(f"Successfully solved Akamai SBSD on {URL}")
          print(f"Cookie Dict: {cookie}")

          # Set the cookie in your jar 
          # And then do your action.
      else:
          print("Failed to solve Akamai SBSD")

  ```
</CodeGroup>

### DataDome Examples

<CodeGroup>
  ```python slider.py expandable theme={null}
  import asyncio
  from salamoonder import Salamoonder

  # Configuration
  URL = "https://example.com/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
  PROXY = "http://user:pass@ip:port"
  API_KEY = "sr-YOUR-KEY"

  async with Salamoonder(API_KEY) as client:
      response = await client.get(URL, headers={"User-Agent": USER_AGENT}, proxy=PROXY, impersonate="chrome133a")
      cookies = response.cookies.get('datadome')

      if not cookies:
          print("No DataDome cookie found")
          return

      constructed_url = client.datadome.parse_slider_url(response.text, cookies, URL)

      task_id = await client.task.createTask(
          task_type="DataDomeSliderSolver",
          captcha_url=constructed_url,
          user_agent=USER_AGENT,
          country_code="us"
      )

      result = await client.task.getTaskResult(task_id)

      if 'cookie' in result:
          solved_cookie = result['cookie'].split("datadome=")[1].split(";")[0]
      else:
          print(f"Failed to solve {result}")
          return

      client.session.cookies.set(
          name="datadome",
          value=solved_cookie,
          domain=".example.com",
          path="/",
          secure=True
      )

      response = await client.get(URL, headers={"User-Agent": USER_AGENT})

      if response.status_code == 200:
          print("[+] Successfully bypassed Slider.")
          print(f"[+] Status Code: {response.status_code}")
      else:
          print("Bypass failed")
  ```

  ```python interstitial.py expandable theme={null}
  import asyncio
  from salamoonder import Salamoonder

  # Configuration
  URL = "https://example.com/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
  PROXY = "http://user:pass@ip:port"
  API_KEY = "sr-YOUR-KEY"

  HEADERS = {
      "User-Agent": USER_AGENT,
      "sec-ch-ua": '"Google Chrome";v="139", "Not-A.Brand";v="8", "Chromium";v="139"',
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": '"Windows"',
      "accept-language": "en-US,en;q=0.9",
  }

  async with Salamoonder(API_KEY) as client:
      response = await client.get(URL, headers=HEADERS, proxy=PROXY, impersonate="chrome133a")
      cookies = response.cookies.get('datadome')

      if not cookies:
          print("No DataDome cookie found")
          return

      constructed_url = client.datadome.parse_interstitial_url(response.text, cookies, URL)

      task_id = await client.task.createTask(
          task_type="DataDomeInterstitialSolver",
          captcha_url=constructed_url,
          user_agent=USER_AGENT,
          country_code="us"
      )

      result = await client.task.getTaskResult(task_id)

      if "cookie" not in result:
          print(f"Failed to solve challenge: {result}")
          return

      cookie_str = result["cookie"]
      solved_cookie = cookie_str.split("datadome=", 1)[1].split(";", 1)[0] if "datadome=" in cookie_str else cookie_str.split(";", 1)[0]

      client.session.cookies.set(
          name="datadome",
          value=solved_cookie,
          domain=".example.com",
          path="/",
          secure=True
      )

      response = await client.get(URL, headers=HEADERS, proxy=PROXY, impersonate="chrome133a")

      if response.status_code == 200:
          print(response.text)
          print("Successfully bypassed Interstitial!")
      else:
          print(f"Bypass failed (response: {response.text})")
  ```
</CodeGroup>

### Incapsula Examples

<CodeGroup>
  ```python reese84.py expandable theme={null}
  import asyncio
  from salamoonder import Salamoonder
  from loguru import logger

  # Configuration
  URL = "https://example.com/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"
  PROXY = "http://user:pass@ip:port"
  API_KEY = "sr-YOUR-KEY"

  HEADERS = {
      "User-Agent": USER_AGENT,
      "sec-ch-ua": '"Google Chrome";v="142", "Not-A.Brand";v="8", "Chromium";v="142"',
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": '"Windows"',
      "accept-language": "en-US,en;q=0.9",
  }

  async with Salamoonder(API_KEY) as client:
      response = await client.get(URL, headers=HEADERS)

      if "Pardon Our Interruption" not in response.text and "Incapsula incident ID" not in response.text:
          print("No challenge detected")
          return

      print("Incapsula challenge detected")

      # Solve the challenge
      task_id = await client.task.createTask(
          task_type="IncapsulaReese84Solver",
          website=URL,
          submit_payload=True,
          # Optional parameters
          # reese_url="...",
          # user_agent=USER_AGENT
      )

      result = await client.task.getTaskResult(task_id)

      if "token" not in result:
          print(f"Failed to solve challenge: {result}")
          return

      token = result["token"]

      client.session.cookies.set(
          name="reese84",
          value=token,
          domain=".example.com",
          path="/",
          secure=True
      )

      response = await client.get(URL, headers=HEADERS)

      if "Pardon Our Interruption" not in response.text and "Incapsula incident ID" not in response.text:
          print("Successfully bypassed Incapsula!")
      else:
          print("Bypass failed")
  ```

  ```python UTMVC.py theme={null}
  import asyncio
  from salamoonder import Salamoonder

  # Configuration
  URL = "https://example.com/"
  USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
  API_KEY = "sr-YOUR-KEY"

  HEADERS = {
      "User-Agent": USER_AGENT,
      "sec-ch-ua": '"Google Chrome";v="139", "Not-A.Brand";v="8", "Chromium";v="139"',
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": '"Windows"',
      "accept-language": "en-US,en;q=0.9",
  }

  async with Salamoonder(API_KEY) as client:
      task_id = await client.task.createTask(
          task_type="IncapsulaUTMVCSolver",
          website=URL,
          user_agent=USER_AGENT
      )

      result = await client.task.getTaskResult(task_id)

      if "utmvc" not in result:
          print(f"Failed to solve challenge: {result}")
          return

      utmvc = result["utmvc"]

      client.session.cookies.set(
          name="___utmvc",
          value=utmvc,
          domain=".example.com",
          path="/",
          secure=True
      )

      print(f"Successfully solved UTMVC challenge: {utmvc[:150]}")
      print(f"User-Agent: {result['user-agent']}")
  ```
</CodeGroup>

## Real world Examples

This repository includes practical examples for using the Salamoonder SDK, covering various bot detection and security challenges such as Akamai, Datadome, Incapsula, and Kasada. Each example comes with clear instructions and working code that you can adapt directly to your workflow. It's a great resource whether you're just getting started or looking for ways to handle specific cases more efficiently.

<Card title="Github Examples" icon="signal-bars-good" href="https://github.com/Salamoonder-LLC/salamoonder-examples">
  These examples have more real world examples which you can adopt in your workflow.
</Card>
