---
title: "API Documentation"
description: "Complete API reference for WebScraping.AI. Learn how to scrape websites, extract data with AI, and integrate with your applications."
url: https://webscraping.ai/docs#html
markdown_index: https://webscraping.ai/llms.txt
---
## Get Page HTML

Fetch the full HTML content of any webpage. Includes JavaScript rendering via headless Chrome and automatic proxy rotation.

`GET /html`

##### Parameters [→ All parameters reference](https://webscraping.ai/docs/parameters.md)

| Parameter | Type | Description |
| --- | --- | --- |
| url required | string | URL of the webpage to fetch |
| api\_key required | string | Your API key |
| js optional | boolean | Enable JavaScript rendering (default: true) |
| proxy optional | string | Proxy type: "datacenter" (default), "residential", "stealth" or "auto" |

##### Example

**cURL**

```bash
curl -G "https://api.webscraping.ai/html" \
  --data-urlencode "api_key=YOUR_API_KEY" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "js=true"
```

**Python**

```python
# pip install webscraping_ai
# https://pypi.org/project/webscraping-ai/
from webscraping_ai import Client

client = Client(api_key="YOUR_API_KEY")
html = client.html("https://example.com", js=True)
print(html)
```

**JavaScript**

```javascript
// npm install webscraping-ai
// https://www.npmjs.com/package/webscraping-ai
import { WebScrapingAI } from 'webscraping-ai';

const client = new WebScrapingAI({ apiKey: 'YOUR_API_KEY' });
const html = await client.html({ url: 'https://example.com', js: true });
console.log(html);
```

**PHP**

```php
<?php
// composer require webscraping-ai/webscraping-ai-php
// https://packagist.org/packages/webscraping-ai/webscraping-ai-php
require 'vendor/autoload.php';

use WebScrapingAI\Client;

$client = new Client('YOUR_API_KEY');
$html = $client->html('https://example.com', js: true);
echo $html;
```

**Ruby**

```ruby
# gem install webscraping_ai
# https://rubygems.org/gems/webscraping_ai
require 'webscraping_ai'

client = WebScrapingAI::Client.new(api_key: 'YOUR_API_KEY')
html = client.html('https://example.com', js: true)
puts html
```

**Go**

```go
// go get github.com/webscraping-ai/webscraping-ai-go/v4
// https://pkg.go.dev/github.com/webscraping-ai/webscraping-ai-go/v4
package main

import (
    "context"
    "fmt"

    webscrapingai "github.com/webscraping-ai/webscraping-ai-go/v4"
)

func main() {
    client, _ := webscrapingai.NewClient(&webscrapingai.Config{APIKey: "YOUR_API_KEY"})
    js := true
    html, _ := client.HTML(context.Background(), &webscrapingai.HTMLOptions{
        URL: "https://example.com",
        CommonOptions: webscrapingai.CommonOptions{JS: &js},
    })
    fmt.Println(html)
}
```

**Java**

```java
// Maven: ai.webscraping:webscraping-ai:4.3.1
// https://central.sonatype.com/artifact/ai.webscraping/webscraping-ai
import ai.webscraping.Client;
import ai.webscraping.Config;
import ai.webscraping.option.HtmlOptions;

Client client = new Client(Config.builder().apiKey("YOUR_API_KEY").build());
String html = client.html(HtmlOptions.builder()
    .url("https://example.com")
    .js(true)
    .build());
System.out.println(html);
```

**C#**

```csharp
// dotnet add package WebScrapingAI
// https://www.nuget.org/packages/WebScrapingAI
using WebScrapingAI;

var client = new WebScrapingAIClient(new WebScrapingAIClientOptions { ApiKey = "YOUR_API_KEY" });
var html = await client.HtmlAsync(new HtmlRequest {
    Url = "https://example.com",
    Js = true,
});
Console.WriteLine(html);
```

`POST /html`

Use POST requests to send data to the target page (e.g., form submissions, API calls). The `/text`, `/selected` and `/selected-multiple` endpoints accept POST the same way.

##### How POST works

| query string | params | `api_key`, `url` and all other parameters go in the query string, as with GET |
| --- | --- | --- |
| request body | raw | The body of your POST request is sent to the target URL, with your request's `Content-Type`. JSON and `text/plain` bodies pass through as-is; to send a form-encoded body, post it as `text/plain` and set `headers[Content-Type]=application/x-www-form-urlencoded` |

##### POST Example

**cURL**

```bash
# Send a JSON body to a target page
curl -X POST "https://api.webscraping.ai/html?api_key=YOUR_API_KEY&url=https%3A%2F%2Fhttpbin.org%2Fpost" \
  -H "Content-Type: application/json" \
  -d '{"username": "test", "password": "demo"}'
```

**Python**

```python
import requests

# Send a JSON body to a target page
response = requests.post(
    "https://api.webscraping.ai/html",
    params={"api_key": "YOUR_API_KEY", "url": "https://httpbin.org/post"},
    json={"username": "test", "password": "demo"},
)
print(response.text)
```

**JavaScript**

```javascript
// Send a JSON body to a target page
const query = new URLSearchParams({
  api_key: 'YOUR_API_KEY',
  url: 'https://httpbin.org/post',
});
const response = await fetch(`https://api.webscraping.ai/html?${query}`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ username: 'test', password: 'demo' }),
});
console.log(await response.text());
```

**Use cases:** Login to websites, submit search forms, interact with APIs that require POST requests, or scrape pages that need form submissions.
