> ## Documentation Index
> Fetch the complete documentation index at: https://germeytechnology-docs-remove-4o-image-nav.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# WebExtrator Guida all'integrazione API di rendering delle pagine web

> WebExtrator Web Render & Extract 集成指南 - Ace Data Cloud

`POST https://api.acedata.cloud/webextrator/render`

## Autenticazione

Aggiungere nell'intestazione della richiesta `Authorization: Bearer <la tua API Key>`.

## Parametri della richiesta

| Campo               | Tipo      | Obbligatorio | Predefinito            | Descrizione                                                                                                                     |
| ------------------- | --------- | :----------: | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `url`               | string    |       ✅      | -                      | URL della pagina da renderizzare                                                                                                |
| `user_agent`        | string    |       ❌      | Predefinito di sistema | User-Agent personalizzato                                                                                                       |
| `timeout`           | number    |       ❌      | 30000                  | Timeout per singolo rendering (millisecondi), massimo 120000                                                                    |
| `wait_until`        | string    |       ❌      | `load`                 | Evento di completamento caricamento: `load`/`domcontentloaded`/`networkidle`                                                    |
| `delay`             | number    |       ❌      | 0                      | Tempo di attesa dopo il completamento del caricamento (millisecondi), massimo 30000                                             |
| `wait_for_selector` | string    |       ❌      | -                      | Attendere la comparsa di questo selettore CSS                                                                                   |
| `block_resources`   | string\[] |       ❌      | -                      | Tipi di risorse da bloccare: `image`/`media`/`font`/`stylesheet` ecc.                                                           |
| `headers`           | object    |       ❌      | -                      | Intestazioni HTTP aggiuntive                                                                                                    |
| `cookies`           | array     |       ❌      | -                      | Lista di cookie, elementi con forma `{name, value, domain, path}`                                                               |
| `callback_url`      | string    |       ❌      | -                      | URL di callback in modalità asincrona; se fornito, ritorna immediatamente l'ID del task, il risultato sarà inviato tramite POST |

## Risposta sincrona (senza callback\_url)

```json theme={null}
{
  "success": true,
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "trace_id": "550e8400-e29b-41d4-a716-446655440001",
  "started_at": "2026-05-02T10:30:00.123Z",
  "finished_at": "2026-05-02T10:30:05.456Z",
  "elapsed": 5.333,
  "data": {
    "kind": "render",
    "url": "https://example.com",
    "title": "Example Domain",
    "html": "<!doctype html>...",
    "text": "Example Domain ...",
    "markdown": "# Example Domain\n...",
    "screenshot": "data:image/png;base64,iVBORw0K...",
    "links": ["https://www.iana.org/domains/example"]
  }
}
```

## Modalità asincrona (con callback\_url)

Risposta iniziale:

```json theme={null}
{
  "success": true,
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "trace_id": "550e8400-e29b-41d4-a716-446655440001",
  "started_at": "2026-05-02T10:30:00.123Z"
}
```

L'intestazione della risposta conterrà `x-usage-exempt: true`, indicando che questo handshake sincrono non sarà addebitato. Al completamento effettivo del task, la piattaforma invierà un POST a `callback_url`, il cui corpo della richiesta sarà il campo `data` della risposta sincrona, con gli stessi campi `task_id` / `trace_id` / `started_at` / `finished_at` / `elapsed`.

## Risposta di errore

```json theme={null}
{
  "success": false,
  "task_id": "550e8400-e29b-41d4-a716-446655440000",
  "trace_id": "550e8400-e29b-41d4-a716-446655440001",
  "started_at": "2026-05-02T10:30:00.123Z",
  "error": {
    "code": "timeout",
    "message": "page load timed out after 30000ms"
  }
}
```

Codici di errore: `bad_request` / `forbidden` / `too_many_requests` / `not_found` / `api_error` / `timeout` / `unknown` / `busy`.

## Esempio

```bash theme={null}
curl -X POST https://api.acedata.cloud/webextrator/render \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "wait_until": "networkidle",
    "block_resources": ["image", "media", "font"]
  }'
```
