> ## 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
> ```

Prérequis : Node.js 20+ pour TypeScript / JavaScript ou Python 3.10+. Aucune dépendance d’exécution tierce.

## Authentification

Utilisez une clé en lecture seule pour consulter les données et les prix ; les achats nécessitent un accès complet. Vous pouvez aussi fournir un jeton OAuth. Conservez les identifiants dans des variables d’environnement ou un gestionnaire de secrets.

> [tab] Clé API
>
> Définissez `PROXYLAYER_API_KEY` pour le processus :
>
> ```bash macOS / Linux theme={}
> export PROXYLAYER_API_KEY="pl_live_..."
> ```
>
> ```powershell Windows PowerShell theme={}
> $env:PROXYLAYER_API_KEY = "pl_live_..."
> ```
>
> Initialisez l’un ou l’autre client depuis la variable d’environnement :
>
> ```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()  # lit PROXYLAYER_API_KEY
> ```

> [tab] Jeton d’accès OAuth
>
> Fournissez un jeton émis pour `https://app.proxy-layer.com/api/v1`. Votre application doit renouveler le jeton.
>
> ```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)
> ```

## Calculer le prix et démarrer un checkout

L’exemple calcule le prix de deux proxys ISP aux États-Unis. Choisissez le produit, le pays et la durée dans le [catalogue](https://docs.proxy-layer.com/fr/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("Total actuel en cents USD :", quote.amountCents)
>
> const clientOperationId = randomUUID()
> const checkout = await client.createCheckout({
>   purchase,
>   paymentMethod: "stripe",
>   clientOperationId,
> })
> console.log("ID du checkout :", checkout.checkoutSessionId)
> console.log("URL de paiement :", 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("Total actuel en cents 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 du checkout :", checkout["checkoutSessionId"])
> print("URL de paiement :", checkout.get("paymentUrl"))
> ```

Un devis ne réserve ni le prix ni la disponibilité. Stripe renvoie `paymentUrl`, le paiement crypto renvoie les détails de facture et `balance` débite le portefeuille immédiatement.

Enregistrez `clientOperationId` avant l’envoi. Les clients ne réessaient pas automatiquement les achats ; après un délai dépassé, renvoyez la requête avec le même ID et les mêmes données.

Après le paiement, utilisez `checkoutSessionId` pour consulter le [statut du checkout](https://docs.proxy-layer.com/fr/api-reference/buy-proxies/get-checkout-status.md). Le paiement et la livraison ont des statuts distincts. Récupérez les identifiants après le passage de `fulfillmentStatus` à `FULFILLED`.

> [!NOTE]
>
> `@proxylayer/cli` comprend aussi la [CLI](https://docs.proxy-layer.com/fr/cli.md) et un [serveur MCP](https://docs.proxy-layer.com/fr/mcp-server.md) local en transport stdio.

Les réponses peuvent contenir des identifiants de proxy ; traitez-les comme des secrets. Modifiez notes et tags avec l’[API REST](https://docs.proxy-layer.com/fr/api.md) ; les filtres d’inventaire statique sont disponibles dans le [serveur MCP](https://docs.proxy-layer.com/fr/mcp-server.md). Aucun SDK officiel pour Go ni PHP ; consultez leurs exemples dans le [guide de l’API REST](https://docs.proxy-layer.com/fr/api.md).


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