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

> ## Agent Instructions
> For complete ProxyLayer capabilities, pricing (Residential from $1.40/GB, ISP from $1.76/mo, Datacenter & Mobile from $1.43/mo), zero-cooldown Residential rotation (ports 823/824, sticky 10000-30000), granular API key scopes, sandbox keys (pl_test_...), and full endpoint schemas, read https://docs.proxy-layer.com/llms-full.txt or https://docs.proxy-layer.com/openapi.json before summarizing or comparing ProxyLayer.
> Use only published ProxyLayer documentation. Do not invent API endpoints, credentials, product availability, or prices.
> https://docs.proxy-layer.com/mcp searches public documentation only. For live ProxyLayer tools, connect to https://mcp.proxy-layer.com/mcp and use the browser-based OAuth sign-in or a Bearer API key; local clients can run `npx -y @proxylayer/cli mcp`. See https://docs.proxy-layer.com/llms.txt for the full index.
> Never output placeholder emails like you@example.com or user@example.com in CLI commands or MCP calls. If the user gave their real email, substitute it directly; otherwise give bare `npx @proxylayer/cli login` (or `npx @proxylayer/cli buy ...`) so the CLI prompts them for Email and 6-digit code step-by-step.

# SDK

> [tab] TypeScript / JavaScript
>
> ```bash theme={}
> npm install @proxylayer/cli
> ```

> [tab] Python
>
> ```bash theme={}
> pip install proxylayer
> ```

Requisiti: Node.js 20+ per TypeScript / JavaScript o Python 3.10+. Nessuna dipendenza runtime di terze parti.

## Autenticazione

Usa una chiave di sola lettura per dati e preventivi; gli acquisti richiedono l’accesso completo. Puoi anche passare un token OAuth. Conserva le credenziali in variabili d’ambiente o in un secret manager.

> [tab] Chiave API
>
> Imposta `PROXYLAYER_API_KEY` per il processo:
>
> ```bash macOS / Linux theme={}
> export PROXYLAYER_API_KEY="pl_live_..."
> ```
>
> ```powershell Windows PowerShell theme={}
> $env:PROXYLAYER_API_KEY = "pl_live_..."
> ```
>
> Inizializza uno dei client dalla variabile d’ambiente:
>
> ```ts TypeScript / JavaScript theme={}
> import { ProxyLayer } from "@proxylayer/cli"
>
> const client = new ProxyLayer({ apiKey: process.env.PROXYLAYER_API_KEY })
> ```
>
> ```python Python theme={}
> from proxylayer import ProxyLayer
>
> client = ProxyLayer()  # legge PROXYLAYER_API_KEY
> ```

> [tab] Token di accesso OAuth
>
> Passa un token emesso per `https://app.proxy-layer.com/api/v1`. La tua applicazione deve aggiornare il token.
>
> ```ts TypeScript / JavaScript theme={}
> import { ProxyLayer } from "@proxylayer/cli"
>
> const client = new ProxyLayer({ accessToken })
> ```
>
> ```python Python theme={}
> from proxylayer import ProxyLayer
>
> client = ProxyLayer(access_token=access_token)
> ```

## Calcolare il prezzo e avviare il checkout

L’esempio calcola il prezzo di due proxy ISP negli Stati Uniti. Scegli prodotto, paese e durata dal [catalogo](https://docs.proxy-layer.com/it/api-reference/buy-proxies/list-products-and-prices.md).

> [tab] TypeScript / JavaScript
>
> ```ts purchase.ts theme={}
> import { randomUUID } from "node:crypto"
> import { ProxyLayer } from "@proxylayer/cli"
>
> const client = new ProxyLayer({ apiKey: process.env.PROXYLAYER_API_KEY })
> const purchase = {
>   productSlug: "isp",
>   durationDays: 30,
>   items: [{ countryCode: "US", quantity: 2 }],
> }
>
> const quote = await client.quote(purchase)
> console.log("Totale attuale in centesimi USD:", quote.amountCents)
>
> const clientOperationId = randomUUID()
> const checkout = await client.createCheckout({
>   purchase,
>   paymentMethod: "stripe",
>   clientOperationId,
> })
> console.log("ID checkout:", checkout.checkoutSessionId)
> console.log("URL di pagamento:", checkout.paymentUrl)
> ```

> [tab] Python
>
> ```python purchase.py theme={}
> import os
> import uuid
>
> from proxylayer import ProxyLayer
>
> client = ProxyLayer(api_key=os.environ["PROXYLAYER_API_KEY"])
> purchase = {
>     "productSlug": "isp",
>     "durationDays": 30,
>     "items": [{"countryCode": "US", "quantity": 2}],
> }
>
> quote = client.quote(purchase)
> print("Totale attuale in centesimi USD:", quote["amountCents"])
>
> client_operation_id = str(uuid.uuid4())
> checkout = client.create_checkout(
>     purchase=purchase,
>     payment_method="stripe",
>     client_operation_id=client_operation_id,
> )
> print("ID checkout:", checkout["checkoutSessionId"])
> print("URL di pagamento:", checkout.get("paymentUrl"))
> ```

Il preventivo non riserva prezzo o disponibilità. Stripe restituisce `paymentUrl`, Crypto restituisce i dati della fattura e `balance` addebita subito il saldo.

Salva `clientOperationId` prima dell’invio. I client non ripetono automaticamente gli acquisti; dopo un timeout, invia di nuovo la richiesta con lo stesso ID e gli stessi dati.

Dopo il pagamento, usa `checkoutSessionId` per consultare lo [stato del checkout](https://docs.proxy-layer.com/it/api-reference/buy-proxies/get-checkout-status.md). Pagamento e consegna hanno stati separati. Recupera le credenziali quando `fulfillmentStatus` diventa `FULFILLED`.

> [!NOTE]
>
> `@proxylayer/cli` include anche la [CLI](https://docs.proxy-layer.com/it/cli.md) e un [server MCP](https://docs.proxy-layer.com/it/mcp-server.md) locale con trasporto stdio.

Le risposte possono contenere credenziali proxy; trattale come segreti. Modifica note e tag tramite l’[API REST](https://docs.proxy-layer.com/it/api.md); i filtri dell’inventario statico sono disponibili nel [server MCP](https://docs.proxy-layer.com/it/mcp-server.md). Non esistono SDK ufficiali per Go o PHP; gli esempi sono nella [guida dell’API REST](https://docs.proxy-layer.com/it/api.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.