# FineProxy developer documentation (full text) > Complete FineProxy REST API and MCP documentation in one file. REST base URL: https://fineproxy.org/account_new. MCP server: https://fineproxy.org/account_new/api/v1/mcp. OpenAPI 3.1 specification: https://fineproxy.org/developers/openapi.json. Per-page Markdown: append .md to any page path under https://fineproxy.org/developers/docs/. # FineProxy developer documentation Source: https://fineproxy.org/developers/docs/ FineProxy gives you two programmatic interfaces to the same account: - **REST API** — a JSON-over-HTTPS API described by an [OpenAPI 3.1 specification](/developers/openapi.json). Use it from your backend, scripts and CI. - **MCP server** — a remote [Model Context Protocol](https://modelcontextprotocol.io) server with 57 tools. Use it to let AI agents such as Cursor, Claude, VS Code Copilot, Cline or n8n buy, configure and troubleshoot proxies on your behalf. Both interfaces use the same API keys, the same [permission scopes](/developers/docs/authentication/#scopes) and the same safety rules for anything that spends money. ## What you can automate | Area | REST API | MCP | | --- | --- | --- | | Browse products, countries and live IP stock | ✓ | ✓ | | Quote and buy datacenter, ISP and rotating proxies | ✓ | ✓ | | Renew, cancel and toggle auto-renewal | Renew, cancel | ✓ | | Read IPs, credentials and connection endpoints | ✓ | ✓ | | Manage the IP allowlist | ✓ | ✓ | | Refresh (replace) IPs and add more IPs | ✓ | ✓ | | Sticky sessions for rotating proxies | ✓ | — | | Usage analytics, diagnostics and recommendations | Usage per service | ✓ | | Wallet balance, ledger, deposits and invoices | ✓ | ✓ | | Support tickets | ✓ | ✓ | | Webhooks | ✓ | — | ## Endpoints | Interface | Address | | --- | --- | | REST API base URL | `https://fineproxy.org/account_new` (all paths start with `/api/v1/`) | | MCP server | `https://fineproxy.org/account_new/api/v1/mcp` (Streamable HTTP) | | OpenAPI specification | [`https://fineproxy.org/developers/openapi.json`](/developers/openapi.json) | | Dashboard: API keys | [`https://fineproxy.org/account_new/settings#api-keys`](https://fineproxy.org/account_new/settings#api-keys) | > **For AI agents:** every page of this documentation is also available as Markdown — append `.md` to the page path (for example [`/developers/docs/quickstart.md`](/developers/docs/quickstart.md)). --- # Quickstart Source: https://fineproxy.org/developers/docs/quickstart/ This guide takes you from zero to a working API call. You need a FineProxy account; no SDK is required — any HTTP client works. ## 1. Create an API key 1. Sign in to the dashboard and open [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). 2. Create a key and select the [scopes](/developers/docs/authentication/#scopes) it needs. For this guide, read-only scopes are enough: `customer:read`, `wallet:read`, `services:read`, `catalog:read`. 3. Copy the key. It starts with `fb_` and is shown **only once**. > Treat the key like a password. Anyone who has it can act on your account within the key's scopes. Never commit it to Git or paste it into client-side code. ## 2. Store the key in an environment variable ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` All examples in this documentation read the key from `FINEPROXY_API_KEY`. ## 3. Make your first request Read your wallet balance. Every request carries the key in the `Authorization` header as a bearer token. ```bash curl https://fineproxy.org/account_new/api/v1/customer/wallet/balance \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/wallet/balance', { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }, }); if (!response.ok) throw new Error(`FineProxy API error ${response.status}: ${await response.text()}`); console.log(await response.json()); ``` ```python import os import requests response = requests.get( "https://fineproxy.org/account_new/api/v1/customer/wallet/balance", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) response.raise_for_status() print(response.json()) ``` A successful call returns `200 OK`: ```json { "wallet_id": "9bc0fbe5-1a60-42f8-ac04-254e44b13e93", "owner_type": "customer", "balance_cents": 2800, "currency": "USD", "has_wallet": true } ``` All money values are **integer cents**: `2800` means $28.00. See [Conventions](/developers/docs/conventions/). If the key is missing or wrong you get `401` with a JSON `detail` message — see [Errors](/developers/docs/errors/). ## 4. List your proxy services ```bash curl https://fineproxy.org/account_new/api/v1/customer/services \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` The response contains a `services` array. Each service has an `id` (UUID) that you pass to every service-level endpoint, plus `status`, `product_kind` (for example `proxy_datacenter` or `proxy_rotating`), `display_name` and `expires_at`. To get the proxies of a service — IP addresses, ports and credentials — continue with [Connect to datacenter proxies](/developers/docs/proxies/datacenter/). ## Next steps - [Buy proxies with the API](/developers/docs/guides/buy-proxies/) — quote and order a package safely. - [Authentication](/developers/docs/authentication/) — scopes and key management. - [Rate limits](/developers/docs/rate-limits/) — how fast you can call the API. - [MCP quickstart](/developers/docs/mcp/quickstart/) — let an AI agent do the same through natural language. --- # MCP quickstart Source: https://fineproxy.org/developers/docs/mcp/quickstart/ This guide connects Cursor to your FineProxy account in about two minutes. You start with a read-only key, check that the agent sees your wallet, and then, if you want the agent to buy proxies, add purchase rights. Other clients work the same way; see [Supported clients](/developers/docs/mcp/#supported-clients). ## 1. Create a read-only API key 1. Sign in to the dashboard and open [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). 2. Create a key with read-only [scopes](/developers/docs/authentication/#scopes): `customer:read`, `wallet:read`, `services:read`, `catalog:read`, `usage:read`, `tickets:read`. 3. Copy the key. It starts with `fb_` and is shown **only once**. A read-only key lets the agent look at everything and change nothing. That's the right way to see how your agent behaves before you trust it with money. > **Important:** Treat the key like a password. Don't paste it into chat messages and don't commit config files that contain it. ## 2. Add the server to Cursor ### Option A: one-click install [Add FineProxy to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=fineproxy&config=eyJ1cmwiOiJodHRwczovL2ZpbmVwcm94eS5vcmcvYWNjb3VudF9uZXcvYXBpL3YxL21jcCIsImhlYWRlcnMiOnsiQXV0aG9yaXphdGlvbiI6IkJlYXJlciAke2VudjpGSU5FUFJPWFlfQVBJX0tFWX0ifX0=) The link installs a server named `fineproxy` that reads the key from the `FINEPROXY_API_KEY` environment variable, exactly as in option B. Set the variable and restart Cursor as described below. ### Option B: edit `mcp.json` Create or edit `~/.cursor/mcp.json` (all projects; `%USERPROFILE%\.cursor\mcp.json` on Windows) or `.cursor/mcp.json` in a project: ```json { "mcpServers": { "fineproxy": { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" } } } } ``` Then make the key visible to Cursor and restart it: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` > **Note:** Cursor must see the variable. Apps started from the Dock or Start menu may not read your shell profile; if the server returns `401`, start Cursor from a terminal where the variable is set. Cursor cloud agents don't read `~/.cursor/mcp.json`; configure them separately in Cursor. Open **Settings → MCP**: `fineproxy` should be enabled and list its tools. Connection errors appear in the **Output** panel under **MCP Logs**. ## 3. Run your first prompt In the Cursor agent chat, ask: ```text What is my FineProxy balance? ``` The agent calls one tool, [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance), with no arguments. Cursor asks you to approve the call (unless you have allowed it). The tool returns: ```json { "balance_cents": 2800, "currency": "USD", "wallet_id": "00000000-0000-0000-0000-000000000000", "has_wallet": true } ``` and the agent answers something like "Your FineProxy wallet has $28.00." Amounts are integer cents: `2800` is $28.00. Try a few more read-only prompts: "List my FineProxy services and when they expire", "Which countries can I buy datacenter proxies in?". More in [Example prompts](/developers/docs/mcp/prompts/). ## 4. Enable purchases To let the agent buy, renew and change services, create a **second** key with the read scopes above plus: | Scope | Allows | | --- | --- | | `services:write` | Change services: allowlist, credentials, auto-renewal, cancellation | | `wallet:spend` | Pay from the wallet balance: orders, renewals, add-ons, extra IPs, paid IP refreshes | Put the new key into `FINEPROXY_API_KEY` and restart Cursor. Keep only as much money in the wallet as you're willing to let the agent spend; see [Safety for AI agents](/developers/docs/mcp/safety/#budget-control). ## 5. Your first purchase Ask in plain language. Include the IP address that will use the proxies: new orders require at least one allowlisted IP. ```text Buy 100 German datacenter proxies for one month. Allow access from 203.0.113.10. Don't enable auto-renew. ``` The server tells agents to follow a fixed buying flow, so a typical session looks like this: | Step | Tool call | What happens | | --- | --- | --- | | 1 | `list_countries` | Checks that `DE` has enough IPs in stock (can take about 10 seconds) | | 2 | `quote_composite` with `segments: [{"country": "DE", "count": 100}]`, `period_months: 1` | Free, non-binding quote: `total_price_cents: 1200` | | 3 | `wallet_balance` | Confirms the wallet covers $12.00 | | 4 | — | The agent summarizes and asks you to confirm | | 5 | `order_composite` | Places the order with the quoted price as a guard | | 6 | `list_proxy_ips`, `get_proxy_credentials` | Shows your IPs, ports and login | Before step 5 a well-behaved agent stops and asks, for example: ```text Quote: 100 datacenter IPs in Germany, 1 month — $12.00 (1200 cents). Your balance is $28.00. Allowlisted IP: 203.0.113.10. Auto-renew: off. Shall I place the order? ``` After you confirm, Cursor shows the `order_composite` call for approval. Check the arguments before you approve: ```json { "segments": [{ "country": "DE", "count": 100 }], "period_months": 1, "whitelist_ips": ["203.0.113.10"], "auto_renew": false, "idempotency_key": "order-de-100-2026-11-27", "expected_total_cents": 1200 } ``` What to watch: - `expected_total_cents` must equal the quote. If the price changed, the server rejects the order and charges nothing. - `idempotency_key` makes retries safe: the same key never charges twice. - `auto_renew` defaults to `true` if the agent leaves it out. A service with auto-renew on is paid from the wallet automatically every period. - Orders need at least 100 IPs in total. If you ask for fewer, the agent gets an error and should suggest 100. The order result contains the new service: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "status": "active", "total_ip": 100, "total_price_cents": 1200, "period_months": 1, "balance_applied_cents": 1200, "amount_due_cents": 0, "payment_required": false } ``` In testing, the IPs were active about two seconds later. To connect, see [Connect to datacenter proxies](/developers/docs/proxies/datacenter/). ## Test without a client You can check your key and the server from a terminal, without any AI client. ### MCP Inspector CLI The official [MCP Inspector](https://github.com/modelcontextprotocol/inspector) needs Node.js. List the tools: ```bash npx -y @modelcontextprotocol/inspector --cli \ https://fineproxy.org/account_new/api/v1/mcp \ --transport http \ --header "Authorization: Bearer $FINEPROXY_API_KEY" \ --method tools/list ``` Call a read-only tool: ```bash npx -y @modelcontextprotocol/inspector --cli \ https://fineproxy.org/account_new/api/v1/mcp \ --transport http \ --header "Authorization: Bearer $FINEPROXY_API_KEY" \ --method tools/call \ --tool-name wallet_balance ``` ### Raw JSON-RPC with curl The server is stateless, so each call is one independent `POST`. Initialize: ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}' ``` List the tools: ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/list","id":2}' ``` Call `wallet_balance`: ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"wallet_balance","arguments":{}}}' ``` The reply carries the data twice, as `structuredContent` and as JSON text in `content[0].text`: ```json { "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "{\n \"balance_cents\": 2800,\n \"currency\": \"USD\",\n \"wallet_id\": \"00000000-0000-0000-0000-000000000000\",\n \"has_wallet\": true\n}" } ], "structuredContent": { "balance_cents": 2800, "currency": "USD", "wallet_id": "00000000-0000-0000-0000-000000000000", "has_wallet": true } } } ``` A `401` means the key is missing or wrong. Running many of these commands back to back can return `429`; wait a few seconds between them. See [Troubleshooting](/developers/docs/mcp/troubleshooting/). ## Next steps - [Example prompts](/developers/docs/mcp/prompts/): buying, monitoring, troubleshooting and billing. - [Safety for AI agents](/developers/docs/mcp/safety/): what to check before giving an agent `wallet:spend`. - [Client guides](/developers/docs/mcp/#supported-clients): Claude Code, VS Code, n8n and more. --- # Setup instructions for AI agents Source: https://fineproxy.org/developers/docs/mcp/agent-setup/ This page is written **for an AI agent**. Give its Markdown version to the agent you work with — Cursor, Claude Code, VS Code Copilot, Cline, Windsurf, Codex, Gemini CLI or another MCP client — and it will walk you through connecting FineProxy: ```text Read https://fineproxy.org/developers/docs/mcp/agent-setup.md and help me connect the FineProxy MCP server to this client. ``` Everything below is addressed to the agent. ## Your task Connect the FineProxy MCP server to the MCP client you are running in, then prove the connection works with one read-only call. Work in small steps, explain each step to the user in plain language and ask before you change any file. Server facts: | Setting | Value | | --- | --- | | Server name | `fineproxy` | | URL | `https://fineproxy.org/account_new/api/v1/mcp` | | Transport | Streamable HTTP (remote server, no local package needed) | | Authentication | Header `Authorization: Bearer `; keys start with `fb_` | | Environment variable for the key | `FINEPROXY_API_KEY` | FineProxy MCP has no OAuth. If the client offers an OAuth sign-in for this server, the `Authorization` header is missing. ## Rules - **Never ask the user to paste the API key into the chat.** The key belongs in an environment variable that the user sets; the config file only references the variable. - **Never write a literal `fb_...` key into a file that may be committed** (project-level configs such as `.cursor/mcp.json`, `.mcp.json`, `.vscode/mcp.json`). - **Ask before you create or edit a config file.** Show the exact content you will write. - **Start read-only.** Recommend a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read`. Mention `wallet:spend` only if the user wants you to buy or renew proxies later. - **Never spend money during setup.** Do not call any tool marked as spending money (`order_composite`, `order_dedicated`, `buy_service`, `renew_service`, `add_ips`, `refresh_ips`, `purchase_addon`). ## Step 1. Identify the client Determine which MCP client you are running in. If you are not sure, ask the user. Then read the matching page — it contains the exact config file location, format and environment-variable syntax for that client: | Client | Instructions | | --- | --- | | Cursor | [/developers/docs/mcp/clients/cursor.md](/developers/docs/mcp/clients/cursor.md) | | Claude Code | [/developers/docs/mcp/clients/claude-code.md](/developers/docs/mcp/clients/claude-code.md) | | Claude Desktop | [/developers/docs/mcp/clients/claude-desktop.md](/developers/docs/mcp/clients/claude-desktop.md) | | VS Code (GitHub Copilot) | [/developers/docs/mcp/clients/vscode.md](/developers/docs/mcp/clients/vscode.md) | | Cline | [/developers/docs/mcp/clients/cline.md](/developers/docs/mcp/clients/cline.md) | | Windsurf | [/developers/docs/mcp/clients/windsurf.md](/developers/docs/mcp/clients/windsurf.md) | | Codex CLI | [/developers/docs/mcp/clients/codex.md](/developers/docs/mcp/clients/codex.md) | | Gemini CLI | [/developers/docs/mcp/clients/gemini-cli.md](/developers/docs/mcp/clients/gemini-cli.md) | | n8n | [/developers/docs/mcp/clients/n8n.md](/developers/docs/mcp/clients/n8n.md) | | Anything else | [/developers/docs/mcp/clients/other.md](/developers/docs/mcp/clients/other.md) | All paths are relative to `https://fineproxy.org`. ## Step 2. Get an API key Ask the user to: 1. Open [https://fineproxy.org/account_new/settings#api-keys](https://fineproxy.org/account_new/settings#api-keys) and sign in. 2. Create a key with read-only scopes: `customer:read`, `wallet:read`, `services:read`, `catalog:read`. 3. Copy the key — it is shown only once. ## Step 3. Put the key in an environment variable Ask the user to set `FINEPROXY_API_KEY` themselves, in the environment the client process will see: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` ```powershell setx FINEPROXY_API_KEY "fb_your_api_key" ``` Explain that GUI apps started from the Dock, Start menu or a launcher may not see variables from `~/.zshrc` or `~/.bashrc`; in that case the client must be started from a terminal where the variable is set, or the variable must be set system-wide. On Windows, `setx` affects only processes started afterwards. ## Step 4. Add the server to the client config Use the config from the client page you read in step 1. For example, Cursor (`~/.cursor/mcp.json`): ```json { "mcpServers": { "fineproxy": { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" } } } } ``` Claude Code (one command, user scope): ```bash claude mcp add --transport http --scope user fineproxy \ https://fineproxy.org/account_new/api/v1/mcp \ --header "Authorization: Bearer $FINEPROXY_API_KEY" ``` If the file already exists, merge the `fineproxy` entry into the existing `mcpServers` object — do not overwrite other servers. The environment-variable syntax differs between clients (`${env:NAME}`, `${NAME}`, `$NAME`); always use the syntax from the client page. ## Step 5. Reload and verify 1. Ask the user to reload the MCP servers or restart the client, as described on the client page. 2. Check that the `fineproxy` server is connected and exposes its tools. 3. Call the read-only tool `wallet_balance` with no arguments. A working connection returns something like: ```json { "balance_cents": 5000, "currency": "USD", "has_wallet": true } ``` 4. Tell the user the result in plain words: amounts are integer cents, so `5000` is $50.00. ## Step 6. Hand over Summarize what you configured (file path, server name, scopes of the key) and suggest a few first requests, for example: - “Show my active proxy services and when they expire.” - “Which countries have datacenter IPs in stock?” - “Quote 100 datacenter IPs in Germany for one month.” — a quote is free and does not buy anything. Point the user to [MCP safety](/developers/docs/mcp/safety/) before they give a key the `wallet:spend` scope. ## If something fails | Symptom | What to do | | --- | --- | | `401 Unauthorized` | The key is missing, wrong or the variable is not visible to the client. Check step 3; do not ask for the key in chat. | | OAuth sign-in prompt | The `Authorization` header is missing from the config. | | Server not listed | Config file in the wrong place or wrong format for this client — re-check the client page. | | `429 Too Many Requests` | Wait a minute and reconnect once. | | Tool returns `isError: true` | Read the message: it explains the problem (for example a missing scope). | More cases: [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # FineProxy MCP server Source: https://fineproxy.org/developers/docs/mcp/ The FineProxy MCP server lets an AI agent work with your FineProxy account. You can ask it to buy proxies, read connection details, change the IP allowlist, check usage or download an invoice, and it does the work through the same API keys and permissions as the [REST API](/developers/docs/). ## What MCP is The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) is an open standard for connecting AI assistants to external systems. An MCP server publishes a list of **tools**: named actions with typed inputs, such as `wallet_balance` or `quote_composite`. An MCP client (Cursor, Claude Code, VS Code Copilot, n8n and others) shows these tools to the language model. When you write "How much money is in my FineProxy wallet?", the model picks the right tool, the client calls it, and the model answers from the result. You don't write code, and in most clients you see and approve each tool call before it runs. ## What an agent can do The server has 57 tools. They fall into eight groups: | Group | What the agent can do | Tools | | --- | --- | --- | | Catalog & buying | List countries with live IP stock, explain pricing, split a total IP count across countries, quote and buy datacenter, ISP and dedicated proxies, buy catalog products | `list_countries`, `get_pricing_info`, `plan_composite`, `quote_composite`, `order_composite`, `quote_dedicated`, `order_dedicated`, `list_catalog`, `buy_service` | | Services | List services and their expiry, renew, turn auto-renewal on or off, cancel | `list_services`, `get_service`, `renew_service`, `set_auto_renew`, `cancel_service` | | Proxy access | Read IPs, credentials and rotating-proxy configuration, rotate the password, manage the IP allowlist and per-IP connection limits, refresh (replace) IPs, add IPs, check and restore IPs missing from an imported contract | `list_proxy_ips`, `get_proxy_credentials`, `rotate_proxy_credentials`, `get_proxy_config`, `get_whitelist`, `add_whitelist_ip`, `remove_whitelist_ip`, `replace_whitelist_ip`, `update_whitelist_limits`, `get_refresh_status`, `quote_refresh`, `refresh_ips`, `add_ips`, `get_import_shortfall_status`, `quote_import_shortfall_restore`, `restore_import_shortfall` | | Add-ons | List available and active add-ons (extra allowlist IPs, extra connections, UDP), buy and disable them | `list_available_addons`, `list_active_addons`, `purchase_addon`, `disable_addon` | | Usage analytics & diagnostics | Traffic totals, success rate, latency percentiles, timeseries, top destinations, failure breakdown by category, rule-based recommendations | `get_usage`, `get_usage_overview`, `get_usage_timeseries`, `get_top_destinations`, `get_diagnostics`, `get_recommendations` | | Wallet & payments | Balance, transaction history, invoices with PDF links, payment gateways, wallet top-up links and their status | `wallet_balance`, `list_ledger`, `list_invoices`, `get_invoice`, `list_payment_gateways`, `init_deposit`, `get_deposit_status`, `list_payments` | | Account | Profile and verification status, login history, the public IP of the machine running the agent | `get_profile`, `get_access_log`, `get_my_ip` | | Support | Read, open, reply to and close support tickets, download attachments | `list_tickets`, `get_ticket`, `get_ticket_attachment`, `create_ticket`, `reply_ticket`, `close_ticket` | Every tool, with its inputs and required scopes, is listed in the [MCP tools reference](/developers/docs/mcp/tools/). ## Server facts | Property | Value | | --- | --- | | URL | `https://fineproxy.org/account_new/api/v1/mcp` | | Transport | Streamable HTTP, stateless: every request is a single `POST` with a JSON-RPC 2.0 message, every reply is `application/json` (no SSE stream, no session ID) | | Authentication | `Authorization: Bearer fb_...` with a FineProxy [API key](/developers/docs/authentication/). OAuth is not supported. | | Tools | 57. No resources and no prompts. | | Permissions | The same [scopes](/developers/docs/authentication/#scopes) as the REST API. Tools that spend money need `wallet:spend`. | | Protocol versions | `2025-06-18`, `2025-03-26`, `2024-11-05` | | Money | Integer cents everywhere: `1200` means $12.00 | Engineers building their own client should read [Protocol details](/developers/docs/mcp/protocol/). ## Supported clients Any MCP client that can send a custom `Authorization` header to a remote Streamable HTTP server works. Clients that only start local (stdio) servers can connect through the `mcp-remote` bridge. | Client | How it connects | Guide | | --- | --- | --- | | Cursor | Native remote server with headers; one-click install link | [Cursor](/developers/docs/mcp/clients/cursor/) | | Claude Code | `claude mcp add --transport http` or `.mcp.json` | [Claude Code](/developers/docs/mcp/clients/claude-code/) | | Claude Desktop | Custom connector with request headers, or `mcp-remote` in `claude_desktop_config.json` | [Claude Desktop](/developers/docs/mcp/clients/claude-desktop/) | | VS Code (GitHub Copilot) | `.vscode/mcp.json` with a password prompt for the key | [VS Code](/developers/docs/mcp/clients/vscode/) | | Cline | `streamableHttp` server entry | [Cline](/developers/docs/mcp/clients/cline/) | | Windsurf | `serverUrl` entry in the Cascade MCP config | [Windsurf](/developers/docs/mcp/clients/windsurf/) | | n8n | MCP Client Tool node with Bearer Auth (n8n 1.104.0 or later) | [n8n](/developers/docs/mcp/clients/n8n/) | | OpenAI Codex CLI | `bearer_token_env_var` in `config.toml` | [Codex CLI](/developers/docs/mcp/clients/codex/) | | Gemini CLI | `httpUrl` entry in `settings.json` | [Gemini CLI](/developers/docs/mcp/clients/gemini-cli/) | | Other clients (Zed, JetBrains and others) | Direct HTTP with headers, or the `mcp-remote` bridge | [Other clients](/developers/docs/mcp/clients/other/) | > **Note:** ChatGPT custom MCP connectors can't use this server today. They authenticate with OAuth and have no field for a static bearer key. See [Troubleshooting](/developers/docs/mcp/troubleshooting/#chatgpt-is-not-supported). ## Generic configuration Most clients use this JSON shape. The server name `fineproxy` is what the agent sees; keep it so the examples in this documentation match. ```json { "mcpServers": { "fineproxy": { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer fb_your_api_key" } } } } ``` Field names differ between clients: Claude Code and VS Code need `"type": "http"`, Cline needs `"type": "streamableHttp"`, Windsurf uses `serverUrl` and Gemini CLI uses `httpUrl`. Most clients can read the key from an environment variable instead of the literal value, for example `${env:FINEPROXY_API_KEY}` in Cursor. Use that, so the key never ends up in a file you might commit. The client guides show the exact syntax. To get started in two minutes, follow the [MCP quickstart](/developers/docs/mcp/quickstart/). ## Safety in short An agent with a FineProxy key can spend money from your wallet, so the server is built to make mistakes hard: - **Scopes are the hard limit.** A key without `wallet:spend` can't buy anything, whatever the agent tries. Start with a read-only key. - **Price guards.** Purchases take the quoted price (`expected_total_cents` and similar). If the actual price differs, nothing is charged. - **Idempotency keys.** A retried purchase with the same `idempotency_key` does not charge twice. - **Explicit confirmation.** Cancelling a service or disabling an add-on requires `confirm: true`, and the server instructs agents to confirm with you first. - **Your wallet is the budget.** The agent can only spend what is on the prepaid balance, and it can't add money. Top-ups need you to pay on the payment page. Read [Safety for AI agents](/developers/docs/mcp/safety/) before you give an agent purchase rights. ## What MCP adds over the REST API Both interfaces work on the same account, but some capabilities are only available as MCP tools: | Capability | MCP tools | | --- | --- | | Usage analytics: overview, timeseries, top destinations | `get_usage_overview`, `get_usage_timeseries`, `get_top_destinations` | | Failure diagnostics and recommendations | `get_diagnostics`, `get_recommendations` | | Dedicated (exclusive) proxies | `quote_dedicated`, `order_dedicated` | | Auto-renewal on/off | `set_auto_renew` | | Price guard on composite orders | `order_composite` with `expected_total_cents` | | Login history | `get_access_log` | | Public IP of the caller | `get_my_ip` | | Payment gateways, payment attempts, top-up status | `list_payment_gateways`, `list_payments`, `get_deposit_status` | | Per-IP connection limits on the allowlist | `update_whitelist_limits` | | Imported-contract shortfall check and restore | `get_import_shortfall_status`, `quote_import_shortfall_restore`, `restore_import_shortfall` | The REST API, in turn, has [sticky sessions for rotating proxies](/developers/docs/api/sticky/) and [webhooks](/developers/docs/api/webhooks/), which have no MCP tools. ## Next steps - [MCP quickstart](/developers/docs/mcp/quickstart/): connect Cursor and run your first prompt. - [Example prompts](/developers/docs/mcp/prompts/): what to ask and which tools the agent calls. - [Safety for AI agents](/developers/docs/mcp/safety/): scopes, price guards and key strategy. - [Protocol details](/developers/docs/mcp/protocol/): build your own client. - [Troubleshooting](/developers/docs/mcp/troubleshooting/): fix connection and tool errors. --- # Safety for AI agents Source: https://fineproxy.org/developers/docs/mcp/safety/ An agent connected to FineProxy acts with your API key. This page explains what protects your account when the agent makes a mistake, and how to set up keys so that a mistake stays cheap. ## Scopes are the guardrail The server enforces the key's [scopes](/developers/docs/authentication/#scopes) on every tool call. The agent can't work around them: if the key lacks a scope, the tools that need it don't work. Each tool's description in [`tools/list`](/developers/docs/mcp/tools/) ends with the scopes it requires, for example `[requires scopes: services:write, wallet:spend]`. These tools take money from the wallet and need `wallet:spend` (plus `services:write`): | Tool | What it charges | Guard | | --- | --- | --- | | `order_composite` | A new datacenter, ISP or personal proxy order | `expected_total_cents` from `quote_composite`, `idempotency_key` | | `order_dedicated` | A new dedicated proxy order | `expected_total_cents` from `quote_dedicated`, `idempotency_key` | | `buy_service` | A fixed catalog product at its catalog price | Idempotent per product and parameters | | `renew_service` | One or more extra periods at the service's purchase price | — | | `add_ips` | Prorated cost of extra IPs for the rest of the paid period | `expected_charge_cents`, `idempotency_key` | | `refresh_ips` | Free in the free window, paid after that (`1000` cents in testing) | `expected_amount_cents`, `idempotency_key` | | `purchase_addon` | An add-on such as an extra allowlist IP | `expected_price_cents`, `idempotency_key` | `init_deposit` needs `wallet:deposit`. It doesn't move money: it creates a payment link that you open and pay yourself. These tools change services without charging and need `services:write`: `cancel_service`, `set_auto_renew`, `disable_addon`, `rotate_proxy_credentials`, `add_whitelist_ip`, `remove_whitelist_ip`, `replace_whitelist_ip`, `update_whitelist_limits`, `restore_import_shortfall`. ## Price guards Every purchase tool accepts the price the agent expects to pay. The server compares it with the actual price before charging. On a mismatch it charges nothing and returns the current price: ```text Invalid arguments: Price mismatch: expected_total_cents=1199, actual quote is 1200 cents. Nothing was charged. ``` The intended flow is always quote first, then buy with the quoted number: 1. `quote_composite` returns `total_price_cents: 1200` for 100 IPs × 1 month. 2. `order_composite` is called with `expected_total_cents: 1200`. `expected_total_cents` is optional in the `order_composite` schema, and the server instructions tell agents to always pass it. Check for it when you approve an order. For `purchase_addon` the guard is required: the agent takes the total for the chosen quantity from `list_available_addons`. ## Idempotency keys Purchase tools require an `idempotency_key`. If the network drops and the agent retries the same order with the same key, the server returns the original order instead of charging again. In testing, a replayed `order_composite` returned the same `service_id` with `balance_applied_cents: 0`. Use a fresh key for every new purchase intent and the same key only for retries of that purchase. ## The allowlist is mandatory for orders `order_composite` and `order_dedicated` require `whitelist_ips`, at least one IPv4 address allowed to use the proxies. The server tells agents to ask you for it when it's unknown. > **Warning:** `get_my_ip` returns the public IP of the machine that runs the MCP client. For a desktop client that is usually your computer; for cloud-hosted clients (for example Claude custom connectors, which connect from Anthropic's servers) it is not. Confirm the IP before the agent uses it. ## What the server tells agents On connection, the server sends `instructions` that clients pass to the model. Among other things they say: - Buy proxies through `list_countries` → `quote_composite` → `order_composite`, with a fresh `idempotency_key` and the quote's total as `expected_total_cents`. - Check `wallet_balance` before purchases. - Tools that require `confirm=true` are destructive or irreversible: confirm the details with the human first and never set `confirm` speculatively. - To stop paying for a service, turn off auto-renewal with `set_auto_renew` rather than cancelling. - After `init_deposit`, the wallet is credited only when the payment gateway confirms the payment, never by the tool call itself. Instructions guide a model; they don't bind it. Scopes and guards are what the server actually enforces. ## Irreversible actions | Action | Tool | What to know | | --- | --- | --- | | Cancel a service | `cancel_service` with `confirm: true` | Terminates the service immediately. Unused paid days are refunded to the wallet at the undiscounted daily rate; `refund_cents` in the result is the exact amount. | | Disable an add-on | `disable_addon` with `confirm: true` | Refunds the unused part of the current period. | | Rotate proxy credentials | `rotate_proxy_credentials` | The new password is returned once; the old one stops working, so running scrapers lose access. | | Refresh IPs | `refresh_ips` | Replaces the IP addresses of the service; the old ones are gone. | Self-service cancellation is limited to **once every 3 days per account**. A second cancel within that window fails without changing anything: ```text SERVICE_CANCEL_COOLDOWN: self-service cancellation is limited to once every 3 days. support_required=true retry_at=2026-11-30T10:04:48Z retry_after_seconds=259197. Ask the customer to open a support ticket. ``` If you only want to stop future charges, ask the agent to turn off auto-renew. The service then runs until the end of the paid period and expires without a refund. ## Recommended key strategy Create separate keys for separate jobs in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys): | Key | Scopes | Use for | | --- | --- | --- | | Read-only | `customer:read`, `wallet:read`, `services:read`, `catalog:read`, `usage:read`, `tickets:read` | Exploring, monitoring, diagnostics, quotes | | Management | read-only + `services:write`, `tickets:write` | Allowlist changes, credential rotation, auto-renew, tickets | | Purchasing | management + `wallet:spend` (and `wallet:deposit` if the agent should create top-up links) | Orders, renewals, add-ons | Use the read-only key by default and switch to a purchasing key only for the session that needs it. One key per client or per automation also lets you revoke one without breaking the others. Agents can't create or change API keys: key management works only from a signed-in dashboard session, so an agent can't grant itself more scopes. ## Budget control - **Keep a small balance.** The agent can only spend what is in the prepaid wallet. Top up the amount you're comfortable with, not more. - **The agent can't add money.** `init_deposit` only returns a payment link; you complete the payment on the gateway's page. - **Watch auto-renewal.** New orders have `auto_renew: true` unless the agent sets it to `false`. Renewals are charged automatically from the wallet each period. - **Review spending.** Ask "Show my last 10 wallet transactions" (`list_ledger`) or check the history in the dashboard. - **Revoke quickly.** If a key leaks or an agent misbehaves, revoke the key in the dashboard. Requests with a revoked key get `401`. ## What the MCP server can't access The server runs on FineProxy's side and sees only the tool calls your client sends: tool names and arguments. It has no access to your files, repositories, source code, terminal, browser or other MCP servers. In the other direction, your FineProxy key gives the agent access to your FineProxy account only. Your MCP client and the model provider, however, see the tool results, including proxy IPs and, if requested with `reveal`, proxy passwords. Choose clients and providers you trust with that data. ## Prompt injection An agent may read text that came from someone else, such as a web page, a file in your repository, or a support ticket message, and that text may contain instructions like "buy 10,000 IPs". To stay safe: - **Review tool calls before approving them.** Read the tool name and the arguments, especially `segments`, `expected_total_cents`, `whitelist_ips` and `confirm`. - **Don't auto-approve spending tools.** If your client lets you allowlist tools, allowlist read-only tools by name only. - **Don't rely on tool annotations for auto-approval.** Several tools that change state are annotated `readOnlyHint: true` (for example `set_auto_renew`, `rotate_proxy_credentials`, the allowlist tools and the ticket tools). Decide by tool name and scope. - **Use a read-only key** when the agent works with untrusted content. ## Related pages - [Authentication](/developers/docs/authentication/): scopes and key management. - [MCP tools reference](/developers/docs/mcp/tools/): every tool's inputs and required scopes. - [Example prompts](/developers/docs/mcp/prompts/): safe buying and maintenance conversations. --- # Example prompts Source: https://fineproxy.org/developers/docs/mcp/prompts/ These prompts work in any connected client. For each one you see the tools the agent typically calls, in order, and what to check before you approve or rely on the answer. Exact sequences vary between models; the server's instructions push agents toward the flows shown here. Tool names link to the [MCP tools reference](/developers/docs/mcp/tools/). Prompts that spend money need a key with `wallet:spend`; see [Safety for AI agents](/developers/docs/mcp/safety/). ## Buying ### Buy proxies in one country ```text Buy 100 German datacenter proxies for one month. Allow access from 203.0.113.10, no auto-renew. ``` Tools: [`list_countries`](/developers/docs/mcp/tools/#list_countries) → [`get_pricing_info`](/developers/docs/mcp/tools/#get_pricing_info) → [`quote_composite`](/developers/docs/mcp/tools/#quote_composite) → [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance) → [`order_composite`](/developers/docs/mcp/tools/#order_composite) What to check: - The quote: 100 IPs × 1 month was `1200` cents ($12.00) in testing. The agent should show you the price and wait for your go-ahead. - In the `order_composite` call: `expected_total_cents` equals the quote, `whitelist_ips` is your IP, `auto_renew` is `false`. - If you ask for fewer than 100 IPs, the quote fails with "below the tenant minimum of 100 IPs per order". The agent should offer 100 instead. ### Spread IPs across countries ```text I need 300 datacenter IPs in any mix of countries except RU and CN. Quote 1, 3 and 12 months. ``` Tools: [`plan_composite`](/developers/docs/mcp/tools/#plan_composite) with `total_ip: 300` and `excluded_countries` → [`quote_composite`](/developers/docs/mcp/tools/#quote_composite) three times, with `period_months` 1, 3 and 12 What to check: `plan_composite` splits the total in proportion to stock and returns ready-made `segments`. Longer periods are discounted (10% for 3 months, 20% for 12 months in the current pricing terms); compare `total_price_cents` across the quotes. Nothing is bought until you ask. ### Quote dedicated proxies ```text Quote 100 dedicated datacenter proxies: 50 in the US and 50 in Germany, for 3 months. ``` Tools: [`list_countries`](/developers/docs/mcp/tools/#list_countries) → [`quote_dedicated`](/developers/docs/mcp/tools/#quote_dedicated) → (after your confirmation) [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance) → [`order_dedicated`](/developers/docs/mcp/tools/#order_dedicated) What to check: the quote reports, per segment, how many IPs are available to your account right now. If dedicated proxies aren't offered for your account, the tool returns an error. When ordering, the same rules apply as for composite orders: quoted total as `expected_total_cents`, at least one `whitelist_ips` entry. ## Monitoring ### Check balance and upcoming renewals ```text List my FineProxy services with expiry dates and auto-renew status. Will my balance cover the renewals? ``` Tools: [`list_services`](/developers/docs/mcp/tools/#list_services) → [`get_service`](/developers/docs/mcp/tools/#get_service) for each active service → [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance) What to check: each service's `expires_at`, auto-renew flag and price snapshot. Services with auto-renew on are charged from the wallet at the end of each period; compare the sum of their prices with `balance_cents`. ### Weekly usage report ```text Give me a usage report for all my proxies for the last 7 days: requests, traffic, success rate, latency and top 10 domains. ``` Tools: [`get_usage_overview`](/developers/docs/mcp/tools/#get_usage_overview) → [`get_usage_timeseries`](/developers/docs/mcp/tools/#get_usage_timeseries) with `granularity: "day"` → [`get_top_destinations`](/developers/docs/mcp/tools/#get_top_destinations) with `limit: 10` What to check: the agent passes `start` and `end` as ISO 8601 timestamps. The overview returns `total_requests`, `total_bytes_in`, `total_bytes_out`, `success_rate`, latency `percentiles` (p50, p95, p99) and `error_breakdown`. If a result has `degraded: true`, a data source was temporarily unavailable: ask again later rather than reading it as zero traffic. ## Troubleshooting ### Find out why requests fail ```text My scraper is getting a lot of errors through FineProxy since yesterday. What's going wrong? ``` Tools: [`list_services`](/developers/docs/mcp/tools/#list_services) → [`get_diagnostics`](/developers/docs/mcp/tools/#get_diagnostics) → [`get_usage_overview`](/developers/docs/mcp/tools/#get_usage_overview) → [`get_top_destinations`](/developers/docs/mcp/tools/#get_top_destinations) → [`get_recommendations`](/developers/docs/mcp/tools/#get_recommendations) What to check: `get_diagnostics` returns `status_distribution`, `error_codes` grouped into categories (`network`, `dns`, `timeout`, `upstream`, `auth`, `client`, `other`) and `top_failing_destinations`. A good answer names the failure category, its share of requests and the affected sites instead of guessing from the overview alone. `get_recommendations` adds rule-based suggestions such as a high error rate or unused IPs. ### Replace blocked IPs ```text My German IPs on service 00000000-0000-0000-0000-000000000000 are blocked by the target site. Replace all of them with new German IPs. ``` Tools: [`get_refresh_status`](/developers/docs/mcp/tools/#get_refresh_status) → [`quote_refresh`](/developers/docs/mcp/tools/#quote_refresh) with `geo_counts: {"DE": 100}` → (after your confirmation) [`refresh_ips`](/developers/docs/mcp/tools/#refresh_ips) What to check: `get_refresh_status` says whether the next refresh is free (`is_free`, `price_cents`). The first refresh in the free window costs nothing; a later one was `1000` cents in testing. `quote_refresh` must show enough `available` IPs per country; with `shortfall: true` the refresh would be refused. For `refresh_ips`, `expected_amount_cents` should match the quote. Your proxy list changes: re-read it with `list_proxy_ips`. ### Check the allowlist from a new location ```text I can't connect to my proxies from this machine. Is my IP on the allowlist? ``` Tools: [`get_my_ip`](/developers/docs/mcp/tools/#get_my_ip) → [`list_services`](/developers/docs/mcp/tools/#list_services) → [`get_whitelist`](/developers/docs/mcp/tools/#get_whitelist) → (after your confirmation) [`replace_whitelist_ip`](/developers/docs/mcp/tools/#replace_whitelist_ip) or [`add_whitelist_ip`](/developers/docs/mcp/tools/#add_whitelist_ip) What to check: `get_my_ip` returns the public IP of the machine running the MCP client, which may not be the machine running your scraper. Confirm the address before it goes on the allowlist. To swap an old IP for a new one, `replace_whitelist_ip` does it in one step; the last allowlisted IP can't be removed, only replaced. ## Maintenance ### Rotate the proxy password ```text Rotate the proxy password of service 00000000-0000-0000-0000-000000000000 and show me the new credentials. ``` Tools: [`get_service`](/developers/docs/mcp/tools/#get_service) → (after your confirmation) [`rotate_proxy_credentials`](/developers/docs/mcp/tools/#rotate_proxy_credentials) What to check: the new password is returned once; store it right away. The old password stops working, so update every scraper that uses this service. ### Stop a service from renewing ```text I don't need service 00000000-0000-0000-0000-000000000000 after this month. Make sure it isn't renewed. ``` Tools: [`get_service`](/developers/docs/mcp/tools/#get_service) → [`set_auto_renew`](/developers/docs/mcp/tools/#set_auto_renew) with `enabled: false` What to check: the agent should use `set_auto_renew`, not `cancel_service`. The service keeps working until the end of the paid period and then expires without a refund. If the agent proposes `cancel_service`, it ends the service immediately; that's only right if you want a prorated refund now. ### Allow one more IP ```text I need a sixth IP on the allowlist of service 00000000-0000-0000-0000-000000000000: 198.51.100.20. ``` Tools: [`get_whitelist`](/developers/docs/mcp/tools/#get_whitelist) → [`list_available_addons`](/developers/docs/mcp/tools/#list_available_addons) → (after your confirmation) [`purchase_addon`](/developers/docs/mcp/tools/#purchase_addon) with `addon_type: "extra_whitelist_ip"` and `params: {"ip_count": 1}` → [`add_whitelist_ip`](/developers/docs/mcp/tools/#add_whitelist_ip) What to check: five allowlist IPs are included in the current pricing terms; each extra one is an add-on (`100` cents per month in the current terms). `expected_price_cents` must equal the total shown by `list_available_addons`. ### Renew before expiry ```text Renew service 00000000-0000-0000-0000-000000000000 for one more month if my balance allows it. ``` Tools: [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance) → [`get_service`](/developers/docs/mcp/tools/#get_service) → (after your confirmation) [`renew_service`](/developers/docs/mcp/tools/#renew_service) with `period_count: 1` What to check: renewal is charged at the price the service was bought at (`1200` cents for 100 IPs × 1 month in testing). The result shows `charged_cents` and `new_expires_at`. ## Billing ### Top up the wallet ```text Top up my FineProxy wallet with $50 using crypto. ``` Tools: [`list_payment_gateways`](/developers/docs/mcp/tools/#list_payment_gateways) → [`init_deposit`](/developers/docs/mcp/tools/#init_deposit) with `amount_cents: 5000` → you pay on the page → [`get_deposit_status`](/developers/docs/mcp/tools/#get_deposit_status) → [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance) What to check: `init_deposit` returns a `payment_url` that you open and pay yourself; the agent can't pay for you. The wallet is credited only after the gateway confirms the payment. Some gateways require identity verification first (`kyc_required_level` in the gateway list), and availability of a gateway can vary. ### Download an invoice ```text Download my latest FineProxy invoice as a PDF. ``` Tools: [`list_invoices`](/developers/docs/mcp/tools/#list_invoices) → [`get_invoice`](/developers/docs/mcp/tools/#get_invoice) → an HTTP `GET` of `pdf_download_url` What to check: `pdf_download_url` is downloaded with the same `Authorization: Bearer` key used for MCP. Agents with a terminal (Cursor, Claude Code) can do it with `curl`; chat-only clients give you the link instead. ### Review account access ```text Has anyone signed in to my FineProxy account in the last two weeks besides me? ``` Tools: [`get_access_log`](/developers/docs/mcp/tools/#get_access_log) → [`get_profile`](/developers/docs/mcp/tools/#get_profile) What to check: the login history shows who signed in and when. If you see sign-ins you don't recognize, change your password in the dashboard and revoke API keys you don't use. ## Tips for writing prompts - **Name the service.** If you have several services, include the service ID or describe it ("my German datacenter service"). - **State the limits.** "No auto-renew", "only if it costs under $20", "quote only, don't buy". - **Give your IP.** Orders need an allowlisted IPv4 address; saying it up front saves a round trip. - **Ask for a quote first.** "Quote, then wait for my confirmation" makes the agent stop before any paid call. --- # MCP protocol details Source: https://fineproxy.org/developers/docs/mcp/protocol/ This page is for engineers who build their own MCP client or call the server from code. It describes exactly how the FineProxy MCP server behaves on the wire. If you only want to connect an existing client, see the [MCP quickstart](/developers/docs/mcp/quickstart/). ## Endpoint and headers | Item | Value | | --- | --- | | URL | `https://fineproxy.org/account_new/api/v1/mcp` | | Method | `POST` only. `GET` and `DELETE` return `405` with `Allow: POST`. | | `Authorization` | `Bearer fb_...`, required on **every** request, including notifications | | `Content-Type` | `application/json` | | `Accept` | `application/json, text/event-stream` (recommended; the server replies with JSON either way) | | Message format | One JSON-RPC 2.0 message per request | Every response carries `x-request-id` and the rate-limit headers `x-ratelimit-limit`, `x-ratelimit-remaining` and `x-ratelimit-reset` (unix time). See [Rate limits](/developers/docs/rate-limits/). ## Transport The server implements the MCP **Streamable HTTP** transport in its stateless form: - Each request is independent. The server sends no `Mcp-Session-Id` header and expects none. - Responses are always a single `application/json` body. The server never opens an SSE stream, even if `Accept` lists only `text/event-stream`. - Notifications (`notifications/initialized`) are accepted with `202 Accepted` and an empty body. - Because no session state is kept, `tools/call` works without a prior `initialize`. Call `initialize` anyway, once per client session, to negotiate the version and read the server `instructions`. - You can reuse HTTP connections (keep-alive) freely. ## Protocol versions | Client sends `protocolVersion` | Server answers | | --- | --- | | `2025-06-18` | `2025-06-18` | | `2025-03-26` | `2025-03-26` | | `2024-11-05` | `2024-11-05` | | Any other value | `2025-06-18` | ## Capabilities | Feature | Supported | | --- | --- | | `tools/list`, `tools/call` | Yes. 57 tools, returned in one page (no `nextCursor`). | | `ping` | Yes, returns `{}` | | `tools.listChanged` notifications | No (`listChanged: false`). The tool list changes only with server releases. | | `resources/*`, `prompts/*` | No. These methods return JSON-RPC error `-32601`. | | JSON-RPC batches (arrays) | No. A batch returns `-32600`; send one message per request. | | SSE streaming, sessions, resumability | No | | OAuth | No. Use an API key in the `Authorization` header. | ## Initialize ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"my-client","version":"1.0"}}}' ``` Response (`instructions` shortened): ```json { "jsonrpc": "2.0", "id": 1, "result": { "protocolVersion": "2025-06-18", "capabilities": { "tools": { "listChanged": false } }, "serverInfo": { "name": "...", "version": "2.0.0" }, "instructions": "... All money amounts are integer cents.\n\n## Buying proxies (composite multi-country constructor)\n1. list_countries — discover available countries with live IP stock ...\n2. quote_composite — price a mix of {country, count} segments ...\n3. order_composite — purchase: pass the same segments, whitelist_ips ..., a fresh idempotency_key, and the quote's total_price_cents as expected_total_cents. ..." } } ``` The `instructions` text explains the buying flow, service management, diagnostics, billing and the rules for money and destructive tools. Pass it to the model as system context: it is what makes agents quote before buying and confirm before cancelling. Then send the notification: ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"notifications/initialized"}' ``` The server answers `202` with an empty body. ## List tools ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/list","id":2}' ``` Each tool has `name`, `description`, `inputSchema` (JSON Schema, `additionalProperties: false`) and `annotations`: ```json { "name": "wallet_balance", "description": "Get the prepaid wallet balance of the account (integer cents + currency). [requires scopes: wallet:read]", "inputSchema": { "type": "object", "properties": {}, "additionalProperties": false }, "annotations": { "readOnlyHint": true, "destructiveHint": false, "idempotentHint": false } } ``` What to watch: - The required scopes are at the end of each `description` in the form `[requires scopes: ...]`. - `annotations` contain `readOnlyHint`, `destructiveHint` and `idempotentHint`; `openWorldHint` is not set. Several state-changing tools (for example `set_auto_renew`, `rotate_proxy_credentials`, `add_whitelist_ip`, `create_ticket`) carry `readOnlyHint: true`, so don't build auto-approval on annotations. Use an explicit allowlist of tool names; see [Safety for AI agents](/developers/docs/mcp/safety/#prompt-injection). - All tools with their full schemas are in the [MCP tools reference](/developers/docs/mcp/tools/). ## Call a tool ```bash curl -sS -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"quote_composite","arguments":{"segments":[{"country":"DE","count":100}],"period_months":1}}}' ``` A successful result has `structuredContent` (the parsed object) and `content[0].text` (the same data serialized as JSON): ```json { "jsonrpc": "2.0", "id": 3, "result": { "content": [ { "type": "text", "text": "{\n \"total_ip\": 100,\n \"total_price_cents\": 1200,\n ...\n}" } ], "structuredContent": { "binding": false, "segments": [ { "country_code": "DE", "count": 100, "segment_price_cents": 1200, "available": true } ], "errors": [], "total_ip": 100, "total_price_cents": 1200, "period_months": 1, "discount_pct": 0, "monthly_price_cents": 1200 } } } ``` Read `structuredContent` when it's present and fall back to parsing `content[0].text` as JSON. Be lenient: in some captured responses `text` arrived as an object rather than a string. A tool-level failure is still HTTP `200`, with `isError: true` and a plain-text explanation: ```json { "jsonrpc": "2.0", "id": 4, "result": { "content": [ { "type": "text", "text": "Invalid arguments: Total order IP count (5) is below the tenant minimum of 100 IPs per order" } ], "isError": true } } ``` ## Error model Errors come from three layers. Check them in this order: | Layer | Signal | When | What to do | | --- | --- | --- | --- | | HTTP | `401`, `WWW-Authenticate: Bearer`, `{"detail": "Missing or malformed Authorization header. Expected: Bearer ."}` | No or malformed `Authorization` header | Send `Authorization: Bearer fb_...` | | HTTP | `401`, `{"detail": "Invalid or revoked API key."}` | Wrong or revoked key | Create a new key in the dashboard | | HTTP | `405`, `Allow: POST` | `GET` or `DELETE` | Use `POST` | | HTTP | `429`, `{"detail": "Too Many Requests"}` | Request bursts | Back off and retry; see below | | JSON-RPC | `error.code: -32600` | Batch (array) request | Send one message per request | | JSON-RPC | `error.code: -32601` | Unknown method, `resources/*`, `prompts/*` | Use only `initialize`, `ping`, `tools/list`, `tools/call` | | Tool | `result.isError: true` + text | Unknown tool, invalid arguments, business rules (minimum order, price mismatch, cooldowns), not-found objects | Show the text to the model or user; don't retry unchanged | Invalid tool arguments are reported as `isError` results, not as JSON-RPC `-32602`. Typical texts start with `Invalid arguments:`, `Request rejected (404):` or an error code such as `SERVICE_CANCEL_COOLDOWN:`. More examples are in [Troubleshooting](/developers/docs/mcp/troubleshooting/#common-tool-errors). ## Rate limits and timeouts - Bursts above about 2 requests per second return HTTP `429`, including bursts of `initialize`. Keep to 2 requests per second or less per account and retry with exponential backoff, using `x-ratelimit-reset` to decide how long to wait. - Typical tool calls take 0.5–0.8 seconds. `list_countries` takes about 10 seconds; a first `order_composite` took about 40 seconds in testing. Use a request timeout of at least 120 seconds for tool calls. - Retrying a paid tool after a timeout is safe only with the **same** `idempotency_key`: the server then returns the original result instead of charging again. ## Minimal clients without an SDK The server needs nothing beyond HTTP and JSON, so a few dozen lines are enough. Both clients read the key from `FINEPROXY_API_KEY`, retry on `429` and turn `isError` results into exceptions. ```python import json import os import time import uuid import requests MCP_URL = "https://fineproxy.org/account_new/api/v1/mcp" HEADERS = { "Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}", "Content-Type": "application/json", "Accept": "application/json, text/event-stream", } class McpError(Exception): pass def rpc(method, params=None, notify=False, retries=3): message = {"jsonrpc": "2.0", "method": method} if params is not None: message["params"] = params if not notify: message["id"] = str(uuid.uuid4()) for attempt in range(retries + 1): response = requests.post(MCP_URL, headers=HEADERS, json=message, timeout=120) if response.status_code == 429 and attempt < retries: time.sleep(2 ** (attempt + 1)) continue response.raise_for_status() break if notify: return None # 202, empty body body = response.json() if "error" in body: raise McpError(f"JSON-RPC {body['error']['code']}: {body['error'].get('message')}") return body["result"] def call_tool(name, arguments=None): result = rpc("tools/call", {"name": name, "arguments": arguments or {}}) text = result["content"][0]["text"] if result.get("content") else "" if result.get("isError"): raise McpError(text) if "structuredContent" in result: return result["structuredContent"] return json.loads(text) if isinstance(text, str) else text init = rpc("initialize", { "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "my-client", "version": "1.0"}, }) rpc("notifications/initialized", notify=True) print(init["protocolVersion"]) # 2025-06-18 print(len(rpc("tools/list")["tools"])) # 57 print(call_tool("wallet_balance")) # {'balance_cents': 2800, 'currency': 'USD', ...} ``` ```javascript // Node.js 18+ (built-in fetch), ES module import { randomUUID } from 'node:crypto'; const MCP_URL = 'https://fineproxy.org/account_new/api/v1/mcp'; const HEADERS = { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream', }; async function rpc(method, params, { notify = false, retries = 3 } = {}) { const message = { jsonrpc: '2.0', method }; if (params !== undefined) message.params = params; if (!notify) message.id = randomUUID(); for (let attempt = 0; ; attempt++) { const response = await fetch(MCP_URL, { method: 'POST', headers: HEADERS, body: JSON.stringify(message), signal: AbortSignal.timeout(120_000), }); if (response.status === 429 && attempt < retries) { await new Promise((resolve) => setTimeout(resolve, 2 ** (attempt + 1) * 1000)); continue; } if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`); if (notify) return null; // 202, empty body const body = await response.json(); if (body.error) throw new Error(`JSON-RPC ${body.error.code}: ${body.error.message}`); return body.result; } } async function callTool(name, args = {}) { const result = await rpc('tools/call', { name, arguments: args }); const text = result.content?.[0]?.text ?? ''; if (result.isError) throw new Error(typeof text === 'string' ? text : JSON.stringify(text)); if (result.structuredContent) return result.structuredContent; return typeof text === 'string' ? JSON.parse(text) : text; } const init = await rpc('initialize', { protocolVersion: '2025-06-18', capabilities: {}, clientInfo: { name: 'my-client', version: '1.0' }, }); await rpc('notifications/initialized', undefined, { notify: true }); console.log(init.protocolVersion); // 2025-06-18 console.log((await rpc('tools/list')).tools.length); // 57 console.log(await callTool('wallet_balance')); // { balance_cents: 2800, currency: 'USD', ... } ``` To place an order from code, follow the same flow as an agent: `quote_composite`, then `order_composite` with the quote's `total_price_cents` as `expected_total_cents`, a non-empty `whitelist_ips` and an `idempotency_key` you store before the call. See [Safety for AI agents](/developers/docs/mcp/safety/#price-guards). ## Existing tools that work If you'd rather not write a client, these were verified against the server: - [MCP Inspector](https://github.com/modelcontextprotocol/inspector) CLI with `--transport http` and `--header "Authorization: Bearer ..."`; see [Test without a client](/developers/docs/mcp/quickstart/#test-without-a-client). - [`mcp-remote`](https://github.com/punkpeye/mcp-remote) with `--transport http-only`, which exposes the server to stdio-only clients; see [Troubleshooting](/developers/docs/mcp/troubleshooting/#your-client-cant-send-headers). ## Related pages - [MCP tools reference](/developers/docs/mcp/tools/): input schemas of all 57 tools. - [Authentication](/developers/docs/authentication/): API keys and scopes. - [Rate limits](/developers/docs/rate-limits/): limits shared with the REST API. --- # MCP troubleshooting Source: https://fineproxy.org/developers/docs/mcp/troubleshooting/ Find your symptom in the table, then read the matching section for details. To check the server and your key without any AI client in between, run the [Inspector or curl tests](/developers/docs/mcp/quickstart/#test-without-a-client) first: if they work, the problem is in the client configuration. ## Quick reference | Symptom | Likely cause | Fix | | --- | --- | --- | | HTTP `401`, "Missing or malformed Authorization header" | Header not sent, or sent without `Bearer ` | [Fix the header](#401-unauthorized) | | HTTP `401`, "Invalid or revoked API key." | Wrong, mistyped or revoked key; literal `${env:...}` sent | [Fix the key](#401-unauthorized) | | HTTP `429`, "Too Many Requests" | Too many calls per second, often several clients on one account | [Slow down](#429-too-many-requests) | | HTTP `405` | Client uses the legacy SSE transport or sends `GET` | Select Streamable HTTP; in Cline set `"type": "streamableHttp"` | | Server connected, but no tools | Wrong config file or field name, client not restarted | [Tools missing](#tools-dont-appear-in-the-client) | | Client config has no `headers` field | Client supports only local stdio servers | [Use `mcp-remote`](#your-client-cant-send-headers) | | ChatGPT asks for OAuth or can't connect | ChatGPT connectors need OAuth | [Not supported](#chatgpt-is-not-supported) | | `'C:\Program' is not recognized…` on Windows | Spaces in `mcp-remote` arguments | [Windows fix](#windows-and-npx) | | Tool result `isError: true` | Business rule or invalid arguments | [Common tool errors](#common-tool-errors) | | A tool call hangs for several seconds | Some tools are slow by design | [Long-running tools](#long-running-tools-and-timeouts) | ## 401 Unauthorized The server answers `401` with `WWW-Authenticate: Bearer` and a `detail` message: ```json { "detail": "Missing or malformed Authorization header. Expected: Bearer ." } ``` The header must be exactly `Authorization: Bearer fb_...`. Check: - **The prefix.** Most config files need the full value `Bearer fb_...`. Clients with a dedicated token field add `Bearer ` themselves: in n8n's Bearer Auth credential and in VS Code's `${input:...}` prompt, paste only `fb_...`, otherwise the server receives `Bearer Bearer fb_...`. - **Environment variables.** If the config uses `${env:FINEPROXY_API_KEY}` (Cursor, Cline, Windsurf) or `${FINEPROXY_API_KEY}` (Claude Code, Copilot `.mcp.json`) and the variable isn't visible to the client, the literal placeholder is sent. GUI apps started from the Dock or Start menu often don't read your shell profile: start the client from a terminal where the variable is set, or set it system-wide. For Codex CLI, `bearer_token_env_var` holds the variable *name*; the variable must be set in the shell that starts Codex. - **The key itself.** Keys are shown once at creation. If you're not sure you copied it correctly, or it was revoked, create a new one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). - **Notifications too.** Custom clients must send the header on every `POST`, including `notifications/initialized`. ## 429 Too Many Requests ```json { "detail": "Too Many Requests" } ``` The limit is per account and shared with the REST API. Bursts above about 2 requests per second get `429`, and so do many `initialize` calls in a row, for example when several clients or Inspector sessions start at once. - Wait and retry with exponential backoff. The `x-ratelimit-reset` response header tells you when the window resets. - Don't run several agents on one account in parallel; if you must, space their calls out. - When testing with Inspector or curl, leave a couple of seconds between commands. ## Tools don't appear in the client 1. **Restart the client** after editing its config. Claude Desktop must be quit completely (Cmd+Q on macOS), not just closed. 2. **Check that you edited the file the client reads.** Common mix-ups: project vs global `mcp.json` in Cursor; `.vscode/mcp.json` (editor, `"servers"`) vs `.mcp.json` (Copilot harness, `"mcpServers"`) in VS Code; `~/.config/devin/mcp_config.json` vs `~/.codeium/windsurf/mcp_config.json` in Windsurf (use **Open MCP config file** in Cascade). Claude Code adds servers to the `local` scope by default, so they're missing in other directories; re-add with `--scope user`. 3. **Check the field names.** Remote servers need a type or URL field the client recognizes: | Client | Required fields | | --- | --- | | Cursor | `url`, `headers` | | Claude Code (`.mcp.json`) | `"type": "http"`, `url`, `headers`; without `type` the entry is skipped | | VS Code | `"type": "http"`, `url`, `headers` | | Cline | `"type": "streamableHttp"` (camelCase), `url`, `headers` | | Windsurf | `serverUrl`, `headers` | | Gemini CLI | `httpUrl` (not `url`, which means SSE), `headers` | | Codex CLI | `url`, `bearer_token_env_var` | 4. **Look at the logs.** Cursor: **Output → MCP Logs**. VS Code: **MCP: List Servers**. JetBrains: the MCP status column and logs. A `401` in the logs means the key; see above. 5. **Cursor cloud agents** don't read `~/.cursor/mcp.json`; configure MCP for them separately. Step-by-step setups are in the [client guides](/developers/docs/mcp/#supported-clients). ## Your client can't send headers Some clients start only local (stdio) servers or have no field for HTTP headers: Claude Desktop's `claude_desktop_config.json`, JetBrains AI Assistant's HTTP configuration, and others. Use the [`mcp-remote`](https://github.com/punkpeye/mcp-remote) bridge: the client starts it as a local process, and it forwards every message to FineProxy over HTTP with your header. It needs Node.js (`npx`). ```json { "mcpServers": { "fineproxy": { "command": "npx", "args": [ "-y", "mcp-remote", "https://fineproxy.org/account_new/api/v1/mcp", "--transport", "http-only", "--header", "Authorization:${FP_AUTH}" ], "env": { "FP_AUTH": "Bearer fb_your_api_key" } } } } ``` What to watch: - `--transport http-only` makes the bridge use Streamable HTTP directly. - The whole value `Bearer fb_...` goes into the `FP_AUTH` environment variable, and the header argument has **no spaces** around the colon: `Authorization:${FP_AUTH}`. - Instead of `--header`, you can pass `--header-file` with a path to a file (permissions `600`) that contains the line `Authorization: Bearer fb_...`, so the key isn't in the client config at all. To test the bridge from a terminal: ```bash export FP_AUTH="Bearer $FINEPROXY_API_KEY" npx -y @modelcontextprotocol/inspector --cli --method tools/list --transport stdio \ -e FP_AUTH="$FP_AUTH" -- \ npx -y mcp-remote https://fineproxy.org/account_new/api/v1/mcp \ --transport http-only \ --header "Authorization:\${FP_AUTH}" ``` Claude Desktop also has custom connectors (**Settings → Connectors → Add → Custom → Web**), where you can set request headers without the bridge. That connection is made from Anthropic's servers rather than your computer. ## ChatGPT is not supported ChatGPT custom MCP connectors authenticate with OAuth (or with no authentication) and have no field for a static bearer token. The FineProxy MCP server uses API keys only, so ChatGPT can't connect to it today. Use a client from the [supported list](/developers/docs/mcp/#supported-clients). Don't work around this by pasting your API key into a ChatGPT conversation. ## Windows and npx - **`'C:\Program' is not recognized as an internal or external command`** when Claude Desktop starts `mcp-remote`: a space in an argument breaks the command line. Keep the header argument without spaces (`Authorization:${FP_AUTH}`) and put `Bearer fb_...` into `env`, exactly as in the bridge config above. - **Config locations on Windows**: Cursor `%USERPROFILE%\.cursor\mcp.json`, Claude Desktop `%APPDATA%\Claude\claude_desktop_config.json`, Windsurf `%AppData%/devin/mcp_config.json`. ## Common tool errors When a tool fails, the HTTP status is still `200`; the result has `isError: true` and a text the agent should show you. These are the ones you're most likely to see: | Error text (start) | Meaning | What to do | | --- | --- | --- | | `Invalid arguments: Total order IP count (5) is below the tenant minimum of 100 IPs per order` | Composite orders and quotes need at least 100 IPs in total | Ask for 100 or more, across one or several countries | | `Invalid arguments: Price mismatch: expected_total_cents=1199, actual quote is 1200 cents. Nothing was charged.` | The price changed or the agent passed a wrong number | Quote again and order with the new total | | `Invalid arguments: geo_counts must contain at least one country.` | `quote_refresh` without `partial` needs the target countries | Pass `geo_counts`, for example `{"DE": 100}`, or use `partial: true` | | `ServiceNotFoundError: Rotating config not available for service ...` | `get_proxy_config` works only for rotating proxies | For datacenter services use `get_proxy_credentials` and `list_proxy_ips` | | `SERVICE_CANCEL_COOLDOWN: self-service cancellation is limited to once every 3 days. ...` | Another service was cancelled in the last 3 days | Wait until `retry_at`, or open a support ticket | | `Request rejected (404): Deposit not found` | Unknown ID passed to a lookup tool | Get the ID from the list tool (`list_payments`, `list_services`, …) | | `Invalid arguments: attachment_id must be a valid UUID` | Missing or malformed ID | Take IDs from earlier results; don't let the agent guess them | | `ServiceManagerError: Shortfall restore is not enabled for this environment.` | The imported-contract restore isn't available for your account | Contact support if you believe IPs are missing | **Missing scope.** Each tool needs the scopes listed at the end of its description (`[requires scopes: ...]`). If a tool that worked for one key fails for another, compare the keys' scopes. Purchases need `wallet:spend`, changes need `services:write`, top-up links need `wallet:deposit`. See the [scope table](/developers/docs/mcp/safety/#scopes-are-the-guardrail). A result with `degraded: true` from an analytics tool isn't an error: a data source was temporarily unavailable. Ask again shortly instead of reading the numbers as zero traffic. ## Long-running tools and timeouts Most tools answer in under a second. Some take longer: | Tool | Typical duration | | --- | --- | | `list_countries` | About 10 seconds | | `quote_composite` | Usually under a second, once about 11 seconds | | `order_composite` | About 40 seconds for a first call in testing; a retry with the same key about 2 seconds | If your client or workflow has a short tool timeout, raise it to at least 120 seconds (for example `"timeout": 120000` in JetBrains Junie's `mcp.json`). If a paid call timed out, don't start a new order: retry with the same `idempotency_key`, or check `list_services` and `list_ledger` first. A retry with the same key returns the original order without charging twice. ## Collecting information for support If you contact support, include: - The `x-request-id` header of the failing response. It's on every response; with curl, add `-i` to see it. Some clients also show response headers in their MCP logs. - The time of the request (with time zone), the tool name and the arguments, with the API key removed. - The full `isError` text or HTTP status and `detail` body. - Your client and its version, and whether you connect directly or through `mcp-remote`. ```bash curl -sS -i -X POST "https://fineproxy.org/account_new/api/v1/mcp" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","method":"tools/call","id":1,"params":{"name":"wallet_balance","arguments":{}}}' ``` Never send your API key to support. You can open a ticket in the dashboard, or ask the agent to do it with `create_ticket` (needs `tickets:write`). --- # Connect Cursor to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/cursor/ This page shows how to connect Cursor's agent to the FineProxy MCP server so it can read your account, quote and buy proxies, and troubleshoot services from chat. Cursor connects to the server directly over Streamable HTTP and sends your API key in the `Authorization` header. ## Requirements - Cursor with MCP support for remote (Streamable HTTP) servers. Node.js is not required. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Option 1: one-click install Click **[Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=fineproxy&config=eyJ1cmwiOiJodHRwczovL2ZpbmVwcm94eS5vcmcvYWNjb3VudF9uZXcvYXBpL3YxL21jcCIsImhlYWRlcnMiOnsiQXV0aG9yaXphdGlvbiI6IkJlYXJlciAke2VudjpGSU5FUFJPWFlfQVBJX0tFWX0ifX0=)** and confirm the install in Cursor. The link adds a server named `fineproxy` with this configuration: ```json { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" } } ``` > **Important:** The link stores only a reference to the `FINEPROXY_API_KEY` environment variable, not a key. Set the variable as described in [Keep your key out of the config](#keep-your-key-out-of-the-config) and restart Cursor. Until you do, every request fails with `401`. ### Option 2: edit mcp.json 1. Choose where the server should be available: | Scope | macOS / Linux | Windows | | --- | --- | --- | | Global (all projects) | `~/.cursor/mcp.json` | `%USERPROFILE%\.cursor\mcp.json` | | Project | `/.cursor/mcp.json` | `\.cursor\mcp.json` | 2. Add the `fineproxy` entry under `mcpServers` (create the file if it does not exist): ```json { "mcpServers": { "fineproxy": { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" } } } } ``` 3. Set `FINEPROXY_API_KEY` (see the next section) and restart Cursor. > **Note:** Hosted Cloud Agents do not read `~/.cursor/mcp.json`. To use FineProxy from Cloud Agents, configure the server for your team in the Cursor dashboard — see the [Cursor MCP docs](https://cursor.com/docs/mcp). ## Keep your key out of the config Cursor expands `${env:NAME}` in `headers`, so the file only holds a reference and the key lives in your environment: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` - The variable must be visible to the **Cursor process**. If you start Cursor from the Dock, Start menu or a launcher, it may not inherit variables from `~/.zshrc` or `~/.bashrc`. Start Cursor from a terminal where the variable is set, or set it as a system / user environment variable. - `envFile` applies only to local (stdio) servers. It has no effect on a remote URL server like FineProxy. > **Warning:** A project-level `.cursor/mcp.json` is easy to commit by accident. Never commit it with a literal `fb_...` key. Keep only the `${env:FINEPROXY_API_KEY}` reference there, or add the file to `.gitignore`. ## Verify the connection 1. Open **Customize** in the sidebar and find `fineproxy` in the MCP section. The server should be enabled and list its tools. 2. In the Agent chat, ask: ```text What is my FineProxy balance? ``` The agent calls the `wallet_balance` tool. Expand the tool call to see the arguments and the result: ```json { "balance_cents": 5000, "currency": "USD", "wallet_id": "00000000-0000-0000-0000-000000000000", "has_wallet": true } ``` Money values are integer cents: `5000` means $50.00. 3. If the server does not connect, open the Output panel (`Cmd+Shift+U` / `Ctrl+Shift+U`) and select **MCP Logs** in the dropdown. ## Tips - **Approve tool calls.** Cursor asks for approval before it runs an MCP tool. Click the arrow next to the tool name to check the arguments — especially for orders, renewals and cancellations. Don't allowlist money-moving tools for automatic runs. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want the agent to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | `401` in MCP Logs right after one-click install | `FINEPROXY_API_KEY` isn't set or Cursor doesn't see it. Set the variable and restart Cursor from a terminal where it is set. | | `401` although the variable is set | Cursor doesn't see the variable and sends `${env:FINEPROXY_API_KEY}` literally. Launch Cursor from a terminal with the variable set, or set it system-wide. | | Cursor offers to sign in with OAuth | The `Authorization` header is missing. FineProxy MCP has no OAuth — it accepts API keys only. Add the `headers` block. | | Server works locally but not in Cloud Agents | Cloud Agents don't read `~/.cursor/mcp.json`. Configure the server for your team in the Cursor dashboard. | | `429 Too Many Requests` | Too many sessions or reconnects in a short time. Wait a moment and reconnect once. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect Claude Code to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/claude-code/ This page shows how to connect [Claude Code](https://code.claude.com/docs/en/mcp) to the FineProxy MCP server. Claude Code talks to the server directly over HTTP and sends your API key in the `Authorization` header — no bridge or Node.js package is needed. ## Requirements - Claude Code installed, with `claude` on your `PATH`. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Choose a scope Claude Code stores MCP servers in one of three scopes: | Scope | Where it is stored | Available in | | --- | --- | --- | | `local` (default) | `~/.claude.json`, under the current project path | The current project only, for you | | `user` | `~/.claude.json` | All your projects | | `project` | `.mcp.json` in the repository root | Everyone who clones the repository | `~` is your home folder. For personal use, `user` is the most convenient scope. ### Option 1: add the server with the CLI 1. Put your key in an environment variable: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` 2. Add the server: ```bash claude mcp add --transport http --scope user fineproxy \ https://fineproxy.org/account_new/api/v1/mcp \ --header "Authorization: Bearer $FINEPROXY_API_KEY" ``` The command prints an `Added ...` line on success. Your shell expands `$FINEPROXY_API_KEY` when you run the command: the key value is saved in `~/.claude.json`, while this command in your shell history contains only the variable name. ### Option 2: share the server with your team in .mcp.json Create `.mcp.json` in the repository root. Remote servers **must** include `"type": "http"`: ```json { "mcpServers": { "fineproxy": { "type": "http", "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${FINEPROXY_API_KEY}" } } } } ``` Each teammate sets `FINEPROXY_API_KEY` with their own key before starting `claude`. The first time you run `claude` in the repository, it asks you to approve the project server. ## Keep your key out of the config - Claude Code expands `${VAR}` and `${VAR:-default}` in `url` and `headers` of `.mcp.json`. Use `${FINEPROXY_API_KEY}` and set the variable in the shell that starts `claude`. - Use a dedicated variable such as `FINEPROXY_API_KEY`. Claude Code deliberately reads its own and cloud-provider credential variables (for example `ANTHROPIC_API_KEY`) as empty in remote `headers`, so the server would receive `Bearer ` with no key. - If a `${VAR}` reference points to a variable that is not set, `claude mcp list` and `/mcp` warn about it and the server receives the text unexpanded. > **Warning:** `.mcp.json` is meant to be committed. Never put a literal `fb_...` key in it — keep only the `${FINEPROXY_API_KEY}` reference. ## Verify the connection Check the server status from your terminal: ```bash claude mcp list claude mcp get fineproxy ``` `claude mcp list` shows a status next to each server, for example `✔ Connected` or `✘ Failed to connect` with the HTTP status. A `.mcp.json` server shows `⏸ Pending approval` until you approve it in an interactive `claude` session. Inside a session, run `/mcp` to see `fineproxy` with its tool count, then ask: ```text What is my FineProxy balance? ``` Claude calls the `wallet_balance` tool and answers with your balance. The tool result looks like this: ```json { "balance_cents": 5000, "currency": "USD", "wallet_id": "00000000-0000-0000-0000-000000000000", "has_wallet": true } ``` Money values are integer cents: `5000` means $50.00. ## Tips - **Approve tool calls.** Claude Code asks for permission before it uses a tool. Read the arguments of order, renewal and cancellation tools before you allow them, and don't allow money-moving tools permanently. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want the agent to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | The server is missing when you work in another folder | It was added with the default `local` scope. Remove it and add it again with `--scope user`, or use `.mcp.json`. | | The `.mcp.json` server is ignored | The entry has `url` but no `"type": "http"`, so it is treated as an invalid local server. Add the `type` field. | | `✘ Failed to connect` with `401` | The key is missing, wrong or read as empty. Check that `FINEPROXY_API_KEY` is set in the shell that starts `claude` and that you don't reference an `ANTHROPIC_*` variable. | | `⏸ Pending approval` | Run `claude` in the repository and approve the project server. | | Warning about whitespace in `headers.Authorization` | The pasted key has a trailing space or newline. Remove it. | | `! Needs authentication` / OAuth prompt | The `Authorization` header is missing. FineProxy MCP accepts API keys only; there is no OAuth sign-in. | | `429 Too Many Requests` | Too many sessions connecting at once. Wait a moment and reconnect from `/mcp`. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect Claude Desktop to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/claude-desktop/ This page shows two ways to connect Claude Desktop to the FineProxy MCP server. Pick one: | Method | How the API key is sent | Who connects to FineProxy | | --- | --- | --- | | **Custom connector** (Settings → Connectors) | A request header you enter in the connector settings | Anthropic's cloud | | **`claude_desktop_config.json`** + `mcp-remote` | The local bridge adds the header | Your computer | The desktop config file only starts local (stdio) servers and has no field for HTTP headers. That is why the second method runs [`mcp-remote`](https://github.com/punkpeye/mcp-remote), a small bridge that turns a local stdio server into a Streamable HTTP connection with your `Authorization` header. ## Requirements - Claude Desktop. Custom connectors depend on your Claude plan — see [Anthropic's connector guide](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp). - For the `mcp-remote` method: Node.js with `npx` on your computer. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Option 1: custom connector 1. Open **Settings → Connectors → Add → Custom → Web**. 2. Enter the URL `https://fineproxy.org/account_new/api/v1/mcp`. 3. Choose the **Streamable HTTP** transport. 4. Under authentication, add a **request header**: name `Authorization`, value `Bearer fb_your_api_key` (with your key). 5. Save the connector. Requests to FineProxy then come from Anthropic's servers rather than from your computer. This works because the FineProxy MCP endpoint is public HTTPS. ### Option 2: claude_desktop_config.json with mcp-remote 1. Open the config file for your OS (create it if it does not exist): | OS | Path | | --- | --- | | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` | | Windows | `%APPDATA%\Claude\claude_desktop_config.json` | | Linux | `~/.config/Claude/claude_desktop_config.json` | 2. Add the `fineproxy` server: ```json { "mcpServers": { "fineproxy": { "command": "npx", "args": [ "-y", "mcp-remote", "https://fineproxy.org/account_new/api/v1/mcp", "--transport", "http-only", "--header", "Authorization:${FP_AUTH}" ], "env": { "FP_AUTH": "Bearer fb_your_api_key" } } } } ``` - `--transport http-only` makes the bridge use Streamable HTTP, which is what the FineProxy server speaks. - Write the header argument exactly as `Authorization:${FP_AUTH}`, **without spaces** around the colon. Some launchers (Claude Desktop on Windows among them) don't escape spaces inside `args`. Spaces are fine inside the `env` value, so `Bearer ...` goes there. 3. Fully quit Claude Desktop (`Cmd+Q` on macOS, not just closing the window) and open it again. You can test the same bridge from a terminal with the MCP Inspector before you touch the desktop config: ```bash export FP_AUTH="Bearer $FINEPROXY_API_KEY" npx -y @modelcontextprotocol/inspector --cli --method tools/list --transport stdio \ -e FP_AUTH="$FP_AUTH" -- \ npx -y mcp-remote https://fineproxy.org/account_new/api/v1/mcp \ --transport http-only \ --header "Authorization:\${FP_AUTH}" ``` ## Keep your key out of the config - **Custom connector:** the key is stored in your Claude connector settings, not in a file on disk or in Git. Keep in mind that it lives in your Claude account and follows your organization's policies there. - **Desktop config:** the key sits in the `env` block of `claude_desktop_config.json`. Don't keep copies of this file in a repository or a synced dotfiles folder. - To keep the key out of the config file and the process list entirely, use `mcp-remote --header-file` instead of `--header`. Point it to a file outside any repository with one `Name: value` line, and restrict it to your user (`chmod 600`): ```text Authorization: Bearer fb_your_api_key ``` > **Warning:** Never commit a `claude_desktop_config.json` or header file that contains a literal `fb_...` key. ## Verify the connection 1. In a new chat, open the tools / connectors menu and check that `fineproxy` is listed and connected. For a custom connector, the connector page in Settings shows its status. 2. Ask: ```text What is my FineProxy balance? ``` Claude calls the `wallet_balance` tool and answers with your balance, for example `"balance_cents": 5000` — money values are integer cents, so that is $50.00. ## Tips - **Approve tool calls.** Claude Desktop asks before it runs a tool. Read the arguments of order, renewal and cancellation tools before you allow them, and don't allow money-moving tools permanently. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want Claude to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | `'C:\Program' is not recognized...` on Windows | Spaces in `args` aren't escaped. Keep `Authorization:${FP_AUTH}` without spaces and put `Bearer ...` in `env`, as in the example. | | The server doesn't appear after editing the file | Claude Desktop reads the file at startup. Quit it completely and reopen it; check the file is valid JSON. | | The custom connector works, the desktop config doesn't | Check the `mcp-remote` output: the bridge logs to stderr, including the connection result and the HTTP status. | | `401` | The key is missing or wrong, or the `FP_AUTH` value lacks the `Bearer ` prefix. | | Claude tries to start an OAuth sign-in | FineProxy MCP has no OAuth — it accepts API keys only. Make sure the `Authorization` header is set. | | `429 Too Many Requests` | Too many connections in a short time. Wait a moment and restart once. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect VS Code to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/vscode/ This page shows how to connect GitHub Copilot in VS Code (agent mode) to the FineProxy MCP server. VS Code connects directly over HTTP and sends your API key in the `Authorization` header. VS Code reads MCP servers from two kinds of files, and they use different formats: | Configuration | Files | Top-level key | How to pass the key | | --- | --- | --- | --- | | **Editor-managed** | `.vscode/mcp.json`, user profile `mcp.json` | `servers` | Secure prompt `${input:...}` or `${env:NAME}` | | **Copilot (portable)** | `~/.copilot/mcp-config.json`, `.mcp.json` in the workspace root | `mcpServers` | Environment variable `${NAME}` only | Use the editor-managed configuration unless you share one MCP file between Copilot surfaces. ## Requirements - VS Code **1.101 or later** (remote HTTP MCP servers) with GitHub Copilot and agent mode available to you. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Where the config lives | Scope | Location | | --- | --- | | Workspace (editor-managed) | `.vscode/mcp.json` | | User profile (editor-managed) | Run **MCP: Open User Configuration** from the Command Palette (the path depends on your profile) | | Copilot, global | `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json`) | | Copilot, workspace | `.mcp.json` in the workspace root | ### Option 1: editor-managed config with a password prompt 1. Open `.vscode/mcp.json` (or your user configuration) and add: ```json { "servers": { "fineproxy": { "type": "http", "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${input:fineproxy_api_key}" } } }, "inputs": [ { "type": "promptString", "id": "fineproxy_api_key", "description": "FineProxy API key (fb_..., without Bearer prefix)", "password": true } ] } ``` 2. Start the server. VS Code asks for the key the first time and stores it securely for later sessions. > **Note:** Enter the raw key (`fb_...`) at the prompt. The header template already adds `Bearer `. You can also add the server to your user configuration from a terminal: ```bash code --add-mcp '{"name":"fineproxy","type":"http","url":"https://fineproxy.org/account_new/api/v1/mcp","headers":{"Authorization":"Bearer ${input:fineproxy_api_key}"}}' ``` The command doesn't create the `inputs` entry. Open the user configuration afterwards and add the `inputs` block from the example above. ### Option 2: Copilot config with an environment variable Add the server to `~/.copilot/mcp-config.json` or the workspace `.mcp.json`: ```json { "mcpServers": { "fineproxy": { "type": "http", "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${FINEPROXY_API_KEY}" } } } } ``` Set `FINEPROXY_API_KEY` in the environment that starts VS Code. This format doesn't support `${input:...}` prompts, `envFile` or other editor-only fields. ## Keep your key out of the config - **Editor-managed files:** use `${input:fineproxy_api_key}` (the value goes to VS Code's secret storage after the first prompt) or `${env:FINEPROXY_API_KEY}`. - **Copilot files:** use `${FINEPROXY_API_KEY}` (`${NAME:-default}` also works). There is no way to forward a prompted secret into an HTTP header from these files. ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` > **Warning:** `.vscode/mcp.json` and `.mcp.json` live in the workspace and are easy to commit. Never put a literal `fb_...` key in them — keep only `${input:...}` or environment variable references. ## Verify the connection 1. Run **MCP: List Servers** from the Command Palette and check that `fineproxy` is running. 2. Open Copilot Chat, switch to **Agent** mode and open the tools picker: the FineProxy tools are listed under `fineproxy`. 3. Ask: ```text What is my FineProxy balance? ``` Copilot calls the `wallet_balance` tool and answers with your balance, for example `"balance_cents": 5000` — money values are integer cents, so that is $50.00. ## Tips - **Approve tool calls.** Copilot asks for confirmation before it runs an MCP tool. Read the arguments of order, renewal and cancellation tools before you continue, and don't auto-approve money-moving tools. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want the agent to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | You edit `.mcp.json` but chat doesn't pick up the change | Chat uses the editor-managed `.vscode/mcp.json` (or the other way round). Check which configuration your session uses — see VS Code's [migration guide](https://code.visualstudio.com/docs/agent-customization/migrate-customizations). | | `${input:...}` is rejected or not resolved | Input prompts work only in editor-managed files. In `.mcp.json` / `mcp-config.json`, use `${FINEPROXY_API_KEY}`. | | `401` | The prompt received `Bearer fb_...` instead of the raw key (the header becomes `Bearer Bearer ...`), or the environment variable isn't set for VS Code. | | VS Code offers an OAuth sign-in | The `Authorization` header is missing. FineProxy MCP accepts API keys only. | | `429 Too Many Requests` | Too many restarts in a short time. Wait a moment and start the server once. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect Cline to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/cline/ This page shows how to connect [Cline](https://docs.cline.bot/mcp/mcp-overview) — the VS Code extension or the Cline CLI — to the FineProxy MCP server. Cline connects directly over Streamable HTTP and sends your API key in the `Authorization` header. ## Requirements - The Cline VS Code extension or Cline CLI. Environment variable references in headers need Cline **v3.43.0 or later**. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Where the config lives | Surface | Location | | --- | --- | | VS Code extension | Cline panel → **MCP Servers** icon → **Configure** tab → **Configure MCP Servers** (opens the extension's settings JSON) | | Cline CLI | `~/.cline/data/settings/cline_mcp_settings.json` (override with `CLINE_MCP_SETTINGS_PATH`) | `~` is your home folder. ### Option 1: edit the settings JSON Add the `fineproxy` entry under `mcpServers`: ```json { "mcpServers": { "fineproxy": { "type": "streamableHttp", "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" } } } } ``` > **Important:** Set `"type": "streamableHttp"` exactly (camelCase). Without `type`, Cline falls back to the legacy SSE transport, and the FineProxy server answers `405`. ### Option 2: add the server with the Cline CLI ```bash cline mcp add fineproxy https://fineproxy.org/account_new/api/v1/mcp \ --transport http \ --header 'Authorization: Bearer ${env:FINEPROXY_API_KEY}' \ --yes ``` Keep the single quotes around the header: they stop your shell from expanding `${env:...}`, so Cline saves the reference rather than its value. Without `--yes`, the command opens the add wizard with these fields filled in. ## Keep your key out of the config Cline expands `${env:NAME}` in server URLs and headers. Set the variable before you start VS Code or the Cline CLI: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` If you start VS Code from the Dock, Start menu or a launcher, it may not see variables from your shell profile — start it from a terminal where the variable is set, or set the variable system-wide. > **Warning:** Never commit a Cline settings file that contains a literal `fb_...` key. Keep only the `${env:FINEPROXY_API_KEY}` reference. ## Verify the connection 1. In the extension, open **MCP Servers**: `fineproxy` should show as connected with its tools. In the CLI, run `cline mcp` and choose **List servers**, or print the configuration with `cline config mcp`. 2. Ask Cline: ```text What is my FineProxy balance? ``` Cline calls the `wallet_balance` tool and answers with your balance, for example `"balance_cents": 5000` — money values are integer cents, so that is $50.00. ## Tips - **Approve tool calls.** Cline asks for approval before it runs a tool. The `autoApprove` list in the server entry skips that step — add only read-only tools such as `wallet_balance` to it, never order, renewal or cancellation tools. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want Cline to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | `405 Method Not Allowed` | `type` is missing, so Cline uses legacy SSE. Add `"type": "streamableHttp"`. | | Connection fails although the URL is right | Check the spelling of `type`: it must be `streamableHttp` (camelCase), not `streamable-http`. | | `401` | `FINEPROXY_API_KEY` isn't visible to VS Code / Cline, or your Cline version doesn't expand `${env:...}` (update to v3.43.0 or later). | | Cline offers an OAuth authorization | The `Authorization` header is missing. FineProxy MCP accepts API keys only. | | `429 Too Many Requests` | Too many reconnects in a short time. Wait a moment and restart the server once from the MCP Servers panel. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect Windsurf to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/windsurf/ This page shows how to connect Cascade, the agent in Windsurf, to the FineProxy MCP server. Cascade connects directly over Streamable HTTP and sends your API key in the `Authorization` header. ## Requirements - Windsurf with MCP enabled for Cascade. On Teams and Enterprise plans, an admin may need to turn MCP on. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up 1. In Cascade, open the MCP menu and choose **Open MCP config file**. This opens the file Cascade actually reads: | OS | Path | | --- | --- | | macOS / Linux | `~/.config/devin/mcp_config.json` (or `$XDG_CONFIG_HOME/devin/mcp_config.json` when `XDG_CONFIG_HOME` is set) | | Windows | `%AppData%\devin\mcp_config.json` | > **Note:** The editor's own MCP discovery uses a different file, `~/.codeium/windsurf/mcp_config.json`. Always edit the file that **Open MCP config file** opens. 2. Add the `fineproxy` entry under `mcpServers`: ```json { "mcpServers": { "fineproxy": { "serverUrl": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" } } } } ``` Remote servers need `serverUrl` (`url` is also accepted). Prefer `serverUrl`: a Cursor-style entry with only `url` may not connect in some Windsurf builds. 3. Save the file and press the **refresh** button in Cascade's MCP panel. You can also add servers from **Settings → Tools → Windsurf Settings → Add Server**. ## Keep your key out of the config Cascade expands `${env:NAME}` in `serverUrl`, `url` and `headers` (as well as `command`, `args` and `env`). Set the variable before you start Windsurf: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` If you start Windsurf from the Dock, Start menu or a launcher, it may not see variables from your shell profile — start it from a terminal where the variable is set, or set the variable system-wide. > **Warning:** Never copy an `mcp_config.json` with a literal `fb_...` key into a repository or a synced dotfiles folder. Keep only the `${env:FINEPROXY_API_KEY}` reference. ## Verify the connection 1. In Cascade's MCP panel, press refresh: `fineproxy` should be active and list its tools. 2. Ask Cascade: ```text What is my FineProxy balance? ``` Cascade calls the `wallet_balance` tool and answers with your balance, for example `"balance_cents": 5000` — money values are integer cents, so that is $50.00. ## Tips - **Approve tool calls.** Review each FineProxy tool call before Cascade runs it, especially order, renewal and cancellation tools, and don't auto-run money-moving tools. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want Cascade to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | Your changes have no effect | You edited `~/.codeium/windsurf/mcp_config.json` instead of the Cascade file. Use **Open MCP config file** and edit that file. | | The server doesn't connect with a `url` field | Rename the key to `serverUrl`. | | The server doesn't appear after saving | Press the refresh button in the MCP panel. | | `401` | `FINEPROXY_API_KEY` isn't visible to Windsurf, or the key is wrong. | | Cascade offers an OAuth sign-in | The `Authorization` header is missing. FineProxy MCP accepts API keys only. | | `429 Too Many Requests` | Too many reconnects in a short time. Wait a moment and refresh once. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect n8n to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/n8n/ This page shows how to use the FineProxy MCP server from an n8n workflow. The **MCP Client Tool** node connects to the server and exposes its tools to an **AI Agent** node, which decides when to call them. ## Requirements - n8n **1.104.0 or later** — the version that added the HTTP Streamable transport to the MCP Client Tool node. - An AI Agent workflow with a chat model sub-node (any model the AI Agent node supports). - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up There is no config file: the server settings live in the node, and the key lives in an n8n credential. ### 1. Create the credential 1. In n8n, create a new credential of type **Bearer Auth**. 2. In the token field, paste the **raw** key: `fb_your_api_key`. Do **not** type `Bearer ` — n8n adds the prefix itself. 3. Save the credential with a clear name, for example `FineProxy read-only`. If you prefer a generic header credential, use **Header Auth** with name `Authorization` and value `Bearer fb_your_api_key` (here the value includes `Bearer `). ### 2. Add the MCP Client Tool node Open your AI Agent node, click **+** under **Tool** and add **MCP Client Tool**. Set its parameters: | Parameter | Value | | --- | --- | | Endpoint | `https://fineproxy.org/account_new/api/v1/mcp` | | Server Transport | **HTTP Streamable** | | Authentication | **Bearer Auth**, then select the credential from step 1 | | Tools to Include | **Selected** with the tools you need, or **All** (see [Tips](#tips)) | > **Note:** If the node shows only an **SSE Endpoint** field and no transport choice, your n8n is older than 1.104.0. The FineProxy server speaks Streamable HTTP, so update n8n first. ### Example workflow A minimal "proxy assistant" workflow has four nodes: 1. **When chat message received** (Chat Trigger) — gives you a chat window to talk to the agent. 2. **AI Agent** — the agent itself. In its system message, describe the job, for example: "You help manage FineProxy proxies. Before any purchase, quote the order and ask the user to confirm the total." 3. **Chat model** sub-node connected to the AI Agent's **Chat Model** input. 4. **MCP Client Tool** sub-node connected to the AI Agent's **Tool** input, configured as above, with **Tools to Include** set to **Selected**: `wallet_balance`, `list_countries`, `quote_composite`. With this setup the agent can check the balance, list countries with available IPs and quote orders, but it cannot buy anything. Add `order_composite` to the selected tools (and `wallet:spend` to the key) only when you want the workflow to place orders. ## Keep your key out of the config - Store the key only in an n8n credential. The workflow refers to the credential; the key itself is not part of the workflow JSON. - Restrict who can use and edit the credential and the workflow in n8n. - Before you share or export a workflow, check that no key was pasted into a node field or the system message. ## Verify the connection 1. Open the chat of the Chat Trigger and send: ```text What is my FineProxy balance? ``` 2. The execution log shows the AI Agent calling the MCP Client Tool with the `wallet_balance` tool. The tool returns: ```json { "balance_cents": 5000, "currency": "USD", "wallet_id": "00000000-0000-0000-0000-000000000000", "has_wallet": true } ``` Money values are integer cents: `5000` means $50.00. To rule out n8n settings, test the endpoint and key from a terminal with the MCP Inspector: ```bash npx -y @modelcontextprotocol/inspector --cli \ https://fineproxy.org/account_new/api/v1/mcp \ --transport http \ --header "Authorization: Bearer $FINEPROXY_API_KEY" \ --method tools/call \ --tool-name wallet_balance ``` ## Tips - **There is no approval step.** Unlike chat-based IDE agents, an n8n AI Agent runs tools without asking. Use **Tools to Include → Selected** (or **All Except**) to expose only what the workflow needs, and keep spending tools out unless the workflow is meant to buy. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Use a separate credential with a `wallet:spend` key for purchasing workflows. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | `401` with a Bearer Auth credential | The token field contains `Bearer fb_...`, so n8n sends `Bearer Bearer fb_...`. Paste only the raw key. | | Connection fails although the endpoint is right | Check that **Server Transport** is **HTTP Streamable**. On some builds the setting doesn't stick — select it again and save the node. | | Only an **SSE Endpoint** field is shown | n8n is older than 1.104.0. Update n8n. | | The agent picks the wrong tools or too many | Narrow **Tools to Include** and describe the task more precisely in the AI Agent's system message. | | `429 Too Many Requests` | Many executions started at the same moment. Space out runs or limit concurrency. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect OpenAI Codex CLI to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/codex/ This page shows how to connect the [OpenAI Codex CLI](https://developers.openai.com/codex/mcp) to the FineProxy MCP server. Codex connects directly over Streamable HTTP and sends your API key as a bearer token that it reads from an environment variable. ## Requirements - Codex CLI with MCP support, `codex` on your `PATH`. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Where the config lives | Scope | Path | | --- | --- | | User | `~/.codex/config.toml` | | Project | `.codex/config.toml` (only in trusted projects) | `~` is your home folder. ### Option 1: add the server with the CLI 1. Put your key in an environment variable: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` 2. Add the server: ```bash codex mcp add fineproxy --url https://fineproxy.org/account_new/api/v1/mcp \ --bearer-token-env-var FINEPROXY_API_KEY ``` ### Option 2: edit config.toml Add this table to `~/.codex/config.toml`: ```toml [mcp_servers.fineproxy] url = "https://fineproxy.org/account_new/api/v1/mcp" bearer_token_env_var = "FINEPROXY_API_KEY" ``` Codex reads the variable when it starts and sends `Authorization: Bearer ` with every request. ## Keep your key out of the config - `bearer_token_env_var` stores only the **name** of the variable. The key itself stays in your environment, so `config.toml` holds no secret. - `env_http_headers` maps header names to environment variable names in the same way, for servers that need other headers. For FineProxy, `bearer_token_env_var` is all you need. - Avoid `http_headers` with a literal key: it writes the secret into `config.toml`. > **Warning:** A project-level `.codex/config.toml` is easy to commit. Keep only variable names in it, never a literal `fb_...` key. ## Verify the connection Check that the server is configured: ```bash codex mcp list codex mcp get fineproxy --json ``` Then start `codex`, type `/mcp` to see the active servers and their tools, and ask: ```text What is my FineProxy balance? ``` Codex calls the `wallet_balance` tool and answers with your balance, for example `"balance_cents": 5000` — money values are integer cents, so that is $50.00. ## Tips - **Approve tool calls.** Review each FineProxy tool call before Codex runs it, especially order, renewal and cancellation tools, and don't switch to an approval mode that runs money-moving tools unattended. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want Codex to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Some tools take a while to answer (`list_countries` can take about 10 seconds). If a call times out, raise `tool_timeout_sec` for the server (the default is 60 seconds). - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | `401` | `FINEPROXY_API_KEY` isn't set in the shell that starts `codex`. Export it there and restart Codex. | | Codex asks you to sign in with OAuth | The bearer token isn't configured. `codex mcp login` is for OAuth servers; FineProxy MCP accepts API keys only — use `bearer_token_env_var`. | | The project config is ignored | `.codex/config.toml` is read only in trusted projects. Trust the project or use `~/.codex/config.toml`. | | `429 Too Many Requests` | Too many sessions connecting at once. Wait a moment and start Codex again. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect Gemini CLI to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/gemini-cli/ This page shows how to connect [Gemini CLI](https://geminicli.com/docs/tools/mcp-server/) to the FineProxy MCP server. Gemini CLI connects directly over Streamable HTTP and sends your API key in the `Authorization` header. ## Requirements - Gemini CLI, `gemini` on your `PATH`. - A FineProxy API key (starts with `fb_`). Create one in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). Start with read-only [scopes](/developers/docs/authentication/#scopes). ## Set up ### Where the config lives | Scope | Path | | --- | --- | | User | `~/.gemini/settings.json` | | Project | `.gemini/settings.json` in the project folder | `~` is your home folder. ### Option 1: add the server with the CLI 1. Put your key in an environment variable: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` 2. Add the server to your user settings: ```bash gemini mcp add --transport http --scope user \ -H 'Authorization: Bearer $FINEPROXY_API_KEY' \ fineproxy https://fineproxy.org/account_new/api/v1/mcp ``` The single quotes keep `$FINEPROXY_API_KEY` as a reference in `settings.json`; Gemini CLI resolves it when it loads the settings. With double quotes, your shell would write the key value itself into the file. > **Important:** The default scope of `gemini mcp add` is `project`, which writes `.gemini/settings.json` inside the current folder. Pass `--scope user` unless you really want a project entry. ### Option 2: edit settings.json Add the `fineproxy` entry under `mcpServers`: ```json { "mcpServers": { "fineproxy": { "httpUrl": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer $FINEPROXY_API_KEY" } } } } ``` Use `httpUrl` for Streamable HTTP. The `url` field is for SSE servers. ## Keep your key out of the config - Gemini CLI resolves `$VAR_NAME`, `${VAR_NAME}` and `${VAR_NAME:-default}` in string values of `settings.json` when it loads the settings, so `headers` can reference `FINEPROXY_API_KEY` instead of holding the key. - A variable that isn't set resolves to an empty string, and the server then answers `401`. > **Warning:** `.gemini/settings.json` in a project folder is easy to commit. Keep only variable references in it, never a literal `fb_...` key. ## Verify the connection Check the connection from your shell: ```bash gemini mcp list ``` A working entry shows `fineproxy: https://fineproxy.org/account_new/api/v1/mcp (http) - Connected`. In an interactive session, run `/mcp` to see the server status and its tools, then ask: ```text What is my FineProxy balance? ``` Gemini CLI asks you to confirm the `wallet_balance` tool call, runs it and answers with your balance, for example `"balance_cents": 5000` — money values are integer cents, so that is $50.00. ## Tips - **Approve tool calls.** Gemini CLI asks for confirmation before each tool call. Don't set `"trust": true` for the FineProxy server and don't add it with `--trust`: both skip all confirmations, including for purchases. - **Expose only what you need.** `includeTools` and `excludeTools` in the server entry limit which FineProxy tools the model can see. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Create a separate key with `wallet:spend` when you want Gemini CLI to buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | Connection errors with a correct URL | The entry uses `url` (SSE) instead of `httpUrl`. Rename the field. | | `401` | `FINEPROXY_API_KEY` isn't set in the shell that starts `gemini`, so the header becomes `Bearer ` with no key. | | The server is only available in one folder | It was added with the default `project` scope. Remove it with `gemini mcp remove --scope project fineproxy` and add it again with `--scope user`. | | "MCP issues detected" at startup | Run `/mcp list` or `gemini mcp list` to see the connection error. | | `429 Too Many Requests` | Too many sessions connecting at once. Wait a moment and start again. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Connect other clients to FineProxy MCP Source: https://fineproxy.org/developers/docs/mcp/clients/other/ Any MCP client can use the FineProxy server if it can send a custom `Authorization` header over Streamable HTTP — or if it can start a local stdio server, through the `mcp-remote` bridge. This page covers clients without a dedicated guide and shows how to test the server from a terminal. All examples use the same settings: | Setting | Value | | --- | --- | | Server name | `fineproxy` | | URL | `https://fineproxy.org/account_new/api/v1/mcp` | | Transport | Streamable HTTP (stateless, `POST` only) | | Authentication | Header `Authorization: Bearer fb_your_api_key` — API keys only, no OAuth | Create a key in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys) and start with read-only [scopes](/developers/docs/authentication/#scopes). ## Stdio-only clients: the mcp-remote bridge If a client can only launch local (stdio) MCP servers, run [`mcp-remote`](https://github.com/punkpeye/mcp-remote) as the server. It needs Node.js with `npx`, connects to FineProxy over Streamable HTTP and adds your header to every request. ```json { "mcpServers": { "fineproxy": { "command": "npx", "args": [ "-y", "mcp-remote", "https://fineproxy.org/account_new/api/v1/mcp", "--transport", "http-only", "--header", "Authorization:${FP_AUTH}" ], "env": { "FP_AUTH": "Bearer fb_your_api_key" } } } } ``` - `--transport http-only` tells the bridge to use Streamable HTTP only. - `mcp-remote` replaces `${FP_AUTH}` in the header with the value from `env`. Write `Authorization:${FP_AUTH}` **without spaces** — some clients don't escape spaces inside `args` — and keep `Bearer ...` in `env`, where spaces are fine. - To keep the key out of the config file and the process list, use `--header-file ` instead of `--header`. The file holds one `Name: value` line per header, for example `Authorization: Bearer fb_your_api_key`; restrict it with `chmod 600` and keep it outside any repository. Adapt the outer structure (`mcpServers`, `command`, `args`, `env`) to your client's config format; the `args` stay the same. ## JetBrains AI Assistant The AI Assistant MCP settings (**Settings → Tools → AI Assistant → MCP**) document only a `url` for HTTP servers, with no field for headers. A direct HTTP entry therefore gets `401`. Use the stdio bridge instead: 1. Open **Settings → Tools → AI Assistant → MCP** and click **Add**. 2. Switch to the **STDIO** tab. 3. Paste the `mcp-remote` configuration from [the section above](#stdio-only-clients-the-mcp-remote-bridge) and put your key in `FP_AUTH`. 4. Save. The **Status** column of the MCP table should show the server as connected. AI Assistant doesn't support OAuth for MCP servers, which doesn't matter here: FineProxy uses API keys. ## JetBrains Junie Junie reads MCP servers from `mcp.json` files that support `headers`: | File | Scope | | --- | --- | | `~/.junie/mcp/mcp.json` | Global | | `.junie/mcp/mcp.json` | Project (meant to be committed) | ```json { "mcpServers": { "fineproxy": { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer ${env:FINEPROXY_API_KEY}" }, "timeout": 120000 } } } ``` Check that your IDE version expands `${env:...}` in headers: if the server answers `401`, the reference was sent literally. In that case use the stdio bridge. > **Warning:** The project file `.junie/mcp/mcp.json` is shared through Git. Keep only variable references in it, never a literal `fb_...` key. ## Zed Zed connects to remote MCP servers ("context servers") over HTTP with custom headers: | Scope | macOS / Linux | Windows | | --- | --- | --- | | User | `~/.config/zed/settings.json` | `%APPDATA%\Zed\settings.json` | | Project | `.zed/settings.json` | `.zed\settings.json` | ```json { "context_servers": { "fineproxy": { "url": "https://fineproxy.org/account_new/api/v1/mcp", "headers": { "Authorization": "Bearer fb_your_api_key" } } } } ``` - Zed sends header values literally: `${VAR}` and `$VAR` references in remote `headers` are not reliably expanded (see [Zed issue #60459](https://github.com/zed-industries/zed/issues/60459)). Put the key in your **user** `settings.json` only. - If you leave out the `Authorization` header, Zed starts an OAuth flow, which FineProxy doesn't support. - Check the status in **Settings → AI → MCP Servers**: a green indicator means the server is active. > **Warning:** Never put the key in a project `.zed/settings.json` — it ends up in Git. ## ChatGPT ChatGPT custom MCP servers (**Plugins → Add custom MCP server**) offer OAuth or no authentication. There is no field for a static bearer header, and the FineProxy MCP server doesn't offer OAuth. **ChatGPT can't connect to the FineProxy MCP server.** Don't try to work around this by putting your key into a chat message. To use FineProxy with OpenAI models, use the [Codex CLI](/developers/docs/mcp/clients/codex/), or call the [REST API](/developers/docs/quickstart/) from your own code. ## Test the server with the MCP Inspector The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) CLI is the quickest way to check your key and the endpoint without an AI client. Set the key once: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` List the tools (the server exposes 57): ```bash npx -y @modelcontextprotocol/inspector --cli \ https://fineproxy.org/account_new/api/v1/mcp \ --transport http \ --header "Authorization: Bearer $FINEPROXY_API_KEY" \ --method tools/list ``` Call a read-only tool: ```bash npx -y @modelcontextprotocol/inspector --cli \ https://fineproxy.org/account_new/api/v1/mcp \ --transport http \ --header "Authorization: Bearer $FINEPROXY_API_KEY" \ --method tools/call \ --tool-name wallet_balance ``` The result contains `structuredContent` and the same data as text in `content[0].text`: ```json { "content": [ { "type": "text", "text": "{\n \"balance_cents\": 5000,\n \"currency\": \"USD\",\n \"wallet_id\": \"00000000-0000-0000-0000-000000000000\",\n \"has_wallet\": true\n}" } ], "structuredContent": { "balance_cents": 5000, "currency": "USD", "wallet_id": "00000000-0000-0000-0000-000000000000", "has_wallet": true } } ``` Money values are integer cents: `5000` means $50.00. To test the stdio bridge exactly as a stdio-only client would run it: ```bash export FP_AUTH="Bearer $FINEPROXY_API_KEY" npx -y @modelcontextprotocol/inspector --cli --method tools/list --transport stdio \ -e FP_AUTH="$FP_AUTH" -- \ npx -y mcp-remote https://fineproxy.org/account_new/api/v1/mcp \ --transport http-only \ --header "Authorization:\${FP_AUTH}" ``` > **Note:** Running many Inspector sessions back to back can trigger `429 Too Many Requests` on `initialize`. Leave a few seconds between runs. ## Tips - **Approve tool calls.** Whatever client you use, review order, renewal and cancellation calls before they run, and don't auto-approve money-moving tools. - **Use a read-only key first.** For exploring, a key with `customer:read`, `wallet:read`, `services:read` and `catalog:read` is enough. Without `wallet:spend`, the agent can't run tools that debit your wallet. - **Add `wallet:spend` only for purchases.** Use a separate key with `wallet:spend` when an agent must buy or renew. Purchase tools carry a price guard and an idempotency key: a wrong total is rejected without a charge, and a retry with the same key never charges twice. - Read [MCP safety](/developers/docs/mcp/safety/) and the [scopes reference](/developers/docs/authentication/#scopes) before you give an agent spending rights. ## Troubleshooting | Symptom | Cause and fix | | --- | --- | | `401` on a direct HTTP entry in JetBrains AI Assistant | The HTTP entry can't send headers. Use the `mcp-remote` stdio configuration. | | `401` in Zed with `${VAR}` in the header | Zed sent the reference literally. Put the key itself in your user `settings.json`. | | The client starts an OAuth sign-in | The `Authorization` header is missing. FineProxy MCP accepts API keys only. | | `'C:\Program' is not recognized...` on Windows | Spaces in `args` aren't escaped. Keep `Authorization:${FP_AUTH}` without spaces and put `Bearer ...` in `env`. | | `mcp-remote` fails to connect | Check its stderr output: it logs the transport, the headers it uses (names only) and the connection result. Make sure `--transport http-only` is set. | | `429 Too Many Requests` | Too many sessions in a short time. Wait a few seconds and reconnect once. | For server-side errors and tool failures, see [MCP troubleshooting](/developers/docs/mcp/troubleshooting/). --- # Authentication Source: https://fineproxy.org/developers/docs/authentication/ Every request to the FineProxy REST API and the MCP server is authenticated with an API key. This page explains how to create a key, how to send it, which scopes exist and how to limit what a key can do. ## API keys An API key is a long-lived secret tied to your FineProxy account. It starts with `fb_` and carries an explicit list of [scopes](#scopes): an endpoint or MCP tool works only when the key holds the scope it requires. ### Create a key 1. Sign in to the dashboard and open [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). 2. Give the key a descriptive name (for example `billing-exporter` or `cursor-agent`) and select its scopes. 3. Copy the key immediately. It is shown **only once**; FineProxy cannot display it again. If you lose it, create a new key and revoke the old one. > **Important:** Treat an API key like a password. Store it in a secret manager or an environment variable, never in Git, client-side code, screenshots or chat messages. ### Key management is dashboard-only Keys are created, listed and revoked only from a signed-in dashboard session. The key-management endpoints under `/api/v1/customers/me/api-keys` reject API keys, so a key can never create, list or revoke other keys — even one with every scope: ```bash curl https://fineproxy.org/account_new/api/v1/customers/me/api-keys \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` The response is `403 Forbidden`. This is expected behavior, not a missing scope: ```json { "detail": "api_key_management_requires_session" } ``` ## Send the key Pass the key as a bearer token in the `Authorization` header. The same header works for REST endpoints and for the MCP endpoint `https://fineproxy.org/account_new/api/v1/mcp`. ```bash curl https://fineproxy.org/account_new/api/v1/customer/me \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/me', { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }, }); console.log(response.status, await response.json()); ``` ```python import os import requests response = requests.get( "https://fineproxy.org/account_new/api/v1/customer/me", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) print(response.status_code, response.json()) ``` Always send the key in the header. Never put it in URLs or query strings, where it ends up in logs and browser history. ## Authentication errors Authentication failures return `401 Unauthorized` with a `WWW-Authenticate: Bearer` header and a JSON `detail` string. There are two distinct messages. The header is missing, or it does not use the `Bearer ` format: ```json { "detail": "Missing or malformed Authorization header. Expected: Bearer ." } ``` The header is well-formed, but the key does not exist or has been revoked: ```json { "detail": "Invalid or revoked API key." } ``` Do not retry a `401` automatically: fix the header or replace the key. For other error responses, see [Errors](/developers/docs/errors/). ## Scopes Select only the scopes your integration needs. The same scopes apply to REST endpoints and MCP tools; the [API reference](/developers/docs/api/services/) and the [MCP tools reference](/developers/docs/mcp/tools/) list the scope of every operation. | Scope | Allows | Example endpoints and tools | | --- | --- | --- | | `customer:read` | Read your profile and legacy invoice archive | `GET /api/v1/customer/me`, `GET /api/v1/customer/me/whmcs-invoices`; MCP `get_profile`, `get_my_ip`, `get_access_log` | | `customer:write` | Update profile fields (`name`, `phone`) | `PATCH /api/v1/customer/me` | | `catalog:read` | Browse products, countries and prices; get quotes | `GET /api/v1/customer/catalog`; MCP `list_countries`, `get_pricing_info`, `quote_composite`, `quote_dedicated` | | `services:read` | Read services, IPs, credentials, allowlist, rotating config, sticky settings, refresh quotes | `GET /api/v1/customer/services`, `GET .../proxy/ips`, `GET .../proxy/auth`, `GET .../proxy/config`; MCP `list_services`, `get_proxy_credentials`, `quote_refresh` | | `services:write` | Change services: allowlist, credentials, sticky settings, renew, cancel, auto-renew | `POST .../proxy/whitelist`, `PUT .../proxy/auth`, `POST .../cancel`; MCP `add_whitelist_ip`, `rotate_proxy_credentials`, `set_auto_renew`, `cancel_service` | | `usage:read` | Read traffic statistics and diagnostics | `GET .../usage`; MCP `get_usage`, `get_usage_overview`, `get_diagnostics`, `get_recommendations` | | `wallet:read` | Read balance, ledger, invoices and payment gateways | `GET /api/v1/customer/wallet/balance`, `GET /api/v1/customer/wallet/ledger`; MCP `wallet_balance`, `list_ledger`, `list_invoices` | | `wallet:deposit` | Start a top-up and track its status (returns a checkout link; no money moves until you pay) | `POST /api/v1/customer/wallet/deposit/init`; MCP `init_deposit`, `get_deposit_status`, `list_payments` | | `wallet:spend` | **Financial.** Debit the wallet: buy, renew, add IPs, paid IP refresh, add-ons | MCP `order_composite`, `order_dedicated`, `buy_service`, `renew_service`, `add_ips`, `refresh_ips`, `purchase_addon` | | `tickets:read` | Read support tickets and attachments | `GET /api/v1/customer/tickets`; MCP `list_tickets`, `get_ticket` | | `tickets:write` | Create, reply to and close tickets | `POST /api/v1/customer/tickets`; MCP `create_ticket`, `reply_ticket`, `close_ticket` | | `webhooks` | Manage webhook endpoints and deliveries | `/api/v1/customer/webhooks` endpoints | > **Warning:** `wallet:spend` lets the key spend your wallet balance without further confirmation. Grant it only to keys used by code you control, and always combine purchases with [idempotency keys and price guards](/developers/docs/idempotency/). Money-spending MCP tools need both `services:write` and `wallet:spend`. ## Least privilege Create one key per integration rather than one key for everything. Typical setups: | Use case | Scopes | | --- | --- | | Exploring the API, dashboards, monitoring | `customer:read`, `catalog:read`, `services:read`, `usage:read`, `wallet:read` | | AI agent that answers questions and troubleshoots | The read-only set above, plus `tickets:read` if it should see support history | | Agent or script that manages the allowlist and credentials | Read-only set plus `services:write` | | Purchasing automation (buy, renew, add IPs) | `catalog:read`, `services:read`, `services:write`, `wallet:read`, `wallet:spend` — in a separate key | | Webhook receiver setup | `webhooks` | Recommendations: - Give AI agents a **read-only key** first. Add write scopes only when you want the agent to act, and keep `wallet:spend` in a separate key that you enable deliberately. - Keep the purchasing key on a server you control. Never paste a key with `wallet:spend` into a shared agent configuration or a public repository. - Name keys after the system that uses them, so you know what breaks when you revoke one. ## Rotate and revoke keys Rotate keys periodically and immediately if a key may have leaked. 1. Create a new key with the same scopes in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). 2. Deploy the new key to your integration and confirm it works. 3. Revoke the old key in the dashboard. Requests that still use it get `401` with `"Invalid or revoked API key."`. If you suspect a leak, revoke first and create the replacement afterwards. Then review the [ledger](/developers/docs/api/wallet/) and your services for unexpected changes. ## Next steps - [Conventions](/developers/docs/conventions/) — base URL, money, IDs, timestamps and pagination. - [Errors](/developers/docs/errors/) — error bodies and how to handle them. - [Idempotency & price guards](/developers/docs/idempotency/) — spend money safely. - [MCP server](/developers/docs/mcp/) — use the same key with AI agents. --- # API conventions Source: https://fineproxy.org/developers/docs/conventions/ These rules apply to every endpoint of the FineProxy REST API. Read this page once and you will know how to build URLs, read amounts and dates, and page through lists. ## Base URL and versioning | Item | Value | | --- | --- | | Base URL | `https://fineproxy.org/account_new` | | Version prefix | `/api/v1/` — every path starts with it | | MCP endpoint | `https://fineproxy.org/account_new/api/v1/mcp` | | OpenAPI specification | [`/developers/openapi.json`](/developers/openapi.json) | A full URL is the base URL plus the path from the [API reference](/developers/docs/api/services/): ```text https://fineproxy.org/account_new/api/v1/customer/wallet/balance ``` The version is part of the path. Build URLs from a single base constant so that you only change one place if a new version appears. All traffic is HTTPS. Requests are authenticated with a bearer API key — see [Authentication](/developers/docs/authentication/). A few read-only billing endpoints that describe public offers — `GET /api/v1/billing/countries`, `GET /api/v1/billing/catalog/facets`, `GET /api/v1/billing/composite/pricing-info` and `POST /api/v1/billing/composite/auto-plan` — also answer without a key; sending one does no harm. ## Request and response format - Request and response bodies are JSON (`Content-Type: application/json`). Send `Content-Type: application/json` with every request that has a body. - Field names are `snake_case`. - Many request schemas are strict: an unknown field is rejected with `422` before anything else happens. Send only the fields documented in the API reference. - Fields without a value are usually returned as `null`. Treat both `null` and a missing optional field as "not set". ```bash curl -X POST https://fineproxy.org/account_new/api/v1/billing/composite/quote \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"segments":[{"country":"DE","count":100}],"period_months":1}' ``` ## Identifiers Services, products, tickets, webhook endpoints, ledger entries and other objects are identified by UUIDs: ```text 00000000-0000-0000-0000-000000000000 ``` Store IDs as strings. A path parameter that is not a valid UUID returns `422` with `{"detail": "Validation error"}`; a well-formed UUID that is not found in your account returns `404`. ## Money All amounts are **integer cents** in the account currency. Field names end in `_cents`: | Field | Value | Meaning | | --- | --- | --- | | `balance_cents` | `2800` | $28.00 | | `total_price_cents` | `1200` | $12.00 — 100 datacenter IPs for 1 month | | `unit_base_cents` | `12` | $0.12 per IP | | `amount_cents` (ledger) | `-1200` | A debit of $12.00; refunds and top-ups are positive | The currency is returned next to the balance (`"currency": "USD"`). Never use floating-point numbers for money: keep cents as integers and format them only for display. ```javascript const formatUsd = (cents) => `$${(cents / 100).toFixed(2)}`; formatUsd(1200); // "$12.00" ``` > **Note:** `GET /api/v1/billing/composite/pricing-info` is the one exception: its volume tiers use `price_millicents_per_ip` (thousandths of a cent). `12000` millicents = 12 cents per IP. ## Timestamps Timestamps are ISO 8601 strings in UTC, with a `Z` suffix and optional fractional seconds: ```json { "created_at": "2026-11-27T10:04:24.239082Z", "expires_at": "2026-12-27T10:04:24.403579Z" } ``` Send timestamps in the same format. For example, `GET .../usage` takes a window as `start` and `end` query parameters: ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/usage?start=2026-11-01T00:00:00Z&end=2026-11-27T23:59:59Z" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ## Country codes Countries use ISO 3166-1 alpha-2 codes in upper case: `DE`, `US`, `GB`, `CN`. Request fields such as `segments[].country` take the code; responses return it as `country` or `country_code`. Use `GET /api/v1/billing/countries` to get the countries that are currently available. ## Pagination List endpoints use **offset pagination**. Pass `offset` (how many items to skip, default `0`) and `limit` (page size). The response contains the items plus `total`, `offset` and `limit`: ```json { "entries": [], "total": 9, "offset": 5, "limit": 5 } ``` | Endpoint | Items field | `limit` default / max | | --- | --- | --- | | `GET /api/v1/customer/services` | `services` | 50 / 100 | | `GET /api/v1/customer/catalog` | `products` | 50 / 100 | | `GET /api/v1/customer/wallet/ledger` | `entries` | 50 / 200 | | `GET /api/v1/customer/me/whmcs-invoices` | `items` | 50 / 200 | | `GET /api/v1/customer/tickets` | `tickets` | 50 | Request the next page with `offset = offset + limit` until `offset >= total`: ```javascript const BASE = 'https://fineproxy.org/account_new/api/v1'; const headers = { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }; const entries = []; for (let offset = 0; ; offset += 200) { const res = await fetch(`${BASE}/customer/wallet/ledger?limit=200&offset=${offset}`, { headers }); if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`); const page = await res.json(); entries.push(...page.entries); if (offset + page.limit >= page.total) break; } console.log(`${entries.length} ledger entries`); ``` ```python import os import requests BASE = "https://fineproxy.org/account_new/api/v1" headers = {"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"} entries, offset = [], 0 while True: page = requests.get( f"{BASE}/customer/wallet/ledger", params={"limit": 200, "offset": offset}, headers=headers, timeout=30, ) page.raise_for_status() data = page.json() entries.extend(data["entries"]) offset += data["limit"] if offset >= data["total"]: break print(f"{len(entries)} ledger entries") ``` Webhook deliveries are the exception: `GET /api/v1/customer/webhooks/{endpoint_id}/deliveries` takes only `limit` (default and maximum `50`) and returns a plain array. There is no cursor pagination in the API. ## CORS and browser use The API is meant to be called from servers, scripts and agents — not from web pages. CORS preflight responses allow only the FineProxy dashboard origin (`https://fineproxy.org`), so browser requests from your own site are blocked. Keep API keys on the server side. If your web app needs FineProxy data, call the API from your backend and expose only what the user needs. ## Request IDs Every response carries an `x-request-id` header with a unique hexadecimal ID: ```text x-request-id: 0123456789abcdef0123456789abcdef ``` Log it together with the status code for every failed request. When you contact support about a specific call, include the request ID — it identifies the request without sharing your API key. Responses also carry `x-ratelimit-*` headers; see [Rate limits](/developers/docs/rate-limits/). ## Next steps - [Errors](/developers/docs/errors/) — error bodies and status codes. - [Rate limits](/developers/docs/rate-limits/) — headers and backoff. - [Idempotency & price guards](/developers/docs/idempotency/) — retry purchases safely. --- # Errors Source: https://fineproxy.org/developers/docs/errors/ The FineProxy API uses standard HTTP status codes and returns a JSON body for every error. This page shows the shapes you will see, what each status means, which errors are safe to retry and how MCP reports errors differently. ## Error body shapes Every error body is a JSON object. The reason is in one of three places. **String `detail`** — the most common shape. The message is meant for humans and logs: ```json { "detail": "Total order IP count (10) is below the tenant minimum of 100 IPs per order" } ``` **Object `detail` with a machine-readable code** — used for business errors. The code is in `detail.error` (some endpoints use `detail.code`); `detail.message` explains it, and extra fields give context: ```json { "detail": { "error": "GEO_COUNTS_MISMATCH", "requested": 1, "replaced": 100, "message": "geo_counts total (1) must equal the number of IPs being replaced (100)." } } ``` **Top-level `error`** — the cancellation cooldown (`409 SERVICE_CANCEL_COOLDOWN`) returns the code at the top level of the body, together with a `retry_at` timestamp. Validation errors (`422`) often carry only a generic message, without a list of fields: ```json { "detail": "Validation error" } ``` When you get a generic `422`, compare your request with the schema in the [API reference](/developers/docs/api/orders/): check field names, types, required fields and that you did not send unknown fields. > **Note:** Branch your code on the HTTP status and the machine-readable code. Use the message text only for logs — it can change. ## HTTP status codes | Status | Meaning | What to do | | --- | --- | --- | | `400 Bad Request` | The request is well-formed but cannot be processed as sent (for example, `"geo_counts must contain at least one country."`) | Fix the request. Do not retry unchanged. | | `401 Unauthorized` | API key missing, malformed, invalid or revoked | Fix the `Authorization` header or replace the key. See [Authentication](/developers/docs/authentication/). | | `402 Payment Required` | The wallet balance is too low for a paid operation; nothing is charged | Top up the wallet, then retry with the same idempotency key. | | `403 Forbidden` | The action is not allowed for this caller: session-only endpoints (`api_key_management_requires_session`) or a payment gateway that needs identity verification first (`kyc_required`) | Use the dashboard, or follow the instructions in `detail`. Do not retry. | | `404 Not Found` | The object does not exist in your account, the path is unknown, or the endpoint does not apply to this service type (for example, rotating config on a datacenter service) | Check the ID, the path and the service's `product_kind`. | | `405 Method Not Allowed` | Wrong HTTP method; the `Allow` header lists the valid ones | Fix the method. | | `409 Conflict` | The request conflicts with the current state: cancellation cooldown, price confirmation mismatch, idempotency key reused for a different request | Read the code in the body; re-quote, wait or use a new key as appropriate. | | `422 Unprocessable Entity` | Validation failed or a business rule was violated (minimum order size, invalid IP, unknown field) | Fix the request. Do not retry unchanged. | | `429 Too Many Requests` | Rate limit exceeded; body `{"detail": "Too Many Requests"}` | Back off and retry. See [Rate limits](/developers/docs/rate-limits/). | | `503 Service Unavailable` | A dependency is temporarily unavailable (for example, a payment provider) | Retry later with backoff, or choose another option. | ## Business error codes | Code or message | Status | Where | What to do | | --- | --- | --- | --- | | `api_key_management_requires_session` | 403 | `/api/v1/customers/me/api-keys` | Manage keys in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys). | | `kyc_required` | 403 | `POST /api/v1/customer/wallet/deposit/init` | The chosen gateway needs identity verification; `detail.verification_url` points to it. Complete it in the dashboard or choose another gateway. | | `Total order IP count (N) is below the tenant minimum of 100 IPs per order` | 422 | Composite quote, order, auto-plan, add-IPs quote | Order at least 100 IPs in total across all segments. | | `GEO_COUNTS_MISMATCH` | 422 | `POST .../proxy/refresh/quote` | Make `geo_counts` add up to the number of IPs being replaced (`detail.replaced`). | | `SERVICE_CANCEL_COOLDOWN` | 409 | `POST .../cancel` | Self-service cancellation is limited to once every 3 days per account. Wait until `retry_at` or open a support ticket. | | `IDEMPOTENCY_KEY_REUSED` | 409 | `POST /api/v1/billing/composite/order` | The key was already used for a different order. Generate a new key for a new purchase. | | `nowpayments_unavailable` | 503 | Crypto deposit coins and quotes | The crypto gateway is temporarily unavailable. Retry later or use another gateway. | | `Rotating config not available for service ` | 404 | `GET .../proxy/config` | The service is not a rotating plan. Use `GET .../proxy/auth` for datacenter services. | See [Idempotency & price guards](/developers/docs/idempotency/) for the price-confirmation errors returned by purchase endpoints. ## Which errors to retry | Situation | Retry? | | --- | --- | | `429`, `503`, network error, timeout on a `GET` | Yes, with exponential backoff and jitter. | | `429`, `503`, network error, timeout on a `POST` that spends money | Yes, but **only with the same idempotency key** — then a retry cannot charge twice. | | `402` | After topping up the wallet, with the same idempotency key. | | `409 SERVICE_CANCEL_COOLDOWN` | Not before `retry_at`. | | `400`, `401`, `403`, `404`, `405`, `422`, other `409` | No. Change the request first. | A timeout does not mean the request failed: the server may have completed it. For purchases, always retry with the same idempotency key instead of sending a new order. ## Handle errors in code The helpers below normalize the three body shapes into one error object, retry `429` and `503` with backoff, and keep the request ID for support. ```javascript const BASE = 'https://fineproxy.org/account_new/api/v1'; export class FineProxyError extends Error { constructor(status, code, message, requestId, body) { super(`FineProxy ${status}${code ? ` ${code}` : ''}: ${message}`); Object.assign(this, { status, code, requestId, body }); } } function parseError(body) { if (typeof body?.detail === 'string') return { code: null, message: body.detail }; if (body?.detail && typeof body.detail === 'object') { return { code: body.detail.error ?? body.detail.code ?? null, message: body.detail.message ?? JSON.stringify(body.detail) }; } if (body?.error) return { code: body.error, message: body.message ?? body.error }; return { code: null, message: JSON.stringify(body) }; } const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); // Retries only when it is safe: GET requests, or bodies that carry an idempotency key. export async function fineproxy(path, { method = 'GET', body, retries = 4 } = {}) { const safeToRetry = method === 'GET' || Boolean(body?.idempotency_key); for (let attempt = 0; ; attempt++) { let res; try { res = await fetch(`${BASE}${path}`, { method, headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, ...(body ? { 'Content-Type': 'application/json' } : {}), }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(60_000), }); } catch (err) { if (safeToRetry && attempt < retries) { await sleep(1000 * 2 ** attempt + Math.random() * 500); continue; } throw err; } if (res.ok) return res.status === 204 ? null : res.json(); const errBody = await res.json().catch(() => ({})); const { code, message } = parseError(errBody); if ((res.status === 429 || res.status === 503) && safeToRetry && attempt < retries) { await sleep(1000 * 2 ** attempt + Math.random() * 500); continue; } throw new FineProxyError(res.status, code, message, res.headers.get('x-request-id'), errBody); } } ``` ```python import os import random import time import requests BASE = "https://fineproxy.org/account_new/api/v1" class FineProxyError(Exception): def __init__(self, status, code, message, request_id, body): super().__init__(f"FineProxy {status}{' ' + code if code else ''}: {message}") self.status, self.code, self.request_id, self.body = status, code, request_id, body def parse_error(body): detail = body.get("detail") if isinstance(body, dict) else None if isinstance(detail, str): return None, detail if isinstance(detail, dict): return detail.get("error") or detail.get("code"), detail.get("message") or str(detail) if isinstance(body, dict) and body.get("error"): return body["error"], body.get("message") or body["error"] return None, str(body) def fineproxy(path, method="GET", body=None, retries=4): """Retries only when it is safe: GET requests, or bodies that carry an idempotency key.""" safe_to_retry = method == "GET" or bool(body and body.get("idempotency_key")) for attempt in range(retries + 1): try: res = requests.request( method, f"{BASE}{path}", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json=body, timeout=60, ) except requests.RequestException: if safe_to_retry and attempt < retries: time.sleep(2 ** attempt + random.random() / 2) continue raise if res.ok: return None if res.status_code == 204 else res.json() try: err_body = res.json() except ValueError: err_body = {} code, message = parse_error(err_body) if res.status_code in (429, 503) and safe_to_retry and attempt < retries: time.sleep(2 ** attempt + random.random() / 2) continue raise FineProxyError(res.status_code, code, message, res.headers.get("x-request-id"), err_body) ``` Use it like this: ```javascript try { const quote = await fineproxy('/billing/composite/quote', { method: 'POST', body: { segments: [{ country: 'DE', count: 10 }], period_months: 1 }, }); } catch (err) { if (err instanceof FineProxyError && err.status === 422) { console.error('Fix the request:', err.message, 'request id:', err.requestId); } else { throw err; } } ``` ```python try: quote = fineproxy( "/billing/composite/quote", method="POST", body={"segments": [{"country": "DE", "count": 10}], "period_months": 1}, ) except FineProxyError as err: if err.status == 422: print("Fix the request:", err, "request id:", err.request_id) else: raise ``` With 10 IPs the quote fails with the tenant-minimum `422`; with 100 IPs it succeeds. ## MCP errors The MCP server reports errors at three levels: - **Transport errors** are real HTTP statuses: `401` with `WWW-Authenticate: Bearer` for a missing or invalid key, and `429` with `{"detail": "Too Many Requests"}` on bursts. Handle them like REST errors. - **Tool errors** — invalid arguments, business rules, price mismatches, cooldowns — come back as **HTTP 200** with `result.isError: true` and a text explanation in `result.content[0].text`. For example, `cancel_service` during the cooldown returns text that starts with `SERVICE_CANCEL_COOLDOWN:`. - **Protocol errors** — an unknown JSON-RPC method or a batch request — come back as a JSON-RPC `error` object (for example, code `-32601` or `-32600`). Always check `result.isError` before reading a tool result. See [MCP protocol details](/developers/docs/mcp/protocol/). ## Next steps - [Rate limits](/developers/docs/rate-limits/) — avoid `429`. - [Idempotency & price guards](/developers/docs/idempotency/) — retry purchases without double charges. - [Conventions](/developers/docs/conventions/) — request IDs, money and pagination. --- # Rate limits Source: https://fineproxy.org/developers/docs/rate-limits/ The FineProxy API limits how fast you can send requests. This page explains the rate-limit headers, the pace that works in practice, and how to back off when you hit `429 Too Many Requests`. ## Rate-limit headers Every REST response carries three rate-limit headers and a request ID: | Header | Example | Meaning | | --- | --- | --- | | `x-ratelimit-limit` | `600` | Requests allowed in the current window | | `x-ratelimit-remaining` | `536` | Requests left in the current window | | `x-ratelimit-reset` | `1795772660` | When the window resets, as a Unix timestamp in seconds | | `x-request-id` | `0123456789abcdef0123456789abcdef` | ID of this request — include it when you contact support | Read the headers from any response: ```bash curl -s -D - -o /dev/null https://fineproxy.org/account_new/api/v1/customer/wallet/balance \ -H "Authorization: Bearer $FINEPROXY_API_KEY" | grep -i '^x-' ``` ## Practical limits Besides the window budget, the API rejects short bursts. In practice, sending more than about **2 requests per second** returns: ```json { "detail": "Too Many Requests" } ``` with status `429`. Design your integration around these rules: - Keep a steady pace of **at most 2 requests per second**. - If several workers, scripts or AI agents use the same API key, pace them together rather than each on its own. - Watch `x-ratelimit-remaining`; when it approaches zero, wait until `x-ratelimit-reset`. - Treat `429` as a normal, recoverable response: back off and retry. ## Back off with jitter When you get a `429` (or a `503`), wait before retrying and increase the delay on each attempt. Add random jitter so that parallel workers do not retry in lockstep. If the window is exhausted (`x-ratelimit-remaining: 0`), wait until `x-ratelimit-reset` instead. ```javascript const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); function retryDelayMs(res, attempt) { const remaining = Number(res.headers.get('x-ratelimit-remaining')); const reset = Number(res.headers.get('x-ratelimit-reset')); if (remaining === 0 && reset) { const untilReset = reset * 1000 - Date.now(); if (untilReset > 0) return untilReset + Math.random() * 1000; } const base = Math.min(30_000, 1000 * 2 ** attempt); // 1 s, 2 s, 4 s ... capped at 30 s return base / 2 + Math.random() * (base / 2); } export async function fetchWithBackoff(url, options = {}, maxRetries = 5) { for (let attempt = 0; ; attempt++) { const res = await fetch(url, { ...options, headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, ...options.headers }, }); if ((res.status !== 429 && res.status !== 503) || attempt >= maxRetries) return res; await sleep(retryDelayMs(res, attempt)); } } ``` ```python import os import random import time import requests def retry_delay(res, attempt): remaining = res.headers.get("x-ratelimit-remaining") reset = res.headers.get("x-ratelimit-reset") if remaining == "0" and reset: until_reset = int(reset) - time.time() if until_reset > 0: return until_reset + random.random() base = min(30, 2 ** attempt) # 1 s, 2 s, 4 s ... capped at 30 s return base / 2 + random.random() * base / 2 def request_with_backoff(method, url, max_retries=5, **kwargs): headers = {"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}", **kwargs.pop("headers", {})} for attempt in range(max_retries + 1): res = requests.request(method, url, headers=headers, timeout=60, **kwargs) if res.status_code not in (429, 503) or attempt == max_retries: return res time.sleep(retry_delay(res, attempt)) ``` > **Important:** Retry a `POST` that spends money only if it carries an idempotency key, and reuse the same key on every attempt. See [Idempotency & price guards](/developers/docs/idempotency/). ## Pace requests Backoff handles occasional `429`s; a pacer prevents them. The simplest pacer enforces a minimum interval between requests from one process: ```javascript const MIN_INTERVAL_MS = 500; // 2 requests per second let nextSlot = 0; export async function paced(fn) { const now = Date.now(); const wait = Math.max(0, nextSlot - now); nextSlot = Math.max(now, nextSlot) + MIN_INTERVAL_MS; if (wait) await new Promise((resolve) => setTimeout(resolve, wait)); return fn(); } // await paced(() => fetchWithBackoff(url)); ``` ```python import threading import time MIN_INTERVAL = 0.5 # 2 requests per second _lock = threading.Lock() _next_slot = 0.0 def paced(fn, *args, **kwargs): global _next_slot with _lock: now = time.monotonic() wait = max(0.0, _next_slot - now) _next_slot = max(now, _next_slot) + MIN_INTERVAL if wait: time.sleep(wait) return fn(*args, **kwargs) # paced(request_with_backoff, "GET", url) ``` ## Reduce the number of requests - **Use large pages.** List endpoints accept `limit` up to 100 (services, catalog) or 200 (ledger). One request with `limit=200` replaces many small ones. See [Pagination](/developers/docs/conventions/#pagination). - **Order mixes in one call.** A composite order takes several country segments at once; you do not need one order per country. - **Swap allowlist entries atomically.** `POST .../proxy/whitelist/replace` changes an IP in one call instead of a delete plus an add. - **Cache what rarely changes.** Proxy IPs, credentials and endpoints change only when you refresh or add IPs, or rotate credentials — read them once and reuse them. - **Use webhooks instead of polling** for wallet and payment events. See [Webhooks](/developers/docs/api/webhooks/). - **Poll slowly when you must.** A new datacenter order can have its IPs active within seconds; poll `GET /api/v1/customer/services/{service_id}` every few seconds, not in a tight loop. ## MCP rate limits The MCP endpoint is rate-limited too. Bursts — for example, many `initialize` calls in a row, or several agents calling tools in parallel with the same key — return HTTP `429` with `{"detail": "Too Many Requests"}`. This is a transport-level HTTP error, not a JSON-RPC error or a tool result with `isError`. If you build your own MCP client, apply the same backoff as for REST. If an AI client reports `429`, wait a few seconds and ask the agent to continue. See [MCP protocol details](/developers/docs/mcp/protocol/). ## Next steps - [Errors](/developers/docs/errors/) — the full list of statuses and what to do. - [Idempotency & price guards](/developers/docs/idempotency/) — make retries safe. --- # Idempotency & price guards Source: https://fineproxy.org/developers/docs/idempotency/ Requests that spend money must be safe to retry and must never charge more than you expect. FineProxy gives you two tools for that: **idempotency keys**, which make a retry return the original result instead of buying again, and **price guards**, which reject a purchase when the actual price differs from the price you confirmed. ## Why you need both - **Networks fail.** A request can time out after the server has already charged the wallet. Without an idempotency key, a retry would buy a second service. - **Prices move.** Quotes are non-binding (`"binding": false`): stock, volume tiers and discounts can change between the quote and the order. A price guard makes the order fail instead of charging a different amount. When a guard rejects a request, nothing is charged. ## Money operations at a glance | Operation | Idempotency | Price guard | | --- | --- | --- | | MCP `order_composite`, `order_dedicated` | `idempotency_key` (required) | `expected_total_cents` | | MCP `add_ips` | `idempotency_key` (required) | `expected_charge_cents` | | MCP `refresh_ips` | `idempotency_key` (required) | `expected_amount_cents` (`0` = expected free) | | MCP `purchase_addon` | `idempotency_key` (required) | `expected_price_cents` (required) | | REST `POST /api/v1/customer/services` (catalog products such as rotating plans) | `params.client_idempotency_key` | `expected_price_cents` | | REST `POST /api/v1/billing/composite/order` | `idempotency_key` | **None** — see [below](#rest-composite-orders) | | REST `POST /api/v1/billing/services/{service_id}/add-ips` | `idempotency_key` (required) | `expected_charge_cents` | | REST `POST /api/v1/billing/services/{service_id}/addons` | `idempotency_key` (required) | `expected_price_cents` | | REST `POST /api/v1/customer/services/{service_id}/proxy/refresh` | `idempotency_key` (required) | — (preview the price with `POST .../proxy/refresh/quote`) | | REST `POST /api/v1/customer/services/{service_id}/renew` | `idempotency_key` in the body or the `Idempotency-Key` header | — | | REST `POST /api/v1/customer/wallet/deposit/init`, MCP `init_deposit` | `idempotency_key` | — (a deposit only creates a checkout link) | All guard values are integer cents. Exact parameters are in the [API reference](/developers/docs/api/orders/) and the [MCP tools reference](/developers/docs/mcp/tools/). ## Quote, then order Every safe purchase follows the same three steps: 1. **Quote.** Ask for the price of exactly what you want to buy. 2. **Confirm.** Compare the quoted total with your budget (or show it to a human) and check the wallet balance. 3. **Order** with the same parameters, a fresh idempotency key and the quoted total as the price guard. For a composite datacenter order through MCP, the quote is `quote_composite`: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "quote_composite", "arguments": { "segments": [{ "country": "DE", "count": 100 }], "period_months": 1 } } } ``` The result contains the price in cents — 100 IPs × 1 month = 1200 cents ($12.00): ```json { "binding": false, "segments": [{ "country_code": "DE", "count": 100, "unit_base_cents": 12, "segment_price_cents": 1200, "available": true }], "errors": [], "total_ip": 100, "total_price_cents": 1200, "monthly_price_cents": 1200, "period_months": 1 } ``` Then order with the same segments and pass `total_price_cents` as `expected_total_cents`: ```json { "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "order_composite", "arguments": { "segments": [{ "country": "DE", "count": 100 }], "period_months": 1, "whitelist_ips": ["203.0.113.10"], "idempotency_key": "order-7f3c2a9e-5b1d-4c8e-9a0f-2d6b8e4c1a37", "expected_total_cents": 1200, "auto_renew": false } } } ``` `whitelist_ips` must contain at least one IPv4 address: the machine that will connect to the proxies. See the [buy proxies guide](/developers/docs/guides/buy-proxies/) for the full flow. ## MCP price guards `order_composite` and `order_dedicated` compare `expected_total_cents` with a fresh server-side quote before charging: - **Match** — the order is placed and the wallet is debited by exactly that amount. - **Mismatch** — the tool returns `isError: true` and nothing is charged: ```text Invalid arguments: Price mismatch: expected_total_cents=1199, actual quote is 1200 cents. Nothing was charged. ``` On a mismatch, quote again, confirm the new price and order with the new value. `expected_total_cents` is optional in the tool schema, but always send it — it is what protects you from a price change between quote and order. The other money tools work the same way: `add_ips` checks `expected_charge_cents`, `refresh_ips` checks `expected_amount_cents` and `purchase_addon` checks `expected_price_cents`. ## MCP idempotency keys Every MCP money tool requires an `idempotency_key` that identifies one purchase intent: - **Same key again** — returns the original result without a second charge. For `order_composite`, a replay returns the same `service_id` with `"balance_applied_cents": 0`, and the wallet balance does not change. - **New key** — a new purchase, even if the parameters are identical to an earlier one. So: one key per thing you want to buy, reused for every retry of that purchase. ## REST rotating plans and catalog products `POST /api/v1/customer/services` buys a fixed catalog product, such as a rotating proxy plan. Pass the product price from the catalog as `expected_price_cents`: ```bash curl -X POST https://fineproxy.org/account_new/api/v1/customer/services \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "product_id": "00000000-0000-0000-0000-000000000000", "expected_price_cents": 3500, "auto_renew": false, "params": { "client_idempotency_key": "rotating-2026-11-27-0001" } }' ``` - For billing-only products, `expected_price_cents` is required: a mismatch or a missing value returns `409` before any wallet debit. - `params` accepts only `whitelist_ips`, `billing_period_months` and `client_idempotency_key`; any other key returns `422` before any debit. - Repeating the call with the same product and params returns the existing service without charging again. A successful purchase returns `201 Created` with the new `service`. ## REST composite orders `POST /api/v1/billing/composite/order` (datacenter and ISP mixes) has **no price-guard field**. The request schema is strict, so adding `expected_total_cents` does not protect you — it is rejected with `422 {"detail": "Validation error"}` and nothing is charged. The endpoint does support `idempotency_key`: - A new key buys a new service, even if an identical one exists. - The same key replays the service it created, without a second charge. - The same key with a different order returns `409 IDEMPOTENCY_KEY_REUSED`. - Without a key, an identical live order (same owner and segments) returns the existing service instead of charging again. To stay safe with REST composite orders: 1. Call `POST /api/v1/billing/composite/quote` **immediately** before ordering, with exactly the same `segments`, `period_months` and options. 2. Refuse to order if `total_price_cents` exceeds your budget or if `errors` is not empty. 3. Send the order with a fresh `idempotency_key` and the same parameters. Set `"use_balance": true` to pay from the wallet; check `payment_required` and `amount_due_cents` in the response. 4. Compare `total_price_cents` in the order response with the quote, and alert on any difference. > **Important:** If you need a hard guarantee that you never pay more than the quoted total, place composite orders through the MCP tool [`order_composite`](/developers/docs/mcp/tools/#order_composite) with `expected_total_cents`. ## Generate idempotency keys - Use a random UUID per purchase intent, optionally with a readable prefix: `order-7f3c2a9e-...`. - Generate the key **once**, when you decide to buy, and store it with your own order record **before** sending the request. A key that exists only in memory is lost on a crash, and the retry would become a new purchase. - Keep keys within 128 characters. - Never reuse a key for a different purchase. ```javascript import { randomUUID } from 'node:crypto'; const idempotencyKey = `order-${randomUUID()}`; ``` ```python import uuid idempotency_key = f"order-{uuid.uuid4()}" ``` ## Retries and timeouts | What happened | What to do | | --- | --- | | Timeout or network error, no response | Retry with the **same** key and the same body. You get either the original result or a fresh, single execution. | | `429` or `503` | Back off and retry with the same key. See [Rate limits](/developers/docs/rate-limits/). | | Price mismatch (MCP `isError`, REST `409`) | Nothing was charged. Quote again, confirm, and order with the new price. | | `402` insufficient funds | Nothing was charged. Top up, then retry with the same key. | | `409 IDEMPOTENCY_KEY_REUSED` | You reused a key for a different order. Check your key generation; use a new key only if this really is a new purchase. | | `422` validation error | Fix the request. Nothing was charged. | After an uncertain outcome, you can also check what happened before retrying: list your services (`GET /api/v1/customer/services`) and the wallet ledger (`GET /api/v1/customer/wallet/ledger`), where every debit appears with its `service_id`. ## Next steps - [Buy proxies with the API](/developers/docs/guides/buy-proxies/) — the complete purchase flow. - [Errors](/developers/docs/errors/) — status codes and error bodies. - [Authentication](/developers/docs/authentication/#scopes) — limit `wallet:spend` to the keys that need it. --- # Connect to datacenter proxies Source: https://fineproxy.org/developers/docs/proxies/datacenter/ This page shows how to turn a datacenter proxy service into working proxy connections: read its IPs and credentials from the API, pick a protocol and port, and connect from curl, Python or Node.js. ## How a service maps to proxies A datacenter service is a set of dedicated IPv4 addresses — for example, 100 IPs in Germany. **Each IP is its own proxy endpoint**: you connect to the IP you want your traffic to exit from. All IPs of a service share: - one username and password; - the same set of ports and protocols; - one IP allowlist. You need the service ID (UUID) from `GET /api/v1/customer/services`. The examples below use `$SERVICE_ID`. ## Get the IPs ```bash curl https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/ips \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` The response lists every IP of the service with its country: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "ips": [ { "ip": "203.0.113.10", "country": "DE", "type": "socks5", "site": "nyc-1" }, { "ip": "203.0.113.11", "country": "DE", "type": "socks5", "site": "nyc-1" } ], "geo_source": "maxmind" } ``` Use `ip` as the proxy host. Every IP accepts all protocols listed by `proxy/auth` below, whatever the `type` field says. ## Get credentials and endpoints `GET .../proxy/auth` returns the username, the ports and the allowlist. The password is masked by default; add `reveal=true` to receive it in plain text. ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/auth?reveal=true" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const res = await fetch( `https://fineproxy.org/account_new/api/v1/customer/services/${process.env.SERVICE_ID}/proxy/auth?reveal=true`, { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` } }, ); if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`); const auth = await res.json(); console.log(auth.username, auth.endpoints.map((e) => `${e.protocol}:${e.port ?? '-'}/${e.port_whitelist}`)); ``` ```python import os import requests res = requests.get( f"https://fineproxy.org/account_new/api/v1/customer/services/{os.environ['SERVICE_ID']}/proxy/auth", params={"reveal": "true"}, headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) res.raise_for_status() auth = res.json() print(auth["username"], [(e["protocol"], e.get("port"), e["port_whitelist"]) for e in auth["endpoints"]]) ``` Example response: ```json { "username": "fine_0123456789ab", "password": "your_proxy_password", "protocols": ["socks5", "http", "https"], "endpoints": [ { "protocol": "socks5", "label": "SOCKS5", "scheme": "socks5", "port": 1080, "port_whitelist": 1085, "http2": false, "udp": true, "noauth_only": false }, { "protocol": "http", "label": "HTTP", "scheme": "http", "port": 8080, "port_whitelist": 8085, "http2": false, "udp": false, "noauth_only": false }, { "protocol": "https", "label": "HTTPS (HTTP/2)", "scheme": "https", "port": 8443, "port_whitelist": 8444, "http2": true, "udp": false, "noauth_only": false, "hostname_template": "net-{ip_dashed}.mcccx.com" }, { "protocol": "socks4", "label": "SOCKS4", "scheme": "socks4", "port_whitelist": 1087, "http2": false, "udp": false, "noauth_only": true }, { "protocol": "https_993", "label": "HTTP/2 (port 993, DPI bypass)", "scheme": "https", "port_whitelist": 993, "http2": true, "udp": false, "noauth_only": true, "hostname_template": "net-{ip_dashed}.mcccx.com" } ], "whitelist_ips": ["198.51.100.7"], "password_set": true, "udp_enabled": false } ``` | Field | Meaning | | --- | --- | | `username`, `password` | Login and password for the login/password ports. `password` is returned only with `reveal=true`; otherwise check `password_set`. | | `endpoints[].protocol`, `label`, `scheme` | Protocol identifier, human-readable name and URL scheme to use in proxy URLs | | `endpoints[].port` | Port for login/password authentication. Absent when `noauth_only` is `true`. | | `endpoints[].port_whitelist` | Port for IP allowlist authentication (no credentials) | | `endpoints[].noauth_only` | `true` if the protocol works only through the allowlist | | `endpoints[].http2` | The proxy speaks HTTP/2 over TLS on this endpoint | | `endpoints[].udp` | The protocol can carry UDP; `udp_enabled` shows whether UDP is enabled on your service | | `endpoints[].hostname_template` | Hostname to connect to instead of the bare IP; replace `{ip_dashed}` with the IP, dots replaced by dashes | | `whitelist_ips` | IPs currently on the allowlist | > **Important:** The password gives full proxy access. Request `reveal=true` only where you need it, and never log the response. ## Ports and protocols | Protocol | Login/password port | Allowlist port | Notes | | --- | --- | --- | --- | | SOCKS5 | 1080 | 1085 | Use remote DNS (`socks5h://`, `--socks5-hostname`) | | HTTP | 8080 | 8085 | Standard HTTP proxy | | HTTPS (HTTP/2) | 8443 | 8444 | TLS to the proxy; connect to the `hostname_template` name, not the IP | | SOCKS4 | — | 1087 | Allowlist only | | HTTP/2 on port 993 | — | 993 | Allowlist only; for networks with deep packet inspection (DPI); uses `hostname_template` | These are the ports returned today. Build connections from `endpoints[]` instead of hardcoding them. For the HTTPS endpoints, the TLS certificate is issued for the `hostname_template` name. For the IP `203.0.113.10`, connect to `net-203-0-113-10.mcccx.com`. ## Choose an authentication method Each protocol has two ports, one per authentication method: - **Login and password** (`port`) — send the username and password with every connection. Works from any network; best for servers with changing IPs, laptops and CI. - **IP allowlist** (`port_whitelist`) — no credentials; the proxy accepts connections only from IPs on the service's allowlist. Best for fixed servers and for tools that cannot send proxy credentials. SOCKS4 and HTTP/2 on port 993 work only this way. New orders require at least one allowlist IP, so the allowlist ports work right after purchase from the machine you listed. To manage entries, see [Manage the IP allowlist](/developers/docs/guides/ip-allowlist/). ## Connect with curl The examples use these variables: ```bash export PROXY_USER="fine_0123456789ab" export PROXY_PASS="your_proxy_password" export PROXY_IP="203.0.113.10" ``` SOCKS5 with login and password. `--socks5-hostname` resolves the target hostname on the proxy side: ```bash curl --socks5-hostname "$PROXY_USER:$PROXY_PASS@$PROXY_IP:1080" https://api.ipify.org ``` HTTP proxy with login and password: ```bash curl -x "http://$PROXY_USER:$PROXY_PASS@$PROXY_IP:8080" https://api.ipify.org ``` HTTPS proxy (TLS to the proxy) — use the hostname from `hostname_template`: ```bash curl -x "https://$PROXY_USER:$PROXY_PASS@net-203-0-113-10.mcccx.com:8443" https://api.ipify.org ``` SOCKS5 through the IP allowlist — no credentials, from an allowlisted machine: ```bash curl --socks5-hostname "$PROXY_IP:1085" https://api.ipify.org ``` Each command prints the proxy IP — the address your traffic exits from. > **Note:** If your password contains characters such as `@`, `:` or `/`, URL-encode it in proxy URLs. ## Connect from code Python uses `requests`; SOCKS support needs the extra: `pip install "requests[socks]"`. Use the `socks5h://` scheme so that DNS is resolved by the proxy. Node.js uses [`undici`](https://www.npmjs.com/package/undici) for HTTP proxies and [`socks-proxy-agent`](https://www.npmjs.com/package/socks-proxy-agent) for SOCKS5. HTTP proxy: ```javascript // npm install undici import { fetch, ProxyAgent } from 'undici'; const { PROXY_USER, PROXY_PASS, PROXY_IP } = process.env; const dispatcher = new ProxyAgent({ uri: `http://${PROXY_IP}:8080`, token: `Basic ${Buffer.from(`${PROXY_USER}:${PROXY_PASS}`).toString('base64')}`, }); const res = await fetch('https://api.ipify.org', { dispatcher }); console.log(await res.text()); ``` ```python import os from urllib.parse import quote import requests user, password, ip = os.environ["PROXY_USER"], os.environ["PROXY_PASS"], os.environ["PROXY_IP"] proxy = f"http://{quote(user, safe='')}:{quote(password, safe='')}@{ip}:8080" res = requests.get("https://api.ipify.org", proxies={"http": proxy, "https": proxy}, timeout=30) print(res.text) ``` SOCKS5: ```javascript // npm install socks-proxy-agent import https from 'node:https'; import { SocksProxyAgent } from 'socks-proxy-agent'; const { PROXY_USER, PROXY_PASS, PROXY_IP } = process.env; const agent = new SocksProxyAgent( `socks5h://${encodeURIComponent(PROXY_USER)}:${encodeURIComponent(PROXY_PASS)}@${PROXY_IP}:1080`, ); https.get('https://api.ipify.org', { agent }, (res) => { res.setEncoding('utf8'); res.on('data', (chunk) => process.stdout.write(chunk)); }); ``` ```python # pip install "requests[socks]" import os from urllib.parse import quote import requests user, password, ip = os.environ["PROXY_USER"], os.environ["PROXY_PASS"], os.environ["PROXY_IP"] proxy = f"socks5h://{quote(user, safe='')}:{quote(password, safe='')}@{ip}:1080" res = requests.get("https://api.ipify.org", proxies={"http": proxy, "https": proxy}, timeout=30) print(res.text) ``` To spread load across the service, keep the IP list from `GET .../proxy/ips` and pick a different `ip` per connection or per worker; the credentials and ports stay the same. ## Change the proxy password Rotate the password when it may have leaked or when someone should lose access: ```bash curl -X PUT https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/auth \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"rotate_password": true}' ``` The response contains the new password — it is returned only once, so store it right away (you can read it again later with `GET .../proxy/auth?reveal=true`). The old password stops working — possibly after a short delay while the change reaches all proxies — so update your clients right away. Through MCP, the same action is the `rotate_proxy_credentials` tool. Both require the `services:write` scope. ## Troubleshooting | Symptom | Likely cause and fix | | --- | --- | | `407 Proxy Authentication Required`, SOCKS5 authentication failure | Wrong username or password, or the password was rotated. Read the current credentials with `GET .../proxy/auth?reveal=true`. URL-encode special characters. | | Timeout or connection refused on `1085`, `8085`, `8444`, `1087` or `993` | Allowlist ports accept only allowlisted IPs. Check your current public IP (MCP tool `get_my_ip`) and compare it with `GET .../proxy/whitelist`. Behind NAT, a VPN or a cloud load balancer, your outgoing IP may differ from what you expect. | | Credentials rejected on an allowlist port | Allowlist ports do not take credentials. Use `port` for login/password and `port_whitelist` for the allowlist. | | TLS or certificate error on `8443` | Connect to `net-.mcccx.com` from `hostname_template`, not to the bare IP. | | Timeouts from a cloud server or another datacenter | Some hosting providers filter outgoing connections to non-standard ports. Test the same command from another network; if it works there, ask your provider to allow outbound traffic to the proxy ports. | | Everything fails for a service that used to work | Check `status` in `GET /api/v1/customer/services/{service_id}`: an expired, suspended or cancelled service may still list its IPs, but connections fail. | For per-service error statistics, use the MCP tool `get_diagnostics`, which breaks failed requests down by cause. ## Next steps - [Manage the IP allowlist](/developers/docs/guides/ip-allowlist/) — connect without credentials. - [Rotating proxies](/developers/docs/proxies/rotating/) — gateway-based proxies with a request quota. - [Proxy access API reference](/developers/docs/api/proxy-access/) — every endpoint used on this page. --- # Connect to rotating proxies Source: https://fineproxy.org/developers/docs/proxies/rotating/ A rotating proxy plan gives you a gateway instead of a fixed list of IPs: you connect to one host and port, and the exit IP is chosen from a pool. This page shows how to read the connection settings from the API, connect, use sticky sessions and track your quota. ## How rotating plans work - A rotating plan is a catalog product with `product_kind: proxy_rotating`, bought with `POST /api/v1/customer/services` — see [Idempotency & price guards](/developers/docs/idempotency/#rest-rotating-plans-and-catalog-products). - The plan includes a quota of **requests** (also called credits): for example, "Rotating Proxies 2.5M Credits" includes 2,500,000 requests for a 30-day period. - You connect to a **gateway host** with the plan's username and password. The gateway has regular ports for rotating connections and **sticky ports** that keep the same exit IP for a session. The rotating-specific endpoints — `GET .../proxy/config` and the sticky-session endpoints — work only for rotating services. For a datacenter service they return `404`, for example `{"detail": "Rotating config not available for service "}`. ## Get the connection config ```bash curl https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/config \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Example response: ```json { "endpoint": "fineproxy.xyz", "endpoints": ["fineproxy.xyz"], "https_endpoints": ["eu01.mcccx.com", "us01.mcccx.com"], "port": 3081, "http_ports": [3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094], "socks_ports": [2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094], "sticky_http": 5080, "sticky_socks5": 4080, "sticky_https": 4443, "session_format": "ip:port:username:password", "mode": "sticky", "sample_connection_string": "fineproxy.xyz:3081:USER:********", "sample_connection_strings": ["fineproxy.xyz:3081:USER:********"] } ``` | Field | Meaning | | --- | --- | | `endpoint` | Primary gateway host (the first entry of `endpoints`) | | `endpoints` | All gateway entry hosts for HTTP and SOCKS5 connections | | `https_endpoints` | Regional hosts for HTTPS connections; in the example they are also the sticky hosts | | `port` | Primary HTTP port (the first entry of `http_ports`) | | `http_ports` | HTTP proxy ports on the gateway hosts | | `socks_ports` | SOCKS5 proxy ports on the gateway hosts | | `sticky_http`, `sticky_socks5`, `sticky_https` | Sticky-session ports for HTTP, SOCKS5 and HTTPS | | `session_format` | Order of the parts in a connection string: `host:port:username:password` | | `mode` | Current session mode of the plan (`sticky` by default) | | `sample_connection_string(s)` | Ready-made connection strings with the password masked | > **Important:** Hosts and ports depend on your plan and can change. Always read them from `proxy/config` instead of hardcoding the values shown here. ## Get the username and password The config does not include credentials. Read them from `GET .../proxy/auth`, adding `reveal=true` to get the password in plain text: ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/auth?reveal=true" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` For a rotating service, the response contains `username`, `password` and a `rotating_gateway` object that repeats the gateway layout, including `entry_hosts`, `https_hosts` and `sticky_hosts`: ```json { "username": "PPR0123456789", "password": "your_proxy_password", "password_set": true, "rotating_gateway": { "entry_hosts": ["fineproxy.xyz"], "https_hosts": ["eu01.mcccx.com", "us01.mcccx.com"], "sticky_hosts": ["eu01.mcccx.com", "us01.mcccx.com"], "entry_host": "fineproxy.xyz", "https_host": "eu01.mcccx.com", "http_ports": [3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094], "socks_ports": [2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094], "sticky_http": 5080, "sticky_socks5": 4080, "sticky_https": 4443 } } ``` The response also contains `endpoints[]` and other fields shared with datacenter services; they are trimmed here. You can rotate the password with `PUT .../proxy/auth` and `{"rotate_password": true}`, as for [datacenter proxies](/developers/docs/proxies/datacenter/#change-the-proxy-password). ## Connect Build the proxy URL from the config and the credentials. The connection string format is `host:port:username:password`, so the config's sample `fineproxy.xyz:3081:USER:********` becomes the proxy URL `http://USER:PASSWORD@fineproxy.xyz:3081`. | Connection | Host | Port | | --- | --- | --- | | HTTP, rotating | `endpoint` (or any of `endpoints`) | `port` (or any of `http_ports`) | | SOCKS5, rotating | `endpoint` (or any of `endpoints`) | one of `socks_ports` | | HTTP, sticky | one of the sticky hosts (`rotating_gateway.sticky_hosts`) | `sticky_http` | | SOCKS5, sticky | one of the sticky hosts | `sticky_socks5` | | HTTPS, sticky | one of the sticky hosts | `sticky_https` | With the values from the example, and the host and port taken from your own config: ```bash export PROXY_USER="PPR0123456789" export PROXY_PASS="your_proxy_password" export GATEWAY_HOST="fineproxy.xyz" # proxy/config → endpoint export GATEWAY_PORT="3081" # proxy/config → port curl -x "http://$PROXY_USER:$PROXY_PASS@$GATEWAY_HOST:$GATEWAY_PORT" https://api.ipify.org ``` For SOCKS5, use a port from `socks_ports` and remote DNS: ```bash curl --socks5-hostname "$PROXY_USER:$PROXY_PASS@$GATEWAY_HOST:2081" https://api.ipify.org ``` In code, read everything from the API at startup: ```javascript // npm install undici import { fetch, ProxyAgent } from 'undici'; const API = `https://fineproxy.org/account_new/api/v1/customer/services/${process.env.SERVICE_ID}`; const headers = { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }; const getJson = async (url) => { const res = await fetch(url, { headers }); if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`); return res.json(); }; const config = await getJson(`${API}/proxy/config`); const auth = await getJson(`${API}/proxy/auth?reveal=true`); const dispatcher = new ProxyAgent({ uri: `http://${config.endpoint}:${config.port}`, token: `Basic ${Buffer.from(`${auth.username}:${auth.password}`).toString('base64')}`, }); const res = await fetch('https://api.ipify.org', { dispatcher }); console.log(await res.text()); ``` ```python import os from urllib.parse import quote import requests API = f"https://fineproxy.org/account_new/api/v1/customer/services/{os.environ['SERVICE_ID']}" headers = {"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"} def get_json(url, **params): res = requests.get(url, headers=headers, params=params, timeout=30) res.raise_for_status() return res.json() config = get_json(f"{API}/proxy/config") auth = get_json(f"{API}/proxy/auth", reveal="true") proxy = f"http://{quote(auth['username'], safe='')}:{quote(auth['password'], safe='')}@{config['endpoint']}:{config['port']}" res = requests.get("https://api.ipify.org", proxies={"http": proxy, "https": proxy}, timeout=30) print(res.text) ``` For SOCKS5 in Python, install `requests[socks]` and use `socks5h://` with a port from `socks_ports`; in Node.js, use `socks-proxy-agent` as shown for [datacenter proxies](/developers/docs/proxies/datacenter/#connect-from-code). > **Note:** Country targeting or session IDs inside the username are not part of the documented connection format. Use the hosts, ports and connection strings returned by `proxy/config`. ## Sticky sessions On sticky ports the gateway keeps the same exit IP for a session instead of rotating it on every request. The session settings of the plan are available through the API: - `GET .../proxy/sticky/mode` — the session mode; `sticky` by default. - `GET .../proxy/sticky/ttl` — how long a session keeps its exit IP: 900 seconds (15 minutes) by default; you can set your own value (minimum 30 seconds). - `GET .../proxy/sticky/sessions` — active sessions, with endpoints to rotate a single session or purge all of them. ```bash curl https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/ttl \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "ttl_seconds": 900, "is_custom": false, "global_default_ttl": 900, "ttl_human": "15m" } ``` For changing the mode and TTL and managing sessions, see [Sticky sessions](/developers/docs/guides/sticky-sessions/). ## Track usage and quota The plan's quota is stored on the service. `GET /api/v1/customer/services/{service_id}` returns it in `params`: | Field | Meaning | | --- | --- | | `params.quota_kind` | What the quota counts: `requests` | | `params.requests_quota` | Requests included in the current period | | `params.requests_remaining` | Requests left in the current period | | `params.base_remaining_requests`, `params.topup_remaining_requests` | Remaining requests from the plan itself and from top-ups | | `expires_at` | End of the current period | Traffic for a time window comes from `GET .../usage` with ISO 8601 `start` and `end` (requires `usage:read`): ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/usage?start=2026-11-27T00:00:00Z&end=2026-11-27T23:59:59Z" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "connections": 0, "bytes_used": 0, "window": { "start": "2026-11-27T00:00:00Z", "end": "2026-11-27T23:59:59Z" } } ``` A service that runs out of quota is suspended with `suspend_reason: quota_exhausted` until the quota is topped up in the dashboard or the next period's quota is granted. Through MCP, use `get_usage`, `get_usage_overview` and `get_diagnostics` for usage and error analysis. ## Next steps - [Sticky sessions](/developers/docs/guides/sticky-sessions/) — control how long an exit IP is kept. - [Datacenter proxies](/developers/docs/proxies/datacenter/) — dedicated IPs with per-IP endpoints. - [Proxy access API reference](/developers/docs/api/proxy-access/) and [Sticky API reference](/developers/docs/api/sticky/). --- # Buy proxies with the API Source: https://fineproxy.org/developers/docs/guides/buy-proxies/ This guide walks you through a complete purchase: you pick countries, get a price, order the package, wait until the IPs are ready and fetch them. Datacenter and ISP proxies are sold as a **composite** package — a mix of `{country, count}` segments. Rotating plans are fixed catalog products and use a separate, shorter flow. You need an API key with `catalog:read` to browse and quote, plus `services:write` and `wallet:spend` to buy. Purchases are paid from your wallet balance, so check it first with `GET /api/v1/customer/wallet/balance` (see [Wallet and payments](/developers/docs/guides/wallet/)). All examples read the key from `FINEPROXY_API_KEY`: ```bash export FINEPROXY_API_KEY="fb_your_api_key" ``` ## 1. List countries and live stock `GET /api/v1/billing/countries` returns the countries you can order, sorted by available IPs, most stock first. Use the ISO 3166-1 alpha-2 `code` as `country` in quotes and orders. ```bash curl "https://fineproxy.org/account_new/api/v1/billing/countries?product_kind=proxy_datacenter&geo_source=maxmind" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const url = new URL('https://fineproxy.org/account_new/api/v1/billing/countries'); url.searchParams.set('product_kind', 'proxy_datacenter'); const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }, }); const { countries } = await response.json(); console.log(countries.filter((c) => c.available > 0).map((c) => `${c.code}: ${c.available}`)); ``` ```python import os import requests response = requests.get( "https://fineproxy.org/account_new/api/v1/billing/countries", params={"product_kind": "proxy_datacenter"}, headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=60, ) response.raise_for_status() for country in response.json()["countries"]: if country["available"] > 0: print(country["code"], country["available"]) ``` The response (shortened): ```json { "geo_source": "maxmind", "product_kind": "proxy_datacenter", "countries": [ { "code": "US", "name": "United States", "tag_id": 197148, "available": 32452 }, { "code": "GB", "name": "United Kingdom", "tag_id": 197147, "available": 1952 }, { "code": "DE", "name": "Germany", "tag_id": 197153, "available": 1464 }, { "code": "JP", "name": "Japan", "tag_id": 1452361, "available": 0 } ] } ``` | Query parameter | Values | Default | | --- | --- | --- | | `product_kind` | `proxy_datacenter`, `proxy_isp` | `proxy_datacenter` | | `geo_source` | `maxmind` (geolocation) or `ripe` (registry allocation) | `maxmind` | - `available` is live stock. Countries with `0` are listed but cannot be ordered right now. - Pass the same `product_kind` and `geo_source` to the quote and the order. - This call can take around 10 seconds. Cache the result for a few minutes instead of calling it before every quote. Reference: [Get countries](/developers/docs/api/catalog/#get-get-countries). ## 2. Read the pricing terms `GET /api/v1/billing/composite/pricing-info` returns the volume ladder, period discounts and minimums. It is advisory — the quote is the source of truth for the actual price. ```bash curl https://fineproxy.org/account_new/api/v1/billing/composite/pricing-info \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Key fields from a real response: ```json { "volume_tiers": [ { "min_ips": 0, "price_millicents_per_ip": 12000, "label": null }, { "min_ips": 1000, "price_millicents_per_ip": 11100, "label": null } ], "period_discounts": { "1": 0, "3": 10, "6": 15, "12": 20 }, "min_ips_per_segment": 1, "min_ips_per_order": 100, "whitelist_free_quota": 5, "extra_whitelist_ip_price_cents": 100, "free_refresh_days": 8 } ``` | Field | Meaning | | --- | --- | | `min_ips_per_order` | Minimum total IPs per order, summed across all segments: **100**. | | `volume_tiers[].price_millicents_per_ip` | Monthly price per IP in **millicents** (`12000` = 12 cents). Every other price in the API is in cents. | | `period_discounts` | Discount in whole percent per period length in months. You can order 1, 3, 6 or 12 months. | | `whitelist_free_quota` | IP allowlist entries included per service. See [IP allowlist](/developers/docs/guides/ip-allowlist/). | | `free_refresh_days` | Free IP refresh window. See [Manage services](/developers/docs/guides/manage-services/#refresh-replace-ips). | > **Note:** A single segment may be as small as 1 IP, but the order as a whole must reach 100 IPs. A smaller total is rejected with `422` and a plain `detail` string, for example `"Total order IP count (10) is below the tenant minimum of 100 IPs per order"`. Reference: [Composite pricing info](/developers/docs/api/catalog/#get-composite-pricing-info). ## 3. Optional: let the API split the IPs for you If you need "100 IPs, any mix", `POST /api/v1/billing/composite/auto-plan` distributes `total_ip` across countries in proportion to stock. No money is involved. Use `excluded_countries` (ISO codes) to skip countries. ```bash curl -X POST https://fineproxy.org/account_new/api/v1/billing/composite/auto-plan \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"total_ip": 100, "excluded_countries": ["RU"]}' ``` The response contains `segments` (each with `country_code` and `count`) that add up to `total_ip`, plus `countries_used`. Feed the segments, as `{"country": "", "count": }`, straight into the quote. `total_ip` below 100 returns `422`. Reference: [Composite auto plan](/developers/docs/api/orders/#post-composite-auto-plan). ## 4. Get a quote `POST /api/v1/billing/composite/quote` prices a mix. It is free and non-binding (`binding: false`). ```bash curl -X POST https://fineproxy.org/account_new/api/v1/billing/composite/quote \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"segments": [{"country": "DE", "count": 100}], "period_months": 1}' ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/billing/composite/quote', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ segments: [{ country: 'DE', count: 100 }], period_months: 1 }), }); if (!response.ok) throw new Error(`Quote failed ${response.status}: ${await response.text()}`); const quote = await response.json(); console.log(quote.total_price_cents, quote.errors); ``` ```python import os import requests response = requests.post( "https://fineproxy.org/account_new/api/v1/billing/composite/quote", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={"segments": [{"country": "DE", "count": 100}], "period_months": 1}, timeout=30, ) response.raise_for_status() quote = response.json() print(quote["total_price_cents"], quote["errors"]) ``` Response for 100 German IPs for one month: ```json { "snapshot_version": "00000000-0000-0000-0000-000000000000", "built_at": "2026-11-19T15:32:06.105136Z", "binding": false, "segments": [ { "provider": 2, "country": 197153, "country_code": "DE", "count": 100, "unit_base_cents": 12, "type_multiplier": 1.0, "geo_multiplier": 1.0, "segment_price_cents": 1200, "available": true } ], "errors": [], "total_ip": 100, "total_price_cents": 1200, "unit_base_cents": 12, "period_months": 1, "discount_pct": 0, "volume_discount_pct": 0, "monthly_price_cents": 1200, "promo_discount_cents": 0, "trial": false, "addon_monthly_cents": 0, "extra_whitelist_count": 0, "extra_connections_count": 0, "udp_unlock": false } ``` | Field | Meaning | | --- | --- | | `total_price_cents` | What the order will charge for the whole period: `1200` = $12.00. Equals `monthly_price_cents` × `period_months` minus the period discount. | | `monthly_price_cents` | Undiscounted monthly total (sum of `segment_price_cents`). | | `discount_pct` | Period discount applied (0, 10, 15 or 20). | | `segments[].available` | `false` means that segment cannot be fulfilled right now. | | `errors` | Unavailable or invalid segments. The quote still succeeds; check that this array is empty before ordering. | A mix works the same way: 25 × US + 75 × GB also quoted `1200` cents for one month. Optional body fields: `product_kind` (`proxy_datacenter`, `proxy_isp`), `geo_source`, `promo_code`, and pre-purchase add-ons `extra_whitelist_count`, `extra_connections_count`, `udp_unlock` — their price is included in `monthly_price_cents`. Unknown fields are rejected with `422 {"detail":"Validation error"}`. Reference: [Composite quote](/developers/docs/api/orders/#post-composite-quote). ## 5. Place the order `POST /api/v1/billing/composite/order` charges the wallet and creates one service holding all segments. Send the same segments, period, `product_kind` and `geo_source` that you quoted. ```bash curl -X POST https://fineproxy.org/account_new/api/v1/billing/composite/order \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "segments": [{"country": "DE", "count": 100}], "period_months": 1, "whitelist_ips": ["203.0.113.10"], "use_balance": true, "auto_renew": false, "idempotency_key": "order-de100-2026-11-27-001" }' ``` ```javascript import { randomUUID } from 'node:crypto'; const idempotencyKey = randomUUID(); // store it with your order before sending const response = await fetch('https://fineproxy.org/account_new/api/v1/billing/composite/order', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ segments: [{ country: 'DE', count: 100 }], period_months: 1, whitelist_ips: ['203.0.113.10'], use_balance: true, auto_renew: false, idempotency_key: idempotencyKey, }), }); if (!response.ok) throw new Error(`Order failed ${response.status}: ${await response.text()}`); const order = await response.json(); console.log(order.service_id, order.status, order.balance_applied_cents); ``` ```python import os import uuid import requests idempotency_key = str(uuid.uuid4()) # store it with your order before sending response = requests.post( "https://fineproxy.org/account_new/api/v1/billing/composite/order", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={ "segments": [{"country": "DE", "count": 100}], "period_months": 1, "whitelist_ips": ["203.0.113.10"], "use_balance": True, "auto_renew": False, "idempotency_key": idempotency_key, }, timeout=90, ) response.raise_for_status() order = response.json() print(order["service_id"], order["status"], order["balance_applied_cents"]) ``` A successful order returns `201`: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "status": "active", "segments": [ { "country": 197153, "country_code": "DE", "count": 100, "segment_price_cents": 1200, "available": true } ], "total_ip": 100, "total_price_cents": 1200, "period_months": 1, "discount_pct": 0, "monthly_price_cents": 1200, "balance_applied_cents": 1200, "amount_due_cents": 0, "invoice_url": null, "payment_required": false, "intent_id": null, "promo_discount_cents": 0, "trial": false, "addon_monthly_cents": 0 } ``` | Request field | Required | Notes | | --- | --- | --- | | `segments` | Yes | `[{"country": "DE", "count": 100}]`. `country` is an ISO code (a `tag_id` also works). | | `whitelist_ips` | Yes | At least one IPv4 address allowed to use the proxies without a password. An order without it is rejected with `422` before any charge. Use the public IP of the machine that will connect. | | `use_balance` | — | Set `true` to pay from the wallet. The default is `false`, which leaves the amount to be paid through a payment gateway (`amount_due_cents`, `invoice_url`, `payment_required` in the response). | | `auto_renew` | — | Defaults to **`true`**: the service renews from the wallet every period. Send `false` if you don't want that. | | `idempotency_key` | Recommended | Up to 128 characters. The same key replays the original order without a second charge; the same key with a different body returns `409 IDEMPOTENCY_KEY_REUSED`. | | `period_months` | — | 1, 3, 6 or 12. Default 1. | In the response, `balance_applied_cents` is what was taken from the wallet. When you replay an order with the same `idempotency_key`, you get the same `service_id` and `balance_applied_cents: 0` — nothing was charged twice. > **Important:** This REST endpoint has no price-guard field: the server re-prices the order at the moment you send it, and adding a field such as `expected_total_cents` is rejected with `422 {"detail":"Validation error"}`. Quote immediately before you order and compare `total_price_cents` with what you expect. If you need the server to refuse an order whose price changed, use the MCP tool `order_composite` with `expected_total_cents` — see [Buy through MCP](#buy-through-mcp) and [Idempotency](/developers/docs/idempotency/). Reference: [Composite order](/developers/docs/api/orders/#post-composite-order). ## 6. Wait for provisioning and fetch the proxies A 100-IP datacenter order had all IPs active about 2 seconds after the order returned. Poll the service until `status` is `active` and the IP list has the size you ordered, pausing at least one second between calls (see [Rate limits](/developers/docs/rate-limits/)). ```bash SERVICE_ID="00000000-0000-0000-0000-000000000000" curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/ips" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const BASE = 'https://fineproxy.org/account_new/api/v1/customer/services'; const headers = { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); async function waitForProxies(serviceId, expectedCount, timeoutMs = 120_000) { const deadline = Date.now() + timeoutMs; while (Date.now() < deadline) { const service = await (await fetch(`${BASE}/${serviceId}`, { headers })).json(); if (service.status === 'active') { const { ips } = await (await fetch(`${BASE}/${serviceId}/proxy/ips`, { headers })).json(); if (ips.length >= expectedCount) return ips; } await sleep(2000); } throw new Error(`Service ${serviceId} is not ready yet`); } console.log(await waitForProxies(order.service_id, 100)); ``` ```python import os import time import requests BASE = "https://fineproxy.org/account_new/api/v1/customer/services" HEADERS = {"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"} def wait_for_proxies(service_id, expected_count, timeout=120): deadline = time.time() + timeout while time.time() < deadline: service = requests.get(f"{BASE}/{service_id}", headers=HEADERS, timeout=30).json() if service["status"] == "active": ips = requests.get(f"{BASE}/{service_id}/proxy/ips", headers=HEADERS, timeout=30).json()["ips"] if len(ips) >= expected_count: return ips time.sleep(2) raise TimeoutError(f"Service {service_id} is not ready yet") ``` Each entry of `ips` has `ip`, `country`, `type` and `site`: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "ips": [ { "ip": "203.0.113.10", "country": "DE", "type": "socks5", "site": "nyc-1" }, { "ip": "203.0.113.11", "country": "DE", "type": "socks5", "site": "nyc-1" } ] } ``` Then read the login, password and ports with `GET .../proxy/auth?reveal=true` and connect — see [Connect to datacenter proxies](/developers/docs/proxies/datacenter/). References: [Get service](/developers/docs/api/services/#get-get-service), [Get proxy IPs](/developers/docs/api/proxy-access/#get-get-proxy-ips), [Get proxy auth](/developers/docs/api/proxy-access/#get-get-proxy-auth). ## Buy a rotating plan Rotating proxies are fixed products priced per package of requests. List them with `GET /api/v1/customer/catalog` and filter by `kind`. ```bash curl "https://fineproxy.org/account_new/api/v1/customer/catalog?limit=100" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` One product from the response: ```json { "products": [ { "id": "00000000-0000-0000-0000-000000000000", "kind": "proxy_rotating", "billing_model": "metered_requests", "name": "Rotating Proxies 2.5M Credits", "params": { "sticky": true, "pool_class": "datacenter", "period_days": 30, "request_package_size": 2500000 }, "price_cents": 3500, "price_unit": "period", "is_active": true, "features": ["2.5 million requests", "IPv4 HTTP, HTTPS, SOCKS4/5"] } ], "total": 1, "offset": 0, "limit": 100 } ``` `price_cents` is the price per period (`3500` = $35.00 for 30 days); `request_package_size` is the number of requests included. The list is paginated with `offset` and `limit` (1–100). Buy it with `POST /api/v1/customer/services`, passing the catalog price as `expected_price_cents`: ```bash curl -X POST https://fineproxy.org/account_new/api/v1/customer/services \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "product_id": "00000000-0000-0000-0000-000000000000", "expected_price_cents": 3500, "auto_renew": false, "params": {"client_idempotency_key": "rotating-2026-11-27-001"} }' ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/services', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ product_id: product.id, expected_price_cents: product.price_cents, auto_renew: false, params: { client_idempotency_key: 'rotating-2026-11-27-001' }, }), }); if (!response.ok) throw new Error(`Purchase failed ${response.status}: ${await response.text()}`); const { service } = await response.json(); console.log(service.id, service.status, service.expires_at); ``` ```python response = requests.post( "https://fineproxy.org/account_new/api/v1/customer/services", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={ "product_id": product["id"], "expected_price_cents": product["price_cents"], "auto_renew": False, "params": {"client_idempotency_key": "rotating-2026-11-27-001"}, }, timeout=60, ) response.raise_for_status() service = response.json()["service"] print(service["id"], service["status"], service["expires_at"]) ``` The `201` response wraps the new service: `{"service": {...}, "invoice_url": null}`. The service has `product_kind: "proxy_rotating"`, `status: "active"`, `price_cents: 3500`, `expires_at` 30 days ahead and `params.requests_quota` / `params.requests_remaining` for the request quota. - `params` accepts only `whitelist_ips`, `billing_period_months` (1/3/6/12/24/36) and `client_idempotency_key`; any other key is rejected with `422` before the wallet is touched. - Repeating the call with the same product and `params` returns the existing service without charging again. - Where price confirmation applies, a missing or wrong `expected_price_cents` is rejected with `409` before any debit. - `auto_renew` defaults to `true` here too. To connect, read the gateway hosts and ports from `GET .../proxy/config` — see [Connect to rotating proxies](/developers/docs/proxies/rotating/) and [Sticky sessions](/developers/docs/guides/sticky-sessions/). Reference: [List products](/developers/docs/api/catalog/#get-list-products), [Create service](/developers/docs/api/orders/#post-create-service). ## Buy through MCP An AI agent connected to the [MCP server](/developers/docs/mcp/) follows the same flow with tools. The server's built-in instructions tell agents to use exactly this order. | Step | MCP tool | REST equivalent | | --- | --- | --- | | Countries and stock | [`list_countries`](/developers/docs/mcp/tools/#list_countries) | `GET /api/v1/billing/countries` | | Pricing terms | [`get_pricing_info`](/developers/docs/mcp/tools/#get_pricing_info) | `GET /api/v1/billing/composite/pricing-info` | | Auto-split | [`plan_composite`](/developers/docs/mcp/tools/#plan_composite) | `POST /api/v1/billing/composite/auto-plan` | | Quote | [`quote_composite`](/developers/docs/mcp/tools/#quote_composite) | `POST /api/v1/billing/composite/quote` | | Your egress IP for `whitelist_ips` | [`get_my_ip`](/developers/docs/mcp/tools/#get_my_ip) | — | | Order | [`order_composite`](/developers/docs/mcp/tools/#order_composite) | `POST /api/v1/billing/composite/order` | | Rotating plans | [`list_catalog`](/developers/docs/mcp/tools/#list_catalog) → [`buy_service`](/developers/docs/mcp/tools/#buy_service) | `GET /customer/catalog` → `POST /customer/services` | `order_composite` requires `segments`, `whitelist_ips` and `idempotency_key`, and accepts `expected_total_cents` — pass the quote's `total_price_cents` there. Over raw JSON-RPC the call looks like this: ```bash curl -X POST https://fineproxy.org/account_new/api/v1/mcp \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "order_composite", "arguments": { "segments": [{"country": "DE", "count": 100}], "period_months": 1, "whitelist_ips": ["203.0.113.10"], "idempotency_key": "order-de100-2026-11-27-001", "expected_total_cents": 1200, "auto_renew": false } } }' ``` If the total does not match the current price, the tool refuses and charges nothing. The JSON-RPC call still returns HTTP 200; the failure is in `result.isError`: ```json { "jsonrpc": "2.0", "id": 2, "result": { "content": [ { "type": "text", "text": "Invalid arguments: Price mismatch: expected_total_cents=1199, actual quote is 1200 cents. Nothing was charged." } ], "isError": true } } ``` Replaying `order_composite` with the same `idempotency_key` returns the same `service_id` without a second charge. > **Warning:** Over MCP, `get_my_ip` returns the IP of the machine running the agent, which is not necessarily the machine that will use the proxies. Confirm the address before putting it into `whitelist_ips`. ## Common pitfalls - **Below the minimum.** Orders, quotes and add-IP top-ups under 100 IPs in total return `422`. - **Forgetting `use_balance: true`** on the REST composite order. Without it the response asks for a gateway payment (`payment_required`, `amount_due_cents`) instead of charging the wallet. - **Unwanted renewals.** `auto_renew` defaults to `true` on both order endpoints. Turn it off later with the MCP tool `set_auto_renew` — see [Manage services](/developers/docs/guides/manage-services/#auto-renew). - **Reusing an idempotency key** for a different order returns `409 IDEMPOTENCY_KEY_REUSED`. Generate a new key per purchase intent and reuse it only for retries of the same request. - **Bursting.** More than about 2 requests per second gets `429`. Poll provisioning every 1–2 seconds, not in a tight loop. ## Next steps - [Manage services](/developers/docs/guides/manage-services/) — renew, add IPs, refresh IPs, add-ons and cancellation. - [IP allowlist](/developers/docs/guides/ip-allowlist/) — change the IPs allowed to connect without a password. - [Connect to datacenter proxies](/developers/docs/proxies/datacenter/) — ports, protocols and authentication. --- # Manage proxy services Source: https://fineproxy.org/developers/docs/guides/manage-services/ After a purchase, everything happens on a **service** — one subscription identified by a UUID. This guide covers the operations you run on an existing service and what each one costs. Paid operations debit your wallet in integer cents and accept an idempotency key, so retries never charge twice. Read operations need `services:read`; changes need `services:write`; operations that cost money also need `wallet:spend`. Examples use `SERVICE_ID` as a placeholder: ```bash export SERVICE_ID="00000000-0000-0000-0000-000000000000" ``` ## List and inspect services `GET /api/v1/customer/services` returns your services, paginated with `offset` and `limit` (1–100, default 50). `GET /api/v1/customer/services/{service_id}` returns one. ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services?limit=50" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/services?limit=50', { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }, }); const { services, total } = await response.json(); const active = services.filter((s) => s.status === 'active'); console.log(`${active.length} active of ${total}`); ``` ```python import os import requests response = requests.get( "https://fineproxy.org/account_new/api/v1/customer/services", params={"limit": 50}, headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) response.raise_for_status() for service in response.json()["services"]: print(service["id"], service["status"], service["expires_at"]) ``` A service (shortened; `params` holds product-specific details such as `segments`, `geo_filter` and `whitelist_ips`): ```json { "id": "00000000-0000-0000-0000-000000000000", "product_kind": "proxy_datacenter", "display_name": "Datacenter Proxy DE 100 IPs", "status": "active", "started_at": "2026-11-27T10:00:36.733119Z", "expires_at": "2026-12-27T10:00:36.733119Z", "grace_until": null, "cancelled_at": null, "is_trial": false, "is_auto_renew": true, "price_cents": 1200, "price_unit": "period", "renewal_price_cents": 1200, "renewal_coverage": "covered_by_balance", "renew_allowed": true, "suspend_reason": null, "active_addon_types": [] } ``` | Field | Meaning | | --- | --- | | `status` | `active` or `cancelled` in practice; a new order can briefly be `pending`. Always check it — cancelled services stay in the list. | | `product_kind` | `proxy_datacenter`, `proxy_isp`, `proxy_rotating`, … — decides which endpoints apply. | | `expires_at` | End of the paid period (ISO 8601, UTC). | | `is_auto_renew` | Whether the service renews from the wallet at `expires_at`. | | `price_cents` | Price of one period, as purchased. Manual renewal charges this amount. | | `renewal_price_cents` | Next automatic renewal price; grows when you add IPs. `null` when not applicable. | | `renewal_coverage` | Whether the wallet covers the next renewal: seen as `covered_by_balance` or `not_applicable`. | | `renew_allowed` | Whether a manual renewal is currently allowed. | | `suspend_reason` | Why a service is suspended, for example `quota_exhausted` for a rotating plan. | | `active_addon_types` | Add-ons currently enabled. | References: [List services](/developers/docs/api/services/#get-list-services), [Get service](/developers/docs/api/services/#get-get-service). MCP: [`list_services`](/developers/docs/mcp/tools/#list_services), [`get_service`](/developers/docs/mcp/tools/#get_service). ## Renew a service `POST /api/v1/customer/services/{service_id}/renew` extends the service and charges the wallet the price the service was purchased at. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/renew" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"period_count": 1, "idempotency_key": "renew-2026-11-27-001"}' ``` Renewing a 100-IP datacenter service for one period charged `1200` cents and moved `expires_at` one month forward: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "status": "active", "message": "Service renewed for 1 period(s).", "refund_cents": null, "new_expires_at": "2027-01-26T10:00:36.733119Z", "charged_cents": 1200, "funding_source": null, "refund_base_cents": null } ``` | Body field | Notes | | --- | --- | | `period_count` | 1–12 periods at the current one-period price. Default 1. | | `period_months` | 1, 3, 6 or 12. Overrides `period_count` and applies the period-discount grid. | | `idempotency_key` | Retries with the same key never double-charge. Also accepted as an `Idempotency-Key` header. | > **Note:** A rotating plan suspended with `suspend_reason: "quota_exhausted"` is restored by a quota top-up in the dashboard or the next monthly grant, not by renewal. Renewal returns `409` for it, except within 7 days of `expires_at`, and then it only extends the period. Reference: [Renew service](/developers/docs/api/services/#post-renew-service). MCP: [`renew_service`](/developers/docs/mcp/tools/#renew_service). ## Auto-renew With auto-renew on, the service is charged automatically each period. Turn it off to let the service expire at the end of the paid period without a refund. There is no REST endpoint for this; use the MCP tool [`set_auto_renew`](/developers/docs/mcp/tools/#set_auto_renew) and read the result back from `is_auto_renew` on the service. ```bash curl -X POST https://fineproxy.org/account_new/api/v1/mcp \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"set_auto_renew","arguments":{"service_id":"00000000-0000-0000-0000-000000000000","enabled":false}}}' ``` To stop paying without losing time you already paid for, turn auto-renew off instead of cancelling. ## Add IPs You can grow an active datacenter or ISP service. Quote first — the quote shows both the charge now and the new renewal price. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/billing/services/$SERVICE_ID/add-ips/quote" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"segments": [{"country": "DE", "count": 100}]}' ``` Quote for +100 German IPs on a service with 30 days left: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "segments": [ { "country": 197153, "country_code": "DE", "count": 100, "unit_base_cents": 12, "segment_price_cents": 1200, "available": true } ], "errors": [], "added_ip_count": 100, "monthly_price_added_cents": 1200, "days_remaining": 30, "days_per_month": 30, "prorated_charge_cents": 1200, "current_price_cents": 1200, "new_renewal_price_cents": 2400 } ``` - `prorated_charge_cents` is charged now for the rest of the current period (`monthly_price_added_cents` × `days_remaining` / `days_per_month`). With 30 of 30 days left, that is the full monthly price. - `new_renewal_price_cents` is what every later renewal costs: here it doubles from 1200 to 2400. - The 100-IP minimum applies to top-ups as well: +10 IPs returns `422` with the same "below the tenant minimum of 100 IPs" message. Then buy with `POST /api/v1/billing/services/{service_id}/add-ips`, sending the same segments, a fresh `idempotency_key` (required) and the quoted amount in `expected_charge_cents`. For composite services the server checks `expected_charge_cents` against a fresh quote when you send it. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/billing/services/$SERVICE_ID/add-ips" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"segments": [{"country": "DE", "count": 100}], "idempotency_key": "add-ips-2026-11-27-001", "expected_charge_cents": 1200}' ``` The response reports `added_ip_count`, `charged_cents`, `ledger_entry_id`, `new_total_ip` and `new_price_cents` (the new renewal price). References: [Add IPs quote](/developers/docs/api/orders/#post-get-add-ips-quote), [Add IPs](/developers/docs/api/orders/#post-add-ips). MCP: [`add_ips`](/developers/docs/mcp/tools/#add_ips). ## Refresh (replace) IPs A refresh swaps the addresses of a service for new ones; the number of IPs stays the same. The flow has three steps. **1. Is the next refresh free?** ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/refresh-status" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "service_id": "00000000-0000-0000-0000-000000000000", "is_free": true, "free_window_days": 8, "days_since_start": 0, "price_cents": 0, "is_pool_service": true, "dedicated": false } ``` The first refresh of a service is free. After it, the status switched to `is_free: false`, `price_cents: 1000` ($10.00 per refresh, however many IPs are replaced) and `next_free_refresh_at` showed when the next free refresh becomes available. **2. Preview it.** `POST .../proxy/refresh/quote` is read-only. Choose one of two shapes: - `geo_counts` — the countries of the new IPs, `{"DE": 100}`. The sum must equal the number of IPs being replaced (the whole allocation, or the IPs listed in `target_ips`). It is required unless you use `partial`. - `partial: true` — the server replaces as many IPs as the pool has per country and keeps the rest. It cannot be combined with `geo_counts` or `target_ips` and works for shared-pool services only. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/refresh/quote" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"partial": true}' ``` ```json { "service_id": "00000000-0000-0000-0000-000000000000", "geo_source": "maxmind", "replaced_count": 100, "price_cents": 0, "is_free": true, "availability": { "DE": { "requested": 100, "available": 1364, "held": 100 } }, "shortfall": false, "partial": true, "kept_count": 0, "planned_geo_counts": {} } ``` `shortfall: true` means a country lacks free addresses and the refresh would be refused. A quote whose `geo_counts` total does not match returns: ```json { "detail": { "error": "GEO_COUNTS_MISMATCH", "requested": 1, "replaced": 100, "message": "geo_counts total (1) must equal the number of IPs being replaced (100)." } } ``` That is `422`. Sending `target_ips` alone, without `geo_counts`, returns `400 {"detail":"geo_counts must contain at least one country."}`; add `"geo_counts": {"DE": 1}` for one German IP. **3. Refresh.** `POST .../proxy/refresh` with a new `idempotency_key` (required). Omit `target_ips` to replace the whole allocation, list addresses in `target_ips` to replace only those, or send `partial: true`. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/refresh" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"partial": true, "idempotency_key": "refresh-2026-11-27-001"}' ``` The response lists the new addresses right away. In testing the refresh completed in about 2 seconds; re-read `GET .../proxy/ips` afterwards and update your clients. ```json { "service_id": "00000000-0000-0000-0000-000000000000", "ip_count": 100, "charged_cents": 0, "ledger_entry_id": null, "new_ips": ["203.0.113.20", "203.0.113.21"], "alive_replaced": 0, "kept_count": 0, "partial": true } ``` > **Warning:** The REST refresh endpoint has no `geo_counts` field and ignores unknown fields. Sending `geo_counts` there does not pick a geography — it performs (and charges for) a plain refresh. The MCP tool [`refresh_ips`](/developers/docs/mcp/tools/#refresh_ips) does accept `geo_counts`, plus `expected_amount_cents` as a price guard. Errors: `402 insufficient_funds` (nothing charged), `409 no_available_ips` (with `partial`, nothing available; the free slot is kept), `409` on an idempotency-key conflict. References: [Refresh status](/developers/docs/api/proxy-access/#get-get-refresh-status), [Refresh quote](/developers/docs/api/proxy-access/#post-preview-an-ip-refresh-price-and-free-stock), [Refresh](/developers/docs/api/proxy-access/#post-refresh-the-ip-addresses-of-a-service). MCP: [`get_refresh_status`](/developers/docs/mcp/tools/#get_refresh_status), [`quote_refresh`](/developers/docs/mcp/tools/#quote_refresh), [`refresh_ips`](/developers/docs/mcp/tools/#refresh_ips). ## Add-ons Add-ons extend a service. List what you can buy: ```bash curl "https://fineproxy.org/account_new/api/v1/billing/services/$SERVICE_ID/addons/available" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` | `addon_type` | Price (`price_cents`) | `params` | | --- | --- | --- | | `udp_unlock` | 600 | none | | `extra_whitelist_ip` | 100 per IP | `{"ip_count": 1..10000}` | | `extra_connections` | 3 per connection | `{"conn_count": 1..10000}` | The response also carries `params_schema` per add-on and your `wallet_balance_cents`. Already-active add-ons are not listed. Purchase with `POST .../addons`. `expected_price_cents` must equal the **total** — unit price × quantity — or the request is rejected with `409` and nothing is charged: ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/billing/services/$SERVICE_ID/addons" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"addon_type": "extra_connections", "params": {"conn_count": 1}, "expected_price_cents": 3, "idempotency_key": "addon-2026-11-27-001"}' ``` The `201` response returns `addon_id`, `addon_type`, `status`, `price_cents` and `created_at`. Without the required parameter you get `400 {"detail":"conn_count is required for extra_connections (integer 1..10000)."}`; with too little money, `402`. List active add-ons with `GET .../addons`. Disable one with `DELETE .../addons/{addon_id}`; the unused part of the period is refunded: ```bash curl -X DELETE "https://fineproxy.org/account_new/api/v1/billing/services/$SERVICE_ID/addons/$ADDON_ID?confirm=true" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` The response includes `refund_cents` — the exact amount credited back. Disabling an `extra_connections` add-on bought for 3 cents on the same day refunded 3 cents. References: [Available add-ons](/developers/docs/api/addons/#get-list-available-addons), [Purchase](/developers/docs/api/addons/#post-purchase-addon), [Active add-ons](/developers/docs/api/addons/#get-list-active-addons), [Disable](/developers/docs/api/addons/#delete-disable-addon). MCP: [`list_available_addons`](/developers/docs/mcp/tools/#list_available_addons), [`purchase_addon`](/developers/docs/mcp/tools/#purchase_addon), [`list_active_addons`](/developers/docs/mcp/tools/#list_active_addons), [`disable_addon`](/developers/docs/mcp/tools/#disable_addon) (requires `confirm: true`). ## Cancel a service `POST /api/v1/customer/services/{service_id}/cancel` terminates a service immediately. It is irreversible and requires `{"confirm": true}`. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/cancel" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"confirm": true}' ``` ```json { "service_id": "00000000-0000-0000-0000-000000000000", "status": "cancelled", "message": "Service cancelled. Rotating refund: 3500 cents.", "refund_cents": 3500, "new_expires_at": null, "charged_cents": null, "funding_source": "wallet", "refund_base_cents": 3500 } ``` - **Refund.** Unused paid time is refunded to the wallet pro rata at the undiscounted daily rate, so period discounts are lost on early cancellation. `refund_cents` is the exact amount credited. A rotating plan cancelled minutes after purchase, unused, was refunded in full (3500 cents). - **Cooldown.** Self-service cancellation is limited to once every 3 days per account. A second cancel within that window returns `409` with `SERVICE_CANCEL_COOLDOWN` and a `retry_at` time; open a [support ticket](/developers/docs/guides/support-tickets/) if you cannot wait. ```json { "error": "SERVICE_CANCEL_COOLDOWN", "retry_at": "2026-11-30T10:04:48.359196Z" } ``` Over MCP, [`cancel_service`](/developers/docs/mcp/tools/#cancel_service) returns the same condition as `isError: true` with the text `SERVICE_CANCEL_COOLDOWN: self-service cancellation is limited to once every 3 days. … retry_at=… retry_after_seconds=…`. > **Important:** If you only want to stop future charges, turn off [auto-renew](#auto-renew) instead. Cancelling ends access immediately. Reference: [Cancel service](/developers/docs/api/services/#post-cancel-service). ## Read usage `GET /api/v1/customer/services/{service_id}/usage` returns connection and traffic totals for a time window. `start` and `end` (ISO 8601) are required; the key needs `usage:read`. ```bash curl -G "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/usage" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ --data-urlencode "start=2026-11-01T00:00:00Z" \ --data-urlencode "end=2026-11-27T23:59:59Z" ``` ```json { "connections": 0, "bytes_used": 0, "window": { "start": "2026-11-01T00:00:00Z", "end": "2026-11-27T23:59:59Z" } } ``` For success rates, latency, top destinations and error breakdowns, the MCP server has analytics tools without a REST counterpart: [`get_usage_overview`](/developers/docs/mcp/tools/#get_usage_overview), [`get_usage_timeseries`](/developers/docs/mcp/tools/#get_usage_timeseries), [`get_top_destinations`](/developers/docs/mcp/tools/#get_top_destinations), [`get_diagnostics`](/developers/docs/mcp/tools/#get_diagnostics) and [`get_recommendations`](/developers/docs/mcp/tools/#get_recommendations). Reference: [Get service usage](/developers/docs/api/services/#get-get-service-usage). MCP: [`get_usage`](/developers/docs/mcp/tools/#get_usage). ## Common pitfalls - **Acting on cancelled services.** Cancelled services remain in the list and some proxy endpoints still answer for them. Filter on `status`. - **Expecting a refresh to add IPs.** A refresh keeps the count; use add IPs to grow. - **Paying for a second refresh by accident.** Check `refresh-status` first — after the free one, each refresh costs `price_cents` until `next_free_refresh_at`. - **Cancelling twice in a row.** The 3-day cooldown is per account, not per service. --- # Manage the IP allowlist Source: https://fineproxy.org/developers/docs/guides/ip-allowlist/ The IP allowlist is the list of your own public IPv4 addresses that may connect to a proxy service without a login and password. This guide shows how to read and change it over REST and MCP, and how connection limits are shared between entries. Reading needs `services:read`; changes need `services:write`. ```bash export SERVICE_ID="00000000-0000-0000-0000-000000000000" ``` ## How the allowlist works Every datacenter or ISP proxy IP accepts two kinds of connections: - **Login and password** on the standard ports, from anywhere. - **No credentials** on the allowlist ports, but only from IPs on the allowlist. The ports come from `endpoints[]` in `GET .../proxy/auth`: `port` is the credential port and `port_whitelist` is the allowlist port. | Protocol (`label`) | Credential port | Allowlist port | | --- | --- | --- | | SOCKS5 | 1080 | 1085 | | HTTP | 8080 | 8085 | | HTTPS (HTTP/2) | 8443 | 8444 | | SOCKS4 | — | 1087 (allowlist only) | | HTTP/2 (port 993, DPI bypass) | — | 993 (allowlist only) | Entries marked `noauth_only: true` in `endpoints[]` work only through the allowlist. The HTTPS endpoints carry a `hostname_template` such as `net-{ip_dashed}.mcccx.com`; connect by that hostname because the TLS certificate is issued for it. See [Connect to datacenter proxies](/developers/docs/proxies/datacenter/) for connection strings. Every new composite order requires at least one allowlist IP (`whitelist_ips`), so a fresh service already has one entry. ## Read the allowlist ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/whitelist" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const response = await fetch( `https://fineproxy.org/account_new/api/v1/customer/services/${process.env.SERVICE_ID}/proxy/whitelist`, { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` } }, ); const allowlist = await response.json(); console.log(allowlist.entries, `${allowlist.used}/${allowlist.capacity} slots used`); ``` ```python import os import requests response = requests.get( f"https://fineproxy.org/account_new/api/v1/customer/services/{os.environ['SERVICE_ID']}/proxy/whitelist", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) response.raise_for_status() allowlist = response.json() print(allowlist["entries"], allowlist["used"], allowlist["capacity"]) ``` ```json { "service_id": "00000000-0000-0000-0000-000000000000", "entries": [ { "ip_or_cidr": "203.0.113.10", "label": null, "conn_limit": 1500, "is_paid": false } ], "conn_cap": 1500, "capacity": 5, "free_quota": 5, "used": 1, "paid_slots": 0 } ``` | Field | Meaning | | --- | --- | | `entries[].ip_or_cidr` | The allowlisted IPv4 address. The name is historical: only single addresses are accepted. | | `entries[].label` | Optional label you set when adding. | | `entries[].conn_limit` | Concurrent connections this IP may open. | | `entries[].is_paid` | `true` if the entry occupies a paid slot. | | `conn_cap` | Total connection budget of the service, shared by all entries. | | `capacity` | Total slots: `free_quota` + `paid_slots`. | | `free_quota` | Slots included with the service (5). | | `used` | Slots in use. | | `paid_slots` | Extra slots bought with the `extra_whitelist_ip` add-on (100 cents per IP per month). | `conn_cap` follows the package size: in the current pricing terms, services up to 800 IPs get a flat 1500 connections (`conn_cap_tiers` in `GET /api/v1/billing/composite/pricing-info`). Reference: [Get whitelist](/developers/docs/api/proxy-access/#get-get-whitelist). ## Add an IP `POST .../proxy/whitelist` with `ip_or_cidr` (required), optional `label` and optional `conn_limit`. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/whitelist" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"ip_or_cidr": "198.51.100.55", "label": "office"}' ``` ```javascript const response = await fetch( `https://fineproxy.org/account_new/api/v1/customer/services/${process.env.SERVICE_ID}/proxy/whitelist`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ ip_or_cidr: '198.51.100.55', label: 'office' }), }, ); if (!response.ok) throw new Error(`Allowlist add failed ${response.status}: ${await response.text()}`); console.log((await response.json()).entries); ``` ```python response = requests.post( f"https://fineproxy.org/account_new/api/v1/customer/services/{os.environ['SERVICE_ID']}/proxy/whitelist", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={"ip_or_cidr": "198.51.100.55", "label": "office"}, timeout=30, ) response.raise_for_status() print(response.json()["entries"]) ``` The response is the whole updated allowlist. Notice that the connection budget was split between the two entries: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "entries": [ { "ip_or_cidr": "203.0.113.10", "label": null, "conn_limit": 750, "is_paid": false }, { "ip_or_cidr": "198.51.100.55", "label": "office", "conn_limit": 750, "is_paid": false } ], "conn_cap": 1500, "capacity": 5, "free_quota": 5, "used": 2, "paid_slots": 0 } ``` Validation errors are `422` with a plain `detail` string: | Input | Response | | --- | --- | | `"not-an-ip"` | `{"detail":"Invalid IP address: 'not-an-ip'"}` | | `"198.51.100.0/24"` | `{"detail":"Only single IPv4 addresses are supported: '198.51.100.0/24'. CIDR subnets are not allowed."}` | An explicit `/32` is accepted as a single address. When all slots are taken, buy an `extra_whitelist_ip` add-on (see [Manage services](/developers/docs/guides/manage-services/#add-ons)) or replace an existing entry. Reference: [Add whitelist entry](/developers/docs/api/proxy-access/#post-add-whitelist-entry). ## Replace an IP When your server's address changes, swap it atomically. The old IP leaves and the new one appears in one step, with no moment without an allowlisted IP, and no free slot is needed. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/whitelist/replace" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"old_ip_or_cidr": "198.51.100.55", "new_ip_or_cidr": "198.51.100.56"}' ``` The response is the updated allowlist; the new entry keeps the old entry's `conn_limit` (750 in the example above). Only `new_ip_or_cidr` is validated as a single IPv4 address; `old_ip_or_cidr` must match an existing entry. Reference: [Replace whitelist entry](/developers/docs/api/proxy-access/#post-replace-whitelist-entry). ## Remove an IP `DELETE .../proxy/whitelist` takes the address as the `ip_or_cidr` **query parameter** (not a JSON body). ```bash curl -X DELETE "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/whitelist?ip_or_cidr=198.51.100.56" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` After removal, the remaining entry got the full budget back (`conn_limit: 1500`, `used: 1`). > **Note:** The last allowlisted IP of a datacenter, ISP or personal proxy service cannot be removed. Use replace instead. Reference: [Remove whitelist entry](/developers/docs/api/proxy-access/#delete-remove-whitelist-entry). ## Set connection limits per IP By default `conn_cap` is divided evenly between entries. To give one server more connections than another, use the MCP tool [`update_whitelist_limits`](/developers/docs/mcp/tools/#update_whitelist_limits). It takes `limits` as an `{ip_or_cidr: conn_limit}` map. Each value must be at least 1 and the limits must add up to the service's `conn_cap`; any other shape is rejected. Read `conn_cap` and the current entries with `get_whitelist` first. ```json { "name": "update_whitelist_limits", "arguments": { "service_id": "00000000-0000-0000-0000-000000000000", "limits": { "203.0.113.10": 1000, "198.51.100.56": 500 } } } ``` That object is the `params` of a JSON-RPC `tools/call` request to the [MCP server](/developers/docs/mcp/). When you add an entry with REST, you can also pass `conn_limit` directly. ## Find your current egress IP The allowlist needs the **public** IP your traffic leaves from, not a LAN address. The MCP tool [`get_my_ip`](/developers/docs/mcp/tools/#get_my_ip) returns the address of the machine that called it: ```json { "ip": "203.0.113.10", "family": "ipv4" } ``` > **Warning:** When an AI agent calls `get_my_ip`, you get the IP of the machine running the agent. That is not necessarily the server that will use the proxies. Confirm the address before adding it. ## MCP equivalents | Task | MCP tool | REST | | --- | --- | --- | | Read | [`get_whitelist`](/developers/docs/mcp/tools/#get_whitelist) | `GET .../proxy/whitelist` | | Add | [`add_whitelist_ip`](/developers/docs/mcp/tools/#add_whitelist_ip) (`ip`, `label`) | `POST .../proxy/whitelist` | | Replace | [`replace_whitelist_ip`](/developers/docs/mcp/tools/#replace_whitelist_ip) (`old_ip`, `new_ip`) | `POST .../proxy/whitelist/replace` | | Remove | [`remove_whitelist_ip`](/developers/docs/mcp/tools/#remove_whitelist_ip) (`ip`) | `DELETE .../proxy/whitelist?ip_or_cidr=` | | Per-IP connection limits | [`update_whitelist_limits`](/developers/docs/mcp/tools/#update_whitelist_limits) | `conn_limit` when adding | | Your egress IP | [`get_my_ip`](/developers/docs/mcp/tools/#get_my_ip) | — | Note the argument names: MCP tools use `ip`, `old_ip` and `new_ip`, while REST uses `ip_or_cidr`, `old_ip_or_cidr` and `new_ip_or_cidr`. ## Common pitfalls - **Sending `ip` instead of `ip_or_cidr`** to the REST endpoint. Bodies reject unknown fields. - **Using a CIDR range.** Only single IPv4 addresses are accepted; add each address separately. - **Removing then adding** to change an address. With all slots used, the add can fail and leave you without access; use replace. - **Connecting to a credential port from an allowlisted IP without a password.** No-credential access works only on the allowlist ports (1085, 8085, 8444, 1087, 993). --- # Sticky sessions for rotating proxies Source: https://fineproxy.org/developers/docs/guides/sticky-sessions/ Rotating proxies pick exit IPs from a shared pool. A **sticky session** keeps one exit for a while so that a multi-step task — a login followed by several page loads, for example — comes from the same address. This guide shows the REST endpoints that control sticky behavior for a rotating service. > **Important:** Sticky endpoints exist only for rotating services (`product_kind: "proxy_rotating"`). For datacenter, ISP and other services they return `404 {"detail":"Service not found."}`. There are no MCP tools for sticky sessions; use REST. Reading needs `services:read`; changes need `services:write`. Use the ID of a rotating service: ```bash export SERVICE_ID="00000000-0000-0000-0000-000000000000" ``` ## Find the sticky ports Read the connection settings of the service with `GET .../proxy/config`: ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/config" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "endpoint": "fineproxy.xyz", "endpoints": ["fineproxy.xyz"], "https_endpoints": ["eu01.mcccx.com", "us01.mcccx.com"], "port": 3081, "http_ports": [3081, 3082, 3083, 3084, 3085, 3086, 3087, 3088, 3089, 3090, 3091, 3092, 3093, 3094], "socks_ports": [2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, 2089, 2090, 2091, 2092, 2093, 2094], "sticky_http": 5080, "sticky_socks5": 4080, "sticky_https": 4443, "session_format": "ip:port:username:password", "mode": "sticky", "sample_connection_strings": ["fineproxy.xyz:3081:USER:********"] } ``` | Field | Meaning | | --- | --- | | `endpoints`, `http_ports`, `socks_ports` | The regular rotating gateway: host and HTTP / SOCKS ports. | | `sticky_http`, `sticky_socks5`, `sticky_https` | Ports for sticky connections over HTTP, SOCKS5 and HTTPS. | | `https_endpoints` | Regional HTTPS hosts. `GET .../proxy/auth` lists the sticky hosts in `rotating_gateway.sticky_hosts`. | | `session_format` | How the connection string is put together. | | `mode` | The current session mode. | The values above are an example. Always read host names and ports from `proxy/config` instead of hardcoding them. `proxy/config` also returns `404` for non-rotating services. Full connection details are in [Connect to rotating proxies](/developers/docs/proxies/rotating/). Reference: [Get rotating config](/developers/docs/api/proxy-access/#get-get-rotating-config). ## Read and set the session mode ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/mode" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` A new rotating service starts in `sticky` mode: ```json { "mode": "sticky" } ``` Change it with `PUT`: ```bash curl -X PUT "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/mode" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"mode": "sticky"}' ``` ```javascript const response = await fetch( `https://fineproxy.org/account_new/api/v1/customer/services/${process.env.SERVICE_ID}/proxy/sticky/mode`, { method: 'PUT', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ mode: 'sticky' }), }, ); if (!response.ok) throw new Error(`Mode change failed ${response.status}: ${await response.text()}`); console.log(await response.json()); ``` ```python import os import requests response = requests.put( f"https://fineproxy.org/account_new/api/v1/customer/services/{os.environ['SERVICE_ID']}/proxy/sticky/mode", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={"mode": "sticky"}, timeout=30, ) response.raise_for_status() print(response.json()) ``` | `mode` | Use it when | | --- | --- | | `sticky` | Requests in a session should keep the same exit until the session TTL runs out. | | `rotating` | Every request may use a different exit. | | `pinned` | All traffic should use one fixed exit. Send it in `pin` as `ip:port`; `pin` is required for this mode. | For `pinned`, the body is `{"mode": "pinned", "pin": ":"}`; the exit is validated by the gateway. The response has the same shape as `GET`, `{"mode": "...", "pin": "..."}`. A body the server does not accept returns `422 {"detail":"Validation error"}`; read the mode back with `GET` to confirm the change. References: [Get sticky mode](/developers/docs/api/sticky/#get-customer-get-sticky-mode), [Set sticky mode](/developers/docs/api/sticky/#put-customer-set-sticky-mode). ## Read and change the session TTL The TTL is how long a sticky session keeps its exit. The default is 900 seconds (15 minutes). ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/ttl" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "ttl_seconds": 900, "is_custom": false, "global_default_ttl": 900, "ttl_human": "15m" } ``` Set your own value with `PUT` and `seconds` (minimum 30): ```bash curl -X PUT "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/ttl" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"seconds": 300}' ``` The response returns the same fields; `is_custom` becomes `true` when an override is set. `DELETE .../sticky/ttl` removes the override and returns to `global_default_ttl`: ```bash curl -X DELETE "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/ttl" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Choose a TTL slightly longer than your longest task that must stay on one IP. A shorter TTL gives you fresh IPs more often. References: [Get TTL](/developers/docs/api/sticky/#get-customer-get-sticky-ttl), [Set TTL](/developers/docs/api/sticky/#put-customer-set-sticky-ttl), [Reset TTL](/developers/docs/api/sticky/#delete-customer-reset-sticky-ttl). ## List sticky sessions ```bash curl "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/sessions" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Before any traffic the list is empty: ```json { "service_id": "00000000-0000-0000-0000-000000000000", "username": "your_proxy_username", "sessions": [] } ``` Each entry in `sessions` describes one session: | Field | Meaning | | --- | --- | | `sid` | Session handle used in the rotate and delete paths. | | `session_id` | Session identifier. | | `server` | Gateway server holding the session. | | `exit`, `exit_addr` | The exit currently assigned. | | `is_default` | Whether this is the default session. | | `created`, `last_used` | Timestamps. | | `ttl_seconds`, `expires_at` | Lifetime of the session. | | `mode` | Mode of the session. | Reference: [List sticky sessions](/developers/docs/api/sticky/#get-customer-list-sticky-sessions). ## Rotate, delete or purge sessions **Rotate one session** to a new exit while keeping the session. This is free and is not an IP refresh. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/sessions/$SID/rotate" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` The response returns the session's `sid`, its new `exit` and `exit_addr`, and `status: "rotated"`. **Delete one session** when you no longer need it. A successful delete returns `204 No Content`. ```bash curl -X DELETE "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/sessions/$SID" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` **Purge all sessions** of the service at once: ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/services/$SERVICE_ID/proxy/sticky/purge" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "deleted": 3 } ``` References: [Rotate session](/developers/docs/api/sticky/#post-customer-rotate-sticky-session), [Delete session](/developers/docs/api/sticky/#delete-customer-delete-sticky-session), [Purge sessions](/developers/docs/api/sticky/#post-customer-purge-sticky-sessions). ## Which operation to use | Situation | Operation | | --- | --- | | One task got blocked or rate-limited on its current IP | Rotate that session | | A task finished and its IP should not be reused | Delete that session | | You start a new batch and want every session on a fresh IP | Purge | | Sessions keep their IP too long or too short | Change the TTL | | You need one stable exit for everything | Mode `pinned` with `pin` | | You don't need stickiness at all | Mode `rotating` | ## Common pitfalls - **Calling sticky endpoints on a datacenter service.** They return `404 Service not found.`; check `product_kind` first. - **Hardcoding hosts and ports.** Read them from `proxy/config` — they can differ between services and regions. - **Using a TTL below 30 seconds.** The minimum is 30. - **Confusing rotate with refresh.** Rotating a session changes the exit of one rotating session for free. [Refreshing IPs](/developers/docs/guides/manage-services/#refresh-replace-ips) replaces the allocated IPs of a datacenter or ISP service and may cost money. --- # Receive webhooks Source: https://fineproxy.org/developers/docs/guides/webhooks/ Webhooks let FineProxy push events — a completed deposit, a provisioned or renewed service, a low wallet balance — to your server instead of you polling the API. This guide covers creating an endpoint, verifying signatures, handling deliveries safely and debugging them. Webhook endpoints are managed with the REST API and an API key with the `webhooks` scope. There are no MCP tools for webhooks. ## Event types `GET /api/v1/customer/webhooks/events` returns the events you can subscribe to: ```bash curl https://fineproxy.org/account_new/api/v1/customer/webhooks/events \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "events": [ "deposit.completed", "payment.failed", "payment.succeeded", "service.expiring", "service.provisioned", "service.renewed", "service.suspended", "service.terminated", "wallet.balance_low" ] } ``` | Group | Events | | --- | --- | | Deposits and payments | `deposit.completed`, `payment.succeeded`, `payment.failed` | | Services | `service.provisioned`, `service.renewed`, `service.expiring`, `service.suspended`, `service.terminated` | | Wallet | `wallet.balance_low` | Your endpoint also receives `ping` events when you send a test (see below). Read the list from the API at startup rather than hardcoding it. Reference: [List event types](/developers/docs/api/webhooks/#get-api-list-event-types). ## Create an endpoint `POST /api/v1/customer/webhooks` with your HTTPS `url` (8–2048 characters), the `events` to receive (at least one) and an optional `description` (up to 255 characters). ```bash curl -X POST https://fineproxy.org/account_new/api/v1/customer/webhooks \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/webhooks/fineproxy", "events": ["deposit.completed", "service.provisioned", "service.renewed", "wallet.balance_low"], "description": "production backend" }' ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/webhooks', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ url: 'https://example.com/webhooks/fineproxy', events: ['deposit.completed', 'service.provisioned', 'service.renewed', 'wallet.balance_low'], description: 'production backend', }), }); if (!response.ok) throw new Error(`Create failed ${response.status}: ${await response.text()}`); const endpoint = await response.json(); // Store endpoint.secret in your secret manager now: it is never shown again. console.log(endpoint.id, endpoint.secret_prefix); ``` ```python import os import requests response = requests.post( "https://fineproxy.org/account_new/api/v1/customer/webhooks", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={ "url": "https://example.com/webhooks/fineproxy", "events": ["deposit.completed", "service.provisioned", "service.renewed", "wallet.balance_low"], "description": "production backend", }, timeout=30, ) response.raise_for_status() endpoint = response.json() # Store endpoint["secret"] in your secret manager now: it is never shown again. print(endpoint["id"], endpoint["secret_prefix"]) ``` The `201` response is the only place the signing secret appears: ```json { "id": "00000000-0000-0000-0000-000000000000", "url": "https://example.com/webhooks/fineproxy", "secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "secret_prefix": "whsec_xx", "events": ["deposit.completed", "service.provisioned", "service.renewed", "wallet.balance_low"], "description": "production backend", "is_active": true, "disabled_reason": null, "consecutive_failures": 0, "created_at": "2026-11-27T09:43:36.667254Z", "updated_at": null } ``` > **Important:** `secret` starts with `whsec_` and is returned **once**. Later reads show only `secret_prefix`, which helps you tell endpoints apart. If you lose the secret, delete the endpoint and create a new one. Reference: [Create webhook](/developers/docs/api/webhooks/#post-api-create-webhook). ## What a delivery looks like Each event arrives as an HTTPS `POST` with a JSON body: ```text POST /webhooks/fineproxy HTTP/1.1 Content-Type: application/json X-FB-Event-Type: ping X-FB-Event-Id: 00000000-0000-0000-0000-000000000000 X-FB-Timestamp: 1795772675 X-FB-Signature: v1=5d41402abc4b2a76b9719d911017c592ae0c4e1f2d3b4a5968778695a4b3c2d1 traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01 ``` The body of that `ping` delivery: ```json { "id": "00000000-0000-0000-0000-000000000000", "type": "ping", "created_at": "2026-11-27T09:43:41Z", "data": { "ok": true, "endpoint_id": "00000000-0000-0000-0000-000000000000" } } ``` | Header | Meaning | | --- | --- | | `X-FB-Event-Type` | Event type, the same as `type` in the body. | | `X-FB-Event-Id` | Event ID, the same as `id` in the body. Use it to drop duplicates. | | `X-FB-Timestamp` | Unix time in seconds. Part of the signed message. | | `X-FB-Signature` | `v1=` followed by the hex HMAC-SHA256 signature. | | `traceparent` | W3C trace context; quote it when you report a delivery problem. | The body is always the envelope `{"id", "type", "created_at", "data"}`; the contents of `data` depend on the event type. The example shows the `ping` data. ## Verify the signature Compute the signature yourself and compare it with the header before trusting a delivery: 1. Take the **raw** request body bytes, exactly as received — before any JSON parsing. 2. Build the message `"{X-FB-Timestamp}.{raw body}"`. 3. Compute HMAC-SHA256 with the **full** secret string as the key, including the `whsec_` prefix, and hex-encode it. 4. Compare it with the part of `X-FB-Signature` after `v1=` using a constant-time comparison. We also recommend rejecting deliveries whose `X-FB-Timestamp` is far from your clock — for example more than 5 minutes — so a captured request cannot be replayed later. Log such rejections; you can fetch the event again with a redelivery. Complete receivers, reading the secret from `FINEPROXY_WEBHOOK_SECRET`: ```javascript // npm install express import crypto from 'node:crypto'; import express from 'express'; const WEBHOOK_SECRET = process.env.FINEPROXY_WEBHOOK_SECRET; // the full "whsec_..." string const TOLERANCE_SECONDS = 300; const processedEventIds = new Set(); // use a database table with a unique key in production function isValidSignature(rawBody, timestamp, signatureHeader) { if (!timestamp || !signatureHeader || !signatureHeader.startsWith('v1=')) return false; const expected = crypto .createHmac('sha256', WEBHOOK_SECRET) .update(`${timestamp}.`) .update(rawBody) .digest('hex'); const received = signatureHeader.slice('v1='.length); const a = Buffer.from(expected, 'utf8'); const b = Buffer.from(received, 'utf8'); return a.length === b.length && crypto.timingSafeEqual(a, b); } async function handleEvent(event) { console.log('FineProxy event', event.type, event.id, event.data); } const app = express(); // express.raw keeps the body as a Buffer — do not use express.json() on this route. app.post('/webhooks/fineproxy', express.raw({ type: 'application/json' }), (req, res) => { const timestamp = req.get('X-FB-Timestamp'); if (!isValidSignature(req.body, timestamp, req.get('X-FB-Signature'))) { return res.status(400).send('invalid signature'); } if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) { return res.status(400).send('timestamp outside tolerance'); } const event = JSON.parse(req.body.toString('utf8')); if (processedEventIds.has(event.id)) return res.sendStatus(200); // duplicate: already handled processedEventIds.add(event.id); res.sendStatus(200); // acknowledge first, then do the slow work handleEvent(event).catch((err) => console.error('webhook handler failed', event.id, err)); }); app.listen(3000); ``` ```python # pip install flask import hashlib import hmac import json import os import time from flask import Flask, abort, request WEBHOOK_SECRET = os.environ["FINEPROXY_WEBHOOK_SECRET"].encode() # the full "whsec_..." string TOLERANCE_SECONDS = 300 processed_event_ids = set() # use a database table with a unique key in production app = Flask(__name__) def is_valid_signature(raw_body: bytes, timestamp: str | None, signature_header: str | None) -> bool: if not timestamp or not signature_header or not signature_header.startswith("v1="): return False message = timestamp.encode() + b"." + raw_body expected = hmac.new(WEBHOOK_SECRET, message, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, signature_header[len("v1="):]) def handle_event(event: dict) -> None: print("FineProxy event", event["type"], event["id"], event["data"]) @app.post("/webhooks/fineproxy") def fineproxy_webhook(): raw_body = request.get_data() # raw bytes, before any JSON parsing timestamp = request.headers.get("X-FB-Timestamp") if not is_valid_signature(raw_body, timestamp, request.headers.get("X-FB-Signature")): abort(400) if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS: abort(400) event = json.loads(raw_body) if event["id"] in processed_event_ids: return "", 200 # duplicate: already handled processed_event_ids.add(event["id"]) handle_event(event) # keep this fast, or hand it to a job queue return "", 200 if __name__ == "__main__": app.run(port=3000) ``` With FastAPI, read the raw body with `await request.body()` and move the work to a background task so the response goes out immediately: ```python # pip install fastapi uvicorn import hashlib import hmac import json import os import time from fastapi import BackgroundTasks, FastAPI, HTTPException, Request, Response WEBHOOK_SECRET = os.environ["FINEPROXY_WEBHOOK_SECRET"].encode() TOLERANCE_SECONDS = 300 processed_event_ids = set() app = FastAPI() def is_valid_signature(raw_body: bytes, timestamp: str | None, signature_header: str | None) -> bool: if not timestamp or not signature_header or not signature_header.startswith("v1="): return False expected = hmac.new(WEBHOOK_SECRET, timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, signature_header[len("v1="):]) def handle_event(event: dict) -> None: print("FineProxy event", event["type"], event["id"], event["data"]) @app.post("/webhooks/fineproxy") async def fineproxy_webhook(request: Request, background_tasks: BackgroundTasks): raw_body = await request.body() timestamp = request.headers.get("x-fb-timestamp") if not is_valid_signature(raw_body, timestamp, request.headers.get("x-fb-signature")): raise HTTPException(status_code=400, detail="invalid signature") if abs(time.time() - int(timestamp)) > TOLERANCE_SECONDS: raise HTTPException(status_code=400, detail="timestamp outside tolerance") event = json.loads(raw_body) if event["id"] not in processed_event_ids: processed_event_ids.add(event["id"]) background_tasks.add_task(handle_event, event) return Response(status_code=200) ``` To debug a mismatch, compute the expected value by hand from a saved body: ```bash printf '%s.%s' "$X_FB_TIMESTAMP" "$(cat body.json)" \ | openssl dgst -sha256 -hmac "$FINEPROXY_WEBHOOK_SECRET" -hex ``` The most common causes of a mismatch are a body that was parsed and re-serialized before hashing, a secret without its `whsec_` prefix, and comparing against the header value with the `v1=` prefix still attached. ## Handle deliveries safely - **Respond with 2xx quickly.** Return `200` as soon as the signature is valid and the event is stored, then do the real work asynchronously. - **De-duplicate by event ID.** Store `X-FB-Event-Id` (body `id`) with a unique constraint and skip events you have already processed, so a repeated delivery of the same event does nothing. - **Make handlers safe to run twice.** A manual redelivery can arrive with a different event ID than the original (see below), so base side effects on the current state of the resource, not only on the event ID. - **Don't rely on order.** Use `created_at` and re-read the current state from the API (for example `GET /api/v1/customer/services/{service_id}`) before acting. - **Treat webhooks as hints for money.** For deposits, confirm the credit in the ledger (`GET /api/v1/customer/wallet/ledger`) before releasing anything to your users. See [Wallet and payments](/developers/docs/guides/wallet/). ## Send a test event `POST /api/v1/customer/webhooks/{endpoint_id}/test` queues a `ping` delivery to the endpoint: ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/webhooks/$ENDPOINT_ID/test" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```json { "id": "00000000-0000-0000-0000-000000000001", "event_id": "00000000-0000-0000-0000-000000000002", "endpoint_id": "00000000-0000-0000-0000-000000000000", "event_type": "ping", "status": "pending", "attempts": 0, "next_attempt_at": "2026-11-27T09:43:41.442178Z", "last_response_code": null, "last_response_body": null, "last_error": null, "created_at": "2026-11-27T09:43:41.431885Z", "updated_at": null } ``` Delivery is asynchronous: in testing the `ping` reached the receiver about 20 seconds after this call, and the delivery then showed `status: "delivered"`, `attempts: 1`, `last_response_code: 200`. Reference: [Send test](/developers/docs/api/webhooks/#post-api-send-test). ## Inspect deliveries and redeliver `GET /api/v1/customer/webhooks/{endpoint_id}/deliveries` returns an array of recent deliveries; `limit` is 1–50 (default 50). ```bash curl "https://fineproxy.org/account_new/api/v1/customer/webhooks/$ENDPOINT_ID/deliveries?limit=20" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` | Field | Meaning | | --- | --- | | `id` | Delivery ID. | | `event_id`, `event_type` | The event delivered. | | `status` | `pending` while queued, `delivered` after your endpoint accepted it. | | `attempts` | Delivery attempts so far. | | `next_attempt_at` | When the next attempt is scheduled. | | `last_response_code`, `last_response_body`, `last_error` | What your endpoint answered on the last attempt, or the connection error. | To send a delivery again, call `POST /api/v1/customer/webhooks/deliveries/{delivery_id}/redeliver`. It returns `201` with a **new** delivery: a new `id`, and in testing also a new `event_id`. The original row is not reused. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/webhooks/deliveries/$DELIVERY_ID/redeliver" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Each endpoint also reports `consecutive_failures` and `disabled_reason` (`GET /api/v1/customer/webhooks/{endpoint_id}`). If events stop arriving, check `is_active`, those two fields and the latest deliveries. References: [List deliveries](/developers/docs/api/webhooks/#get-api-list-deliveries), [Redeliver](/developers/docs/api/webhooks/#post-api-redeliver), [Get webhook](/developers/docs/api/webhooks/#get-api-get-webhook). ## Update, disable or delete an endpoint `PATCH /api/v1/customer/webhooks/{endpoint_id}` changes any of `url`, `events`, `description` and `is_active`. Send only the fields you change: ```bash curl -X PATCH "https://fineproxy.org/account_new/api/v1/customer/webhooks/$ENDPOINT_ID" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"is_active": false}' ``` The response is the endpoint with an updated `updated_at`. Set `is_active` back to `true` to resume. `GET /api/v1/customer/webhooks` lists all your endpoints (without secrets). `DELETE /api/v1/customer/webhooks/{endpoint_id}` removes the endpoint and returns `{"message": "ok"}`. References: [List webhooks](/developers/docs/api/webhooks/#get-api-list-webhooks), [Update webhook](/developers/docs/api/webhooks/#patch-api-update-webhook), [Delete webhook](/developers/docs/api/webhooks/#delete-api-delete-webhook). ## Common pitfalls - **Losing the secret.** It is shown only in the create response. - **Verifying a parsed body.** Frameworks that parse JSON before your handler change the bytes; use the raw body. - **Doing slow work before responding.** Acknowledge first, then process. - **Polling too soon after a test.** The `ping` takes a few seconds to arrive and the delivery stays `pending` until then. --- # Wallet, ledger, invoices and deposits Source: https://fineproxy.org/developers/docs/guides/wallet/ Every purchase, renewal and paid change is charged to your prepaid **wallet**, and every refund goes back to it. This guide shows how to read the balance and the ledger, find invoices, and start a deposit that you or your customer then pays in the browser. All money values are **integer cents** in the wallet currency (USD): `1200` means $12.00, negative amounts are debits. Scopes: `wallet:read` for balance, ledger and invoices; `wallet:deposit` to start a top-up. ## Check the balance ```bash curl https://fineproxy.org/account_new/api/v1/customer/wallet/balance \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/wallet/balance', { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }, }); const { balance_cents, currency } = await response.json(); console.log(`${(balance_cents / 100).toFixed(2)} ${currency}`); ``` ```python import os import requests response = requests.get( "https://fineproxy.org/account_new/api/v1/customer/wallet/balance", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) response.raise_for_status() wallet = response.json() print(f"{wallet['balance_cents'] / 100:.2f} {wallet['currency']}") ``` ```json { "wallet_id": "00000000-0000-0000-0000-000000000000", "owner_type": "customer", "balance_cents": 5000, "currency": "USD", "has_wallet": true } ``` `has_wallet: false` means no wallet exists yet and `balance_cents` is `0`. Check the balance before any paid call; a purchase the wallet cannot cover fails with `402` and changes nothing. Reference: [Get balance](/developers/docs/api/wallet/#get-get-balance). MCP: [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance). ## Read the ledger `GET /api/v1/customer/wallet/ledger` lists completed money movements, newest first. Paginate with `offset` and `limit` (1–200, default 50); `total` is the number of entries. ```bash curl "https://fineproxy.org/account_new/api/v1/customer/wallet/ledger?limit=5&offset=0" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript async function* ledgerEntries(pageSize = 50) { for (let offset = 0; ; offset += pageSize) { const url = `https://fineproxy.org/account_new/api/v1/customer/wallet/ledger?limit=${pageSize}&offset=${offset}`; const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` } }); const page = await response.json(); yield* page.entries; if (offset + page.entries.length >= page.total) return; await new Promise((resolve) => setTimeout(resolve, 1000)); } } for await (const entry of ledgerEntries()) console.log(entry.created_at, entry.amount_cents, entry.description); ``` ```python import os import time import requests def ledger_entries(page_size=50): offset = 0 while True: response = requests.get( "https://fineproxy.org/account_new/api/v1/customer/wallet/ledger", params={"limit": page_size, "offset": offset}, headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) response.raise_for_status() page = response.json() yield from page["entries"] offset += len(page["entries"]) if not page["entries"] or offset >= page["total"]: return time.sleep(1) for entry in ledger_entries(): print(entry["created_at"], entry["amount_cents"], entry["description"]) ``` Two real entries — a purchase and a refund: ```json { "entries": [ { "id": "00000000-0000-0000-0000-000000000001", "wallet_id": "00000000-0000-0000-0000-000000000000", "idempotency_key": "rotating_cancel_refund:00000000-0000-0000-0000-000000000002:2026-11-27#s1", "provider": null, "provider_tx_id": null, "amount_cents": 3500, "balance_after_cents": 10000, "entry_type": "refund", "status": "completed", "description": "Rotating cancel refund: DC Rotating 2500k requests (package=3500, topup=0)", "service_id": "00000000-0000-0000-0000-000000000002", "usage_requests": null, "usage_bytes": null, "created_at": "2026-11-27T10:04:47.926477Z", "auto_topup": false }, { "id": "00000000-0000-0000-0000-000000000003", "wallet_id": "00000000-0000-0000-0000-000000000000", "idempotency_key": "svc_create:...", "provider": null, "provider_tx_id": null, "amount_cents": -3500, "balance_after_cents": 6500, "entry_type": "debit", "status": "completed", "description": "Purchase: Rotating Proxies 2.5M Credits", "service_id": "00000000-0000-0000-0000-000000000002", "usage_requests": null, "usage_bytes": null, "created_at": "2026-11-27T10:04:24.239082Z", "auto_topup": false } ], "total": 9, "offset": 0, "limit": 5 } ``` | Field | Meaning | | --- | --- | | `amount_cents` | Signed amount: negative for debits, positive for credits and refunds. | | `balance_after_cents` | Running balance right after this entry. | | `entry_type` | Seen values: `debit`, `refund`, `correction` (manual adjustment). | | `status` | `completed` for settled entries. | | `description` | Human-readable reason, such as `Composite purchase (balance): …`, `Renew: …`, `Period renewal: …`. | | `service_id` | The service the entry belongs to, or `null`. | | `provider`, `provider_tx_id` | Payment provider details for deposits. | | `idempotency_key` | Server-side key of the operation; one operation never produces two entries. | | `auto_topup` | `true` when the credit came from an automatic top-up of a saved card. | The ledger is the source of truth for money: reconcile against it rather than against webhook events or API responses alone. Reference: [List ledger](/developers/docs/api/wallet/#get-list-ledger). MCP: [`list_ledger`](/developers/docs/mcp/tools/#list_ledger). ## Invoices Two sources exist: - **Invoices of the current billing system** — list them with the MCP tool [`list_invoices`](/developers/docs/mcp/tools/#list_invoices) (or fetch one with [`get_invoice`](/developers/docs/mcp/tools/#get_invoice)). Each invoice has `lago_id`, `number`, `issuing_date`, `status` (for example `finalized`), `payment_status` (`pending`, `succeeded`, `failed`), `total_amount_cents`, `currency` and `pdf_download_url`. - **Archived invoices from the previous billing system** — `GET /api/v1/customer/me/whmcs-invoices`, paginated with `offset` and `limit` (1–200). Each item has `invoice_num`, `status`, `invoice_date`, `due_date`, `date_paid`, `total_cents`, `currency` and `payment_method`. An account without history gets `"items": []`. ```bash curl "https://fineproxy.org/account_new/api/v1/customer/me/whmcs-invoices?limit=50" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Download an invoice PDF with the same API key. Pass the invoice's `lago_id` as `invoice_id`, and build the URL from the REST base URL: ```bash curl -o invoice.pdf \ "https://fineproxy.org/account_new/api/v1/customer/invoices/$INVOICE_ID/pdf" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` An unknown ID returns `404 {"detail":"Invoice not found"}`. References: [List archived invoices](/developers/docs/api/wallet/#get-list-whmcs-invoices), [Download invoice PDF](/developers/docs/api/wallet/#get-download-the-pdf-for-a-specific-invoice). ## Top up the wallet A deposit is started through the API but **paid by a person** on the payment provider's page. The API returns a checkout link; the wallet is credited only after the provider confirms the payment. ### 1. Pick a gateway `POST .../deposit/init` accepts the gateways `stripe`, `heleket`, `freekassa` and `onepayment`. The MCP tool [`list_payment_gateways`](/developers/docs/mcp/tools/#list_payment_gateways) shows which ones your account can use right now: ```json { "gateways": [ { "provider": "heleket", "kyc_required_level": "off", "kyc_ok": true, "payer_fee_bps": 0 }, { "provider": "stripe", "kyc_required_level": "liveness", "kyc_ok": false, "payer_fee_bps": 0 } ] } ``` A gateway with `kyc_ok: false` needs identity verification first. ### 2. Start the deposit ```bash curl -X POST https://fineproxy.org/account_new/api/v1/customer/wallet/deposit/init \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"gateway": "heleket", "amount_cents": 1000, "idempotency_key": "deposit-2026-11-27-001"}' ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/wallet/deposit/init', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ gateway: 'heleket', amount_cents: 1000, idempotency_key: 'deposit-2026-11-27-001' }), }); if (!response.ok) throw new Error(`Deposit init failed ${response.status}: ${await response.text()}`); const deposit = await response.json(); console.log('Open this page to pay:', deposit.payment_url, deposit.our_order_id); ``` ```python response = requests.post( "https://fineproxy.org/account_new/api/v1/customer/wallet/deposit/init", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={"gateway": "heleket", "amount_cents": 1000, "idempotency_key": "deposit-2026-11-27-001"}, timeout=30, ) response.raise_for_status() deposit = response.json() print("Open this page to pay:", deposit["payment_url"], deposit["our_order_id"]) ``` ```json { "payment_url": "https://checkout.example.com/invoice/00000000-0000-0000-0000-000000000000", "our_order_id": "HLK-0000000000000000", "amount_cents": 1000, "currency": "USD", "provider_tx_id": "00000000-0000-0000-0000-000000000000", "checkout_kind": "redirect", "pay_address": null, "pay_amount": null, "pay_currency": null } ``` | Body field | Notes | | --- | --- | | `gateway` | Required. One of the gateways above. | | `amount_cents` | Required, greater than 0. `1000` = $10.00. | | `idempotency_key` | Recommended. A repeat with the same key returns the original payment instead of creating a new one. | | `currency` | Three letters, default `USD`. | | `success_url`, `return_url` | Optional relative paths (starting with `/`) to send the payer back to after payment or cancellation. | With `checkout_kind: "redirect"`, send the payer to `payment_url`. Keep `our_order_id` to track the payment. ### 3. Wait for the credit Poll the ledger or the balance until the deposit appears, or subscribe to the `deposit.completed` [webhook](/developers/docs/guides/webhooks/). Over MCP, [`get_deposit_status`](/developers/docs/mcp/tools/#get_deposit_status) takes `our_order_id` as `order_id`, and [`list_payments`](/developers/docs/mcp/tools/#list_payments) shows all attempts, including pending and abandoned ones that never reach the ledger. > **Important:** A `200` from `deposit/init` only means a checkout was created. No money has moved until the payer completes the payment and the ledger shows the credit. ### Verification (KYC) Some gateways require identity verification first. Without it, `deposit/init` returns `403` and creates no payment: ```json { "detail": { "error": "kyc_required", "required_level": "liveness", "kyc_status": "not_started", "verification_url": "/kyc", "message": "Identity verification is required before using this payment method. Complete a quick liveness check, then try again. Cryptocurrency deposits usually do not require verification." } } ``` Complete verification in the dashboard or choose another gateway. ### Crypto helper endpoints Two read-only endpoints support crypto top-ups: `GET .../deposit/nowpayments/coins` lists the allowed coin tickers (the network is part of the ticker, such as `usdttrc20`), and `GET .../deposit/nowpayments/quote?pay_currency=&amount_cents=` returns `pay_amount`, `price_amount`, `minimum_usd` and `minimum_met`. The quote creates no payment. The query parameter is `pay_currency`; `currency` is rejected with `422`. These endpoints depend on an external provider and can return `503` while it is unavailable — retry later or use another gateway: ```json { "detail": { "error": "nowpayments_unavailable", "message": "The payment method is temporarily unavailable. Please try again." } } ``` References: [Init deposit](/developers/docs/api/wallet/#post-init-deposit), [Coins](/developers/docs/api/wallet/#get-list-nowpayments-coins), [Crypto quote](/developers/docs/api/wallet/#get-get-nowpayments-quote). MCP: [`init_deposit`](/developers/docs/mcp/tools/#init_deposit). ## MCP wallet tools | Tool | Purpose | | --- | --- | | [`wallet_balance`](/developers/docs/mcp/tools/#wallet_balance) | Balance in cents. | | [`list_ledger`](/developers/docs/mcp/tools/#list_ledger) | Ledger with `offset` / `limit`. | | [`list_invoices`](/developers/docs/mcp/tools/#list_invoices), [`get_invoice`](/developers/docs/mcp/tools/#get_invoice) | Invoices with `pdf_download_url`. | | [`list_payment_gateways`](/developers/docs/mcp/tools/#list_payment_gateways) | Gateways and their verification requirements. | | [`init_deposit`](/developers/docs/mcp/tools/#init_deposit) | Start a top-up; requires `idempotency_key`. Returns a `payment_url` for a person to open. | | [`get_deposit_status`](/developers/docs/mcp/tools/#get_deposit_status), [`list_payments`](/developers/docs/mcp/tools/#list_payments) | Track pending top-ups. | ## Common pitfalls - **Treating cents as dollars.** `balance_cents: 5000` is $50.00. - **Assuming a deposit succeeded** because `deposit/init` returned `200`. Wait for the ledger entry. - **Retrying `deposit/init` without an idempotency key**, which creates a second checkout. - **Confusing `pricing-info` millicents with cents.** Only `price_millicents_per_ip` in the pricing terms uses millicents. --- # Support tickets Source: https://fineproxy.org/developers/docs/guides/support-tickets/ The tickets API gives your integration the same support channel as the dashboard: you can open a ticket when something breaks, follow the conversation and close it when it is resolved. Real people answer these tickets, so use the API for real issues only — not for tests or health checks. Reading needs `tickets:read`; creating, replying and closing need `tickets:write`. ## List your tickets `GET /api/v1/customer/tickets` returns your tickets, newest first, paginated with `offset` and `limit` (default 50). ```bash curl "https://fineproxy.org/account_new/api/v1/customer/tickets?limit=20" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/tickets?limit=20', { headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}` }, }); const { tickets, total } = await response.json(); for (const t of tickets) console.log(t.id, t.status, t.subject); ``` ```python import os import requests response = requests.get( "https://fineproxy.org/account_new/api/v1/customer/tickets", params={"limit": 20}, headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, timeout=30, ) response.raise_for_status() for ticket in response.json()["tickets"]: print(ticket["id"], ticket["status"], ticket["subject"]) ``` ```json { "tickets": [ { "id": "00000000-0000-0000-0000-000000000000", "subject": "Proxies in DE return timeouts since 09:00 UTC", "status": "open", "service_id": "00000000-0000-0000-0000-000000000001", "last_message_at": "2026-11-27T09:43:54.364556Z", "created_at": "2026-11-27T09:43:54.364556Z", "updated_at": "2026-11-27T09:43:54.371262Z" } ], "total": 1, "offset": 0, "limit": 20 } ``` `status` is one of `open`, `in_progress`, `waiting`, `customer_replied` and `closed`. Reference: [List tickets](/developers/docs/api/tickets/#get-list-tickets). MCP: [`list_tickets`](/developers/docs/mcp/tools/#list_tickets). ## Open a ticket `POST /api/v1/customer/tickets` with a `subject` (1–500 characters) and a `message` (1–10,000 characters). Link the ticket to the affected service with `service_id` — it saves support a round of questions. ```bash curl -X POST https://fineproxy.org/account_new/api/v1/customer/tickets \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "subject": "Proxies in DE return timeouts since 09:00 UTC", "message": "Requests through 203.0.113.10:8080 time out since 09:00 UTC. x-request-id of a failing API call: 0123456789abcdef0123456789abcdef.", "service_id": "00000000-0000-0000-0000-000000000001" }' ``` ```javascript const response = await fetch('https://fineproxy.org/account_new/api/v1/customer/tickets', { method: 'POST', headers: { Authorization: `Bearer ${process.env.FINEPROXY_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ subject: 'Proxies in DE return timeouts since 09:00 UTC', message: 'Requests through 203.0.113.10:8080 time out since 09:00 UTC.', service_id: process.env.SERVICE_ID, }), }); if (!response.ok) throw new Error(`Ticket failed ${response.status}: ${await response.text()}`); const ticket = await response.json(); console.log(ticket.id, ticket.status); ``` ```python response = requests.post( "https://fineproxy.org/account_new/api/v1/customer/tickets", headers={"Authorization": f"Bearer {os.environ['FINEPROXY_API_KEY']}"}, json={ "subject": "Proxies in DE return timeouts since 09:00 UTC", "message": "Requests through 203.0.113.10:8080 time out since 09:00 UTC.", "service_id": os.environ["SERVICE_ID"], }, timeout=30, ) response.raise_for_status() ticket = response.json() print(ticket["id"], ticket["status"]) ``` The `201` response is the full ticket with its first message: ```json { "id": "00000000-0000-0000-0000-000000000000", "subject": "Proxies in DE return timeouts since 09:00 UTC", "status": "open", "service_id": "00000000-0000-0000-0000-000000000001", "last_message_at": "2026-11-27T09:43:54.364556Z", "created_at": "2026-11-27T09:43:54.364556Z", "updated_at": "2026-11-27T09:43:54.371262Z", "messages": [ { "id": "00000000-0000-0000-0000-000000000002", "ticket_id": "00000000-0000-0000-0000-000000000000", "author_kind": "customer", "message": "Requests through 203.0.113.10:8080 time out since 09:00 UTC.", "created_at": "2026-11-27T09:43:54.364556Z", "attachments": [] } ] } ``` A good ticket says what you expected, what happened, since when, and includes the `service_id`, the proxy IP and port involved and the `x-request-id` header of a failing API response. ### Attach files `attachments` (up to 5) carries files inline as base64: ```json { "subject": "Proxy handshake fails", "message": "Log of the failing connection attached.", "attachments": [ { "filename": "curl-verbose.txt", "content_type": "text/plain", "data_base64": "KiAgIFRyeWluZyAyMDMuMC4xMTMuMTA6ODA4MC4uLgo=" } ] } ``` The server checks that the declared `content_type` matches the file content. Reference: [Create ticket](/developers/docs/api/tickets/#post-create-ticket). MCP: [`create_ticket`](/developers/docs/mcp/tools/#create_ticket) (`subject`, `message`, optional `service_id`). ## Read a ticket and its replies `GET /api/v1/customer/tickets/{ticket_id}` returns the ticket with `messages[]` in chronological order. Each message has `author_kind` (`customer` for your messages), `message`, `created_at` and `attachments[]` — attachment metadata with `id`, `filename`, `content_type` and `size`. ```bash curl "https://fineproxy.org/account_new/api/v1/customer/tickets/$TICKET_ID" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` To know when support has answered, poll this endpoint at a calm interval (minutes, not seconds) and look at `status` and the newest message. Reference: [Get ticket](/developers/docs/api/tickets/#get-get-ticket). MCP: [`get_ticket`](/developers/docs/mcp/tools/#get_ticket). ## Download an attachment ```bash curl -o attachment.bin \ "https://fineproxy.org/account_new/api/v1/customer/tickets/$TICKET_ID/attachments/$ATTACHMENT_ID/download" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" ``` Take both IDs from `GET .../tickets/{ticket_id}`. Only the ticket owner can download. Over MCP, [`get_ticket_attachment`](/developers/docs/mcp/tools/#get_ticket_attachment) returns the content as base64; files larger than 5 MB are not inlined there — download them with this REST endpoint and the same API key. Reference: [Download ticket attachment](/developers/docs/api/tickets/#get-download-ticket-attachment). ## Reply to a ticket `POST /api/v1/customer/tickets/{ticket_id}/reply` with a `message` and optional `attachments` (up to 5, same format as above). The response is the updated ticket. ```bash curl -X POST "https://fineproxy.org/account_new/api/v1/customer/tickets/$TICKET_ID/reply" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"message": "Still happening on 203.0.113.11 as well."}' ``` Closed tickets cannot receive replies. Reopen the ticket first (see below) or open a new one. Reference: [Reply ticket](/developers/docs/api/tickets/#post-reply-ticket). MCP: [`reply_ticket`](/developers/docs/mcp/tools/#reply_ticket). ## Close or reopen a ticket `PATCH /api/v1/customer/tickets/{ticket_id}/status` with `{"status": "closed"}` closes a ticket; `{"status": "open"}` reopens a closed one. ```bash curl -X PATCH "https://fineproxy.org/account_new/api/v1/customer/tickets/$TICKET_ID/status" \ -H "Authorization: Bearer $FINEPROXY_API_KEY" \ -H "Content-Type: application/json" \ -d '{"status": "closed"}' ``` The response is the ticket with `status: "closed"`. Close tickets once your issue is solved so support knows no more work is needed. Reference: [Update ticket status](/developers/docs/api/tickets/#patch-update-ticket-status). MCP: [`close_ticket`](/developers/docs/mcp/tools/#close_ticket) — closing an already closed ticket is a no-op. ## When an AI agent opens tickets The MCP tools let an agent open tickets on your behalf. Keep a human in the loop: ask the agent to show you the subject and message before it calls `create_ticket`, and give exploratory agents a key without `tickets:write`. Some situations require support by design — for example, a [cancellation inside the 3-day cooldown](/developers/docs/guides/manage-services/#cancel-a-service) — and those are good reasons for a ticket. ## Common pitfalls - **Opening tickets from automated tests or monitors.** Each ticket reaches a person. Alert yourself instead and open a ticket once you have confirmed the problem. - **Replying to a closed ticket.** It is rejected; reopen it with the status endpoint. - **Sending secrets.** Never paste API keys or proxy passwords into tickets; support does not need them. --- # MCP tools reference Source: https://fineproxy.org/developers/docs/mcp/tools/ - `wallet_balance` (scopes: wallet:read): Get the prepaid wallet balance of the account (integer cents + currency). - `list_ledger` (scopes: wallet:read): List wallet transactions (newest first). Entries linked to a service carry its service_id. Inputs: offset, limit. - `list_services` (scopes: services:read): List the account's services (proxy/VPN subscriptions) with status and expiry. Inputs: offset, limit. - `get_service` (scopes: services:read): Get full details of one service (status, expiry, params, price snapshot). Inputs: service_id. - `list_proxy_ips` (scopes: services:read): List the proxy IP endpoints allocated to a service. Inputs: service_id. - `get_proxy_credentials` (scopes: services:read): Get proxy connection credentials for a service. Pass reveal=true for the plain-text password. Inputs: service_id, reveal. - `get_whitelist` (scopes: services:read): List the IP whitelist entries of a proxy service. Inputs: service_id. - `get_usage` (scopes: usage:read): Get traffic/request usage statistics for a service over a time window (ISO 8601). Inputs: service_id, start, end. - `list_catalog` (scopes: catalog:read): List fixed pre-priced catalogue products (integer-cent prices). Often empty — proxies are normally sold via the composite constructor: use list_countries + quote_composite + order_composite instead. Inputs: offset, limit. - `list_countries` (scopes: catalog:read): List countries available for composite proxy orders, with live IP stock. Returns ISO 3166-1 alpha-2 codes to use as 'country' in quote_composite / order_composite / add_ips, plus the minimum order size. Call this FIRST when buying proxies. Inputs: product_kind, geo_source. - `get_pricing_info` (scopes: catalog:read): Get the composite pricing terms: volume-discount ladder, period discounts, minimum order/segment IP floors, whitelist quota and free IP-refresh interval. Free and read-only — use it to plan orders and explain prices. - `plan_composite` (scopes: catalog:read): Auto-distribute a desired total IP count across available countries proportionally to stock (no money involved). Returns ready-to-use segments for quote_composite / order_composite. Useful when the customer says 'give me N IPs, any mix'. Inputs: total_ip, product_kind, geo_source, excluded_countries. - `quote_composite` (scopes: catalog:read): Get a non-binding price quote for a composite proxy mix (segments of {country: ISO code like 'DE', count}). Free — always call before order_composite and pass its total_price_cents as expected_total_cents. For ACTIVE partners with wholesale_discount_percent, totals are already discounted and retail_* / partner_discount_* fields are set (same as authenticated POST /billing/composite/quote). Discover countries with list_countries. Inputs: segments, product_kind, period_months, geo_source. - `get_refresh_status` (scopes: services:read): Check whether the next IP refresh (rotation) of a service is free or paid, and the price in cents if paid. Inputs: service_id. - `list_tickets` (scopes: tickets:read): List the account's support tickets, newest first. Inputs: offset, limit. - `get_ticket` (scopes: tickets:read): Get a single support ticket with its full message history (chronological). Inputs: ticket_id. - `get_ticket_attachment` (scopes: tickets:read): Download a ticket attachment's content as base64 (ids come from get_ticket). Files larger than 5 MB are not inlined — fetch them via REST GET /api/v1/customer/tickets/{ticket_id}/attachments/{attachment_id}/download with the same API key. Inputs: ticket_id, attachment_id. - `get_profile` (scopes: customer:read): Get the account profile: email, name, verification/KYC status, locale. - `get_my_ip` (scopes: customer:read): Detect the caller's IP address. WARNING: over MCP this is the IP of the machine running the agent, not necessarily the human's — confirm with them before using it as a whitelist_ip for a proxy service. - `get_access_log` (scopes: customer:read): Get the account's login history (who/when signed in) for 'was there unauthorized access' style questions. Inputs: page, per_page. - `list_available_addons` (scopes: services:read): List addons purchasable for a service (type, price, params schema). Already-active addons are excluded. Inputs: service_id. - `list_active_addons` (scopes: services:read): List addons currently active on a service. Inputs: service_id. - `get_usage_overview` (scopes: usage:read): Get an overview snapshot of proxy usage: request/byte totals, success rate, latency percentiles, error breakdown. Optionally scoped to one service_id. Inputs: start, end, service_id. - `get_usage_timeseries` (scopes: usage:read): Get bucketed (hour|day) timeseries of proxy usage: success rate and latency percentiles per bucket. Inputs: start, end, service_id, granularity. - `get_top_destinations` (scopes: usage:read): Get the top destinations (domains or IPs) ranked by request count. Inputs: start, end, service_id, by, limit. - `get_diagnostics` (scopes: usage:read): Diagnose failing requests: HTTP status distribution, error_codes broken down by semantic category (network|dns|timeout|upstream|auth|client|other) with counts and share, and the top failing destinations. Use this when the customer reports errors or a low success rate — do not guess the cause from get_usage_overview alone. Inputs: start, end, service_id. - `get_recommendations` (scopes: usage:read): Get rule-based recommendations from usage patterns (approaching limits, high error rate, unused IPs, etc). Inputs: start, end, service_id, lang. - `list_invoices` (scopes: wallet:read): List the account's Lago invoices (paginated), newest first. Each entry carries pdf_download_url — GET it with the same Bearer key used for this MCP call to fetch the PDF. Inputs: page, payment_status. - `get_invoice` (scopes: wallet:read): Get a single Lago invoice by ID, with pdf_download_url. Inputs: invoice_id. - `list_payment_gateways` (scopes: wallet:read): List payment gateways available for topping up the wallet. - `get_deposit_status` (scopes: wallet:deposit): Check the status of a wallet deposit (top-up) by its order_id. Inputs: order_id. - `list_payments` (scopes: wallet:deposit): List the account's deposit/payment attempts (includes still-pending or abandoned top-ups, unlike list_ledger which only shows completed money movements). Inputs: offset, limit, status. - `get_proxy_config` (scopes: services:read): Get the connection configuration of a rotating/backconnect proxy service. Inputs: service_id. - `cancel_service` (scopes: services:write): Cancel (terminate) a service immediately. DESTRUCTIVE and irreversible — requires confirm=true. Unused paid time is refunded to the wallet on a pro-rata basis (undiscounted daily rate — the discount burns on early cancellation); the response's refund_cents is the exact amount credited. To stop future billing WITHOUT losing the remaining paid period, use set_auto_renew instead. Inputs: service_id, confirm. - `set_auto_renew` (scopes: services:write): Turn auto-renewal on or off for a service. When off, the service expires (without a refund) at the end of the current paid period instead of debiting the wallet again. Inputs: service_id, enabled. - `purchase_addon` (spends money; scopes: services:write, wallet:spend): Purchase an addon for a service (e.g. extra whitelist IPs). MONEY: requires expected_price_cents — call list_available_addons first, take the displayed TOTAL for the chosen quantity (unit × count for stackable addons), and pass that exact integer. On mismatch the tool buys nothing and returns the current price. Idempotent per idempotency_key. Inputs: service_id, addon_type, params, expected_price_cents, idempotency_key. - `disable_addon` (scopes: services:write): Disable (cancel) an active addon. DESTRUCTIVE — requires confirm=true. Issues a prorated refund for the unused portion of the current billing period; the response's refund_cents is the exact amount credited. Inputs: service_id, addon_id, confirm. - `rotate_proxy_credentials` (scopes: services:write): Rotate the login/password of a proxy service. The new password is returned exactly once — store it immediately. Inputs: service_id, rotate_password, new_username, udp_enabled. - `update_whitelist_limits` (scopes: services:write): Set the per-IP connection limit (conn_limit) for whitelist entries of a proxy service. Provide every current whitelist IP exactly once, each value >= 1, and the sum must equal the service's connection cap (see get_whitelist for conn_cap and entries). Any other shape is rejected 422. Inputs: service_id, limits. - `init_deposit` (scopes: wallet:deposit): Initiate a wallet top-up via a payment gateway and get a payment_url to hand to the customer. The wallet is credited only after the gateway confirms via webhook — poll get_deposit_status or wallet_balance, do not assume the deposit succeeded just because this call returned. Inputs: amount_cents, gateway, currency, pay_currency, idempotency_key. - `buy_service` (spends money; scopes: services:write, wallet:spend): Purchase a fixed catalogue product (only products returned by list_catalog), paying from the wallet balance. MONEY: debits the wallet at the catalogue price — inspect it first. For proxies by country mix use order_composite instead (this tool cannot price composite orders). Idempotent per (product_id, params). Inputs: product_id, params, auto_renew. - `order_composite` (spends money; scopes: services:write, wallet:spend): Purchase a composite multi-country proxy service (segments of {country: ISO code like 'DE', count}), paying from the wallet balance. MONEY: charges the composite price — call quote_composite first and pass its total_price_cents as expected_total_cents; on price mismatch the order is rejected without charging. whitelist_ips (at least one IPv4) is mandatory for proxy access. Idempotent per idempotency_key. Inputs: segments, product_kind, period_months, geo_source, whitelist_ips, auto_renew, idempotency_key, expected_total_cents. - `quote_dedicated` (scopes: catalog:read): Get a non-binding price quote for a dedicated (tenant-exclusive) proxy mix (segments of {country: ISO code, count}), priced by your tenant's own grid. Free — always call before order_dedicated and pass its total_price_cents as expected_total_cents. Also reports, per segment, how many IPs are sellable to YOUR account right now. Product kind (datacenter or ISP), period, pre-purchase add-ons, partner % and promo all price exactly as in the cabinet. The tenant vitrine must be enabled (404 otherwise); proxy_isp needs a configured ISP multiplier (404 otherwise). Inputs: segments, geo_source, product_kind, period_months, promo_code, extra_whitelist_count, udp_unlock, extra_connections_count. - `order_dedicated` (spends money; scopes: services:write, wallet:spend): Purchase a dedicated (tenant-exclusive) proxy service (segments of {country: ISO code like 'DE', count}), paying from the wallet balance. MONEY: call quote_dedicated first and pass its total_price_cents as expected_total_cents; on price mismatch the order is rejected without charging. whitelist_ips (at least one IPv4) is mandatory for proxy access. The IPs are picked only after the charge; if none are left the order is cancelled and the money stays on the balance. Idempotent per idempotency_key — a retry with the same body returns the same order. Inputs: segments, geo_source, product_kind, period_months, promo_code, extra_whitelist_count, udp_unlock, extra_connections_count, whitelist_ips, auto_renew, idempotency_key, expected_total_cents. - `renew_service` (spends money; scopes: services:write, wallet:spend): Renew a subscription service for more billing periods, paying from the wallet. MONEY: debits the wallet at the price the service was purchased at (see get_service price snapshot). A service suspended for quota exhaustion (get_service suspend_reason=quota_exhausted) is restored by a quota top-up in the cabinet or the next monthly grant; renew_service returns 409 for it except within 7 days of expires_at, and even then only extends the period. Inputs: service_id, period_count. - `quote_refresh` (scopes: services:read): Preview an IP refresh without charging or writing anything. Without partial: pass geo_counts ({ISO-2: count}, sum must equal the number of replaced IPs) and get price_cents/is_free plus per-country {requested, available}; shortfall=true means refresh_ips would refuse. With partial=true (shared pool only, no geo_counts/target_ips) get the server-planned 'replace what is available' result: replaced_count, kept_count, planned_geo_counts and per-country {held, available} — exactly what refresh_ips(partial=true) would do on this snapshot. Free. Inputs: service_id, target_ips, geo_counts, geo_source, partial. - `refresh_ips` (spends money; scopes: services:write, wallet:spend): Refresh (rotate) the allocated IPs of a proxy service. May be MONEY: the first refresh in the free window is free, later ones are charged — call get_refresh_status first. If expected_amount_cents is provided and does not match the actual price, the call is rejected without charging. Optional geo_counts ({ISO-2: count}) picks the NEW geography of the replaced IPs under the service's own geo source; its sum must equal the number of replaced IPs (target_ips or the whole allocation), otherwise the call is rejected without charging. Same price as a plain refresh. On a pool shortfall nothing is charged and nothing changes. partial=true (shared pool only, no target_ips/geo_counts) replaces only as many IPs as the pool actually has per country, keeps the rest (kept_count) and costs the same; if nothing is available nothing is charged and the free slot is kept — quote it with quote_refresh first. Inputs: service_id, idempotency_key, target_ips, geo_counts, partial, expected_amount_cents. - `get_import_shortfall_status` (scopes: services:read): Read-only imported-contract shortfall status for a proxy service: whether the service is under-delivering IPs against its immutable imported contract, the contracted vs allocated counts, positive shortfall or report-only overshoot, and eligibility for a free restore. No mutation. Inputs: service_id. - `quote_import_shortfall_restore` (scopes: services:read): Read-only preview of the free imported-contract shortfall restore: per-country free-pool availability for a desired growth geography and whether the restore would be refused for insufficient stock. Never charges and never writes. The free restore charges zero and touches no wallet. Inputs: service_id, growth_geo. - `restore_import_shortfall` (scopes: services:write): Restore a proxy service that is under-delivering IPs against its immutable imported contract, growing its allocation to the contracted count for free (always $0, no wallet/ledger/entitlement/renewal/cooldown effect). Atomic: a per-country free-pool shortfall or an unresolved geo fails with no partial change. Provide the current shortfall status quotes as guards; idempotent per idempotency_key (retries replay the exact result). Inputs: service_id, idempotency_key, expected_snapshot_id, expected_snapshot_version, expected_allocated, expected_shortfall, growth_geo. - `add_ips` (spends money; scopes: services:write, wallet:spend): Add IPs to an active composite or dedicated proxy service (segments of {country: ISO code like 'DE', count}). MONEY: charges the prorated cost of the remaining paid period; a dedicated top-up is priced at the tier of the NEW total IP count in the service's own DC/ISP class. Pass expected_charge_cents from the quote — mandatory for dedicated. Inputs: service_id, segments, idempotency_key, expected_charge_cents. - `add_whitelist_ip` (scopes: services:write): Add a single IPv4 address to a proxy service's IP whitelist (no CIDR). Inputs: service_id, ip, label. - `remove_whitelist_ip` (scopes: services:write): Remove an IP address from a proxy service's IP whitelist. The last whitelisted IP of a datacenter, ISP or personal proxy cannot be removed — use replace_whitelist_ip instead. Inputs: service_id, ip. - `replace_whitelist_ip` (scopes: services:write): Atomically swap one whitelisted IP for a new one (no free slot needed, no gap). Use this instead of remove+add. Inputs: service_id, old_ip, new_ip, label. - `create_ticket` (scopes: tickets:write): Open a support ticket (optionally linked to one of the account's services). Inputs: subject, message, service_id. - `reply_ticket` (scopes: tickets:write): Reply to an existing support ticket. Closed tickets cannot receive replies. Inputs: ticket_id, message. - `close_ticket` (scopes: tickets:write): Close a support ticket. Idempotent — closing an already-closed ticket is a no-op. Inputs: ticket_id. # REST API reference Every endpoint, parameter and schema is defined in the OpenAPI 3.1 specification: https://fineproxy.org/developers/openapi.json