openapi: 3.1.0
info:
  title: ProxyMarket Vendor API
  version: "1.11"
  x-verified-at: 2026-11-20
  summary: Connect your own proxy or VPN platform to ProxyMarket (market.xproxy.io) and sell through it.
  description: "Two directions. **APIs you call**: your connector sends your plans, stock, proxy health and order credentials to ProxyMarket with your vendor API key in the `X-API-Key` header. **Webhooks you implement**: ProxyMarket calls your server when a customer pays, when an order ends and when a customer changes a setting, and signs every call with `X-Signature`. Running XProxy? The panel already does all of this for you (Selling Platform → ProxyMarket); you do not need this API."
  contact:
    name: ProxyMarket support (Telegram @xproxyio)
    url: https://t.me/xproxyio
servers:
  - url: https://market.xproxy.io/api
    description: ProxyMarket. Integration calls live under /integration, key management under /vendor.
components:
  securitySchemes:
    vendorApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your vendor API key (starts with `pm_`). You create it yourself in the vendor dashboard once your vendor application is approved. It is shown only once and never expires; create one key per server you run.
    vendorLogin:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: The login token of your ProxyMarket vendor account (the one the vendor dashboard uses). Needed only to create an integration key.
    webhookSignature:
      type: apiKey
      in: header
      name: X-Signature
      description: "Sent by ProxyMarket on every webhook POST: `sha256=` + HMAC-SHA256 of the raw request body. The HMAC secret is the signing key, `SHA256(api_key)` as 64-character hex, not the raw API key. Reject the call with 401 when it does not match."
  schemas:
    ProxyType:
      type: string
      enum:
        - mobile
        - residential
        - datacenter
        - isp
        - ipv6
        - vpn
      description: "Only these six values. VLESS (Xray) plans are `vpn` with `vpn_protocol: vless`. Any other value, such as `xray`, is accepted by the API but breaks the plan: orders never get their config."
    Plan:
      type: object
      required:
        - external_id
        - name
        - proxy_type
        - protocol
        - country
        - duration_days
        - price_usd
        - stock
      properties:
        external_id:
          type: string
          description: Your own unique ID for this product (a port, a modem or a VPN profile pool). Every later call and webhook uses it.
        name:
          type: string
          description: Name shown to customers.
        description:
          type: string
          description: "Optional details. For VLESS, say the transport and TLS mode (for example XTLS-Reality or WS+TLS): customers filter on it."
        proxy_type:
          $ref: "#/components/schemas/ProxyType"
        protocol:
          type: string
          enum:
            - HTTP
            - SOCKS5
            - HTTP & SOCKS5
            - OpenVPN
            - WireGuard
            - VLESS
          description: Proxy protocol, or the VPN protocol for `vpn` plans.
        country:
          type: string
          description: Full country name, for example United States or Germany. See the supported list in the guide.
        duration_days:
          type: integer
          minimum: 1
          description: Rental length, in days, or in hours when duration_unit is hours.
        duration_unit:
          type: string
          enum:
            - days
            - hours
          default: days
        bandwidth_gb:
          type:
            - number
            - "null"
          description: Data limit in GB. null means unlimited.
        price_usd:
          type: number
          description: Price in US dollars.
        stock:
          type: integer
          minimum: 0
          description: How many can be sold now. Usually 1 per modem port.
        is_active:
          type: boolean
          default: true
          description: true shows the plan on the marketplace.
        proxy_ip:
          type: string
          description: Optional preset proxy IP. You can also return it when an order is provisioned.
        proxy_port:
          type: integer
          minimum: 1
          maximum: 65535
          description: Optional preset proxy port.
        proxy_username:
          type: string
          description: Optional preset proxy username.
        proxy_password:
          type: string
          description: Optional preset proxy password.
        rotation_link:
          type: string
          description: Optional URL that gives the proxy a new IP.
        vpn_protocol:
          type: string
          enum:
            - openvpn
            - wireguard
            - vless
          description: VPN plans only. vless is what lists a plan as Xray.
        vpn_config_template:
          type: string
          description: VPN plans only. The full client config, used when an order gets no config of its own. Embed certificates and keys; never a file path on your server.
    StockUpdate:
      type: object
      required:
        - external_id
        - stock
      properties:
        external_id:
          type: string
          description: The plan to update.
        stock:
          type: integer
          minimum: 0
          description: How many can be sold now.
        is_active:
          type: boolean
          description: Show (true) or hide (false) the plan.
    HealthReport:
      type: object
      required:
        - external_id
        - status
      properties:
        external_id:
          type: string
          description: The plan (port) this report is about.
        status:
          type: string
          enum:
            - online
            - offline
            - rotating
        current_ip:
          type: string
          description: Current public IP of the proxy.
        latency_ms:
          type: integer
          description: Response time in milliseconds.
        uptime_seconds:
          type: integer
          description: Seconds since the modem last restarted.
    Credentials:
      type: object
      description: A proxy order needs proxy_ip, proxy_port, proxy_username and proxy_password together. A VPN or VLESS order needs vpn_config_file; proxy_ip, proxy_port and rotation_link are optional extras there, and a username or password is never required.
      properties:
        proxy_ip:
          type: string
          description: Proxy server IP. On a VPN order, just the endpoint address (optional).
        proxy_port:
          type: integer
          minimum: 1
          maximum: 65535
          description: Proxy port.
        proxy_username:
          type: string
          description: Proxy login of the customer. Always sent together with proxy_password.
        proxy_password:
          type: string
          description: Proxy password of the customer.
        rotation_link:
          type: string
          description: Optional URL the customer opens to get a new IP.
        vpn_config_file:
          type: string
          minLength: 50
          description: 'VPN and VLESS orders. The complete client file, delivered to the customer exactly as sent. OpenVPN must contain `remote`, `dev tun|tap` or a `ca` block; WireGuard both `[Interface]` and `[Peer]`; VLESS a `vless://` share link (one line) or Xray client JSON with `"protocol": "vless"`.'
  responses:
    Unauthorized:
      description: The X-API-Key header is missing or wrong. Check the key you saved when you created it.
    RateLimited:
      description: Too many calls. Wait, then retry with a growing delay.
tags:
  - name: Integration key
    description: Create the vendor API key your connector uses.
  - name: Plans
    description: Publish your products, keep their stock right, and take them off sale.
  - name: Proxy health
    description: Tell ProxyMarket which proxies are up.
  - name: Orders
    description: Deliver credentials late, and end orders from your side.
  - name: Webhooks
    description: Endpoints you build on your own server. ProxyMarket calls them under the webhook_url of your key.
x-tagGroups:
  - name: APIs you call
    tags:
      - Integration key
      - Plans
      - Proxy health
      - Orders
  - name: Webhooks you implement
    tags:
      - Webhooks
paths:
  /vendor/integrations:
    post:
      operationId: createIntegrationKey
      tags:
        - Integration key
      summary: Create your vendor API key
      description: |-
        Do this once, after ProxyMarket approved your vendor application. ProxyMarket first sends `HEAD {webhook_url}/health` to your server and refuses with 422 if it gets no answer, so build that endpoint before you call this.

        The answer holds `api_key`, starting with `pm_`. **It is shown only this once**: ProxyMarket keeps only a hash and cannot give it back. Lost it? Create a new key. Your webhook signing key is `SHA256(api_key)` as hex. One key per server: if you run several independent servers, create a key for each so you can revoke them one by one.
      x-xproxy-safety: destructive
      x-agent-note: Creates a long-lived secret that is shown only once. Ask the user first, and store the returned api_key at once; never print it into chat or logs.
      x-auth-note: Uses the login token of your vendor account (the vendor dashboard), not an API key. You can also create the key in the vendor dashboard itself.
      security:
        - vendorLogin: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - webhook_url
              properties:
                name:
                  type: string
                  description: A label for this key, for example the server it runs on.
                webhook_url:
                  type: string
                  description: Base URL of your webhook server. ProxyMarket calls /health, /provision, /deprovision and /update-settings under it. Use HTTPS with a valid certificate.
            example:
              name: primary-instance
              webhook_url: https://your-vendor-host.com/marketplace
      responses:
        "200":
          description: The key was created. Save `api_key` now; it is never shown again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  api_key:
                    type: string
                    description: The raw key, pm_…. Send it as X-API-Key on every call.
              example:
                api_key: pm_EXAMPLE7f3c9a1b2d4e
        "422":
          description: ProxyMarket could not reach `HEAD {webhook_url}/health` within 5 seconds, or a field is invalid. Start your webhook server and try again.
  /integration/plans/sync:
    post:
      operationId: syncPlans
      tags:
        - Plans
      summary: Publish or update your plans
      description: |-
        Send every product you want to sell. Call it when your connector starts and whenever a product changes. A plan whose `external_id` already exists is updated; a new one is created and listed at once (no admin review).

        Plans you leave out are **not** taken off sale; use [Take a plan off sale](/docs/api/market/deactivate-plan) for that. For VPN products set `proxy_type: vpn`, put the full client file in `vpn_config_template`, or leave it out and deliver a config per order. For VLESS set `proxy_type: vpn`, `protocol: VLESS` and `vpn_protocol: vless`; never `xray`. Limit: 60 calls a minute.
      x-xproxy-safety: action
      x-agent-note: Changes what customers can buy and at what price. Show the user the plans and prices you are about to send and wait for a yes.
      security:
        - vendorApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: "#/components/schemas/Plan"
            examples:
              proxy:
                summary: Mobile proxy
                value:
                  - external_id: port-1
                    name: US Mobile 4G - Port 1
                    description: AT&T 4G LTE proxy from a real SIM card
                    proxy_type: mobile
                    protocol: HTTP
                    country: United States
                    duration_days: 30
                    duration_unit: days
                    bandwidth_gb: null
                    price_usd: 25
                    stock: 1
                    is_active: true
              wireguard:
                summary: WireGuard VPN
                value:
                  - external_id: wg-us-1
                    name: US WireGuard VPN
                    description: Personal WireGuard profile
                    proxy_type: vpn
                    protocol: WireGuard
                    country: United States
                    duration_days: 30
                    price_usd: 12
                    stock: 20
                    is_active: true
                    vpn_protocol: wireguard
              vless:
                summary: VLESS (Xray)
                value:
                  - external_id: vless-us-1
                    name: US VLESS (Xray) — Reality
                    description: VLESS over XTLS-Reality on a real T-Mobile 5G IP
                    proxy_type: vpn
                    protocol: VLESS
                    country: United States
                    duration_days: 30
                    price_usd: 15
                    stock: 10
                    is_active: true
                    vpn_protocol: vless
      responses:
        "200":
          description: What was created and what was updated, with the ProxyMarket `plan_id` of each.
          content:
            application/json:
              schema:
                type: object
                properties:
                  created:
                    type: integer
                  updated:
                    type: integer
                  plans:
                    type: array
                    items:
                      type: object
                      properties:
                        plan_id:
                          type: string
                          description: ProxyMarket ID of the plan.
                        external_id:
                          type: string
                        status:
                          type: string
                          enum:
                            - created
                            - updated
              example:
                created: 1
                updated: 1
                plans:
                  - plan_id: abc-123-uuid
                    external_id: port-1
                    status: created
                  - plan_id: def-456-uuid
                    external_id: port-2
                    status: updated
        "401":
          $ref: "#/components/responses/Unauthorized"
        "422":
          description: A plan is missing a required field or has a wrong value. The answer names the field.
        "429":
          $ref: "#/components/responses/RateLimited"
  /integration/plans/stock:
    patch:
      operationId: updateStock
      tags:
        - Plans
      summary: Update stock and visibility
      description: "A light call that changes only `stock` and `is_active`. Use it when a modem goes down (`stock: 0, is_active: false`), comes back (`stock: 1, is_active: true`), or a port is free again after an order ends. Limit: 120 calls a minute."
      x-xproxy-safety: action
      x-agent-note: Hides or shows plans on the marketplace. Confirm with the user before hiding plans that are on sale.
      security:
        - vendorApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: "#/components/schemas/StockUpdate"
            example:
              - external_id: port-1
                stock: 1
                is_active: true
              - external_id: port-2
                stock: 0
                is_active: false
      responses:
        "200":
          description: How many plans changed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  updated:
                    type: integer
              example:
                updated: 2
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          description: An external_id is not one of your plans. Sync it first.
        "429":
          $ref: "#/components/responses/RateLimited"
  /integration/plans/{external_id}:
    delete:
      operationId: deactivatePlan
      tags:
        - Plans
      summary: Take a plan off sale
      description: Removes the plan from the marketplace. Orders that are already running keep working until they end. A later [sync](/docs/api/market/sync-plans) with the same `external_id` lists it again.
      x-xproxy-safety: destructive
      x-agent-note: Stops sales of this plan. Name the plan to the user and wait for a clear yes.
      security:
        - vendorApiKey: []
      parameters:
        - name: external_id
          in: path
          required: true
          description: Your ID of the plan.
          schema:
            type: string
          example: port-1
      responses:
        "200":
          description: The plan is off sale.
          content:
            application/json:
              schema:
                type: object
                properties:
                  external_id:
                    type: string
                  status:
                    type: string
                    const: deactivated
              example:
                external_id: port-1
                status: deactivated
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          description: No plan of yours has this external_id.
  /integration/health:
    post:
      operationId: reportHealth
      tags:
        - Proxy health
      summary: Report the health of your proxies
      description: "Send the state of each proxy about every 5 minutes. This is a different thing from `HEAD {webhook_url}/health`, the [liveness check](/docs/api/market/webhook-health) ProxyMarket runs on your server: that one keeps your plans listed, this one reports single proxies. Limit: 30 calls a minute."
      x-xproxy-safety: action
      x-agent-note: Only reports data; safe to run on a timer once the user set it up.
      security:
        - vendorApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: "#/components/schemas/HealthReport"
            example:
              - external_id: port-1
                status: online
                current_ip: 203.0.113.45
                latency_ms: 42
                uptime_seconds: 86400
      responses:
        "200":
          description: How many reports were taken.
          content:
            application/json:
              schema:
                type: object
                properties:
                  received:
                    type: integer
              example:
                received: 1
        "401":
          $ref: "#/components/responses/Unauthorized"
        "429":
          $ref: "#/components/responses/RateLimited"
  /integration/orders/{order_id}/credentials:
    post:
      operationId: pushCredentials
      tags:
        - Orders
      summary: Deliver the proxy login or VPN config
      description: |-
        Use this when your [provision webhook](/docs/api/market/provision-webhook) answered `status: pending`. Deliver within **5 minutes** of that answer. The customer sees what you send right away.

        A proxy order needs `proxy_ip`, `proxy_port`, `proxy_username` and `proxy_password` together, otherwise 422. A VPN or VLESS order needs `vpn_config_file` (the complete client file, at least 50 characters); you may add `proxy_ip`, `proxy_port` and `rotation_link`, and never need a username or password. Limit: 60 calls a minute.
      x-xproxy-safety: action
      x-agent-note: Sends a customer's login. Never print the password or config into chat or logs.
      security:
        - vendorApiKey: []
      parameters:
        - name: order_id
          in: path
          required: true
          description: The order_id from the provision webhook.
          schema:
            type: string
          example: a1b2c3d4-uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Credentials"
            examples:
              proxy:
                summary: Proxy order
                value:
                  proxy_ip: 203.0.113.1
                  proxy_port: 8080
                  proxy_username: cust_abc123
                  proxy_password: YOUR_PROXY_PASSWORD
                  rotation_link: https://your-vendor-host.com/api/rotate/port-1?token=YOUR_ROTATE_TOKEN
              wireguard:
                summary: WireGuard order
                value:
                  vpn_config_file: |-
                    [Interface]
                    PrivateKey = YOUR_CLIENT_PRIVATE_KEY
                    Address = 10.0.0.2/32

                    [Peer]
                    PublicKey = YOUR_SERVER_PUBLIC_KEY
                    Endpoint = vpn.example.com:51820
                    AllowedIPs = 0.0.0.0/0
              vless:
                summary: VLESS order
                value:
                  proxy_ip: 203.0.113.1
                  proxy_port: 50046
                  rotation_link: http://203.0.113.1:22022/selling/rotate?token=YOUR_ROTATE_TOKEN
                  vpn_config_file: vless://YOUR_CLIENT_UUID@203.0.113.1:50046?encryption=none&security=reality&sni=www.example.com&fp=chrome&type=tcp&flow=xtls-rprx-vision#US-Reality
      responses:
        "200":
          description: Delivered to the customer.
          content:
            application/json:
              schema:
                type: object
                properties:
                  order_id:
                    type: string
                  status:
                    type: string
                    const: credentials_updated
              example:
                order_id: a1b2c3d4-uuid
                status: credentials_updated
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          description: No order of yours has this order_id.
        "422":
          description: "Incomplete: a proxy login without all four fields, a username without a password, or a VPN config that is too short or not a valid OpenVPN, WireGuard or VLESS config. The answer says which."
        "429":
          $ref: "#/components/responses/RateLimited"
  /integration/orders/{order_id}/expire:
    post:
      operationId: expireOrder
      tags:
        - Orders
      summary: End an order from your side
      description: "Tell ProxyMarket that an order ended on your side, so its status changes to expired. You do not need this for normal ends: ProxyMarket expires orders by itself every 5 minutes and then calls your [deprovision webhook](/docs/api/market/deprovision-webhook)."
      x-xproxy-safety: destructive
      x-agent-note: Ends a paying customer's order. Name the order and the reason to the user and wait for a clear yes.
      security:
        - vendorApiKey: []
      parameters:
        - name: order_id
          in: path
          required: true
          description: The order to end.
          schema:
            type: string
          example: a1b2c3d4-uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - reason
              properties:
                reason:
                  type: string
                  enum:
                    - duration_ended
                    - revoked
                    - modem_offline
                  description: "duration_ended: the rental time is over. revoked: you removed access by hand. modem_offline: the hardware failed for good."
            example:
              reason: duration_ended
      responses:
        "200":
          description: The order is expired.
          content:
            application/json:
              schema:
                type: object
                properties:
                  order_id:
                    type: string
                  status:
                    type: string
                    const: expired
              example:
                order_id: a1b2c3d4-uuid
                status: expired
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          description: No order of yours has this order_id.
  /health:
    servers:
      - url: "{webhook_url}"
        description: Your webhook server, the webhook_url you gave when you created your key.
        variables:
          webhook_url:
            default: https://your-vendor-host.com/marketplace
    head:
      operationId: webhookHealth
      tags:
        - Webhooks
      summary: Health check of your server (keeps your plans listed)
      description: |-
        **Build this first.** ProxyMarket sends `HEAD {webhook_url}/health` when you create a key (no answer: the key is refused with 422) and then **every 10 minutes**. Any status below 500 within **5 seconds** counts as up; a timeout, a refused connection or a 5xx counts as down.

        After **2 failures in a row, every plan of that key is hidden from the marketplace** and cannot be bought. One good answer brings them all back by itself. So a deploy, a restart or a firewall that blocks `HEAD` can empty your shop within about 20 minutes. Keep this route cheap: no login, no database, no outside call, and answer `GET` too. Not to be confused with [Report the health of your proxies](/docs/api/market/report-health), which you call.
      x-xproxy-safety: read
      x-auth-note: No signature and no login. ProxyMarket sends no body and reads only the status code.
      security: []
      responses:
        "200":
          description: Up. Any status below 500 works; an empty 200 is best.
        "503":
          description: Down. Any 5xx, a timeout over 5 seconds or a refused connection counts as a failure.
  /provision:
    servers:
      - url: "{webhook_url}"
        description: Your webhook server, the webhook_url you gave when you created your key.
        variables:
          webhook_url:
            default: https://your-vendor-host.com/marketplace
    post:
      operationId: provisionWebhook
      tags:
        - Webhooks
      summary: A customer paid, deliver their proxy or VPN
      description: |-
        ProxyMarket calls this the moment a customer's payment clears. Check `X-Signature`, find your product by
        `external_plan_id`, create the customer's access, and answer one of three ways:

        - **provisioned** (best): put the proxy login, or `vpn_config_file`, in the answer. The customer sees it at once.
        - **pending**: you need more time. Then send it with [Deliver the proxy login or VPN config](/docs/api/market/push-credentials) within 5 minutes.
        - **error**: you cannot deliver, with a `message`. ProxyMarket refunds the customer automatically and takes back your earning.

        Save `order_id`: later calls about this order use it. The payload is the same for proxy, VPN and VLESS orders.
      x-xproxy-safety: action
      x-agent-note: Creates a customer login on the vendor server. Only call it against a test server, with test data, after the user asked for it.
      x-auth-note: Check X-Signature before anything else; answer 401 when it does not match. See the guide for code.
      security:
        - webhookSignature: []
      parameters:
        - name: X-ProxyMarket-Event
          in: header
          required: true
          description: Which event this call is.
          schema:
            type: string
            const: order.provision
          example: order.provision
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - order_id
                - external_plan_id
                - customer_id
                - quantity
                - duration_days
                - duration_unit
                - bandwidth_gb
                - plan_name
                - total_usd
                - provisioned_at
              properties:
                order_id:
                  type: string
                  description: "ProxyMarket order ID. Keep it: credentials, expiry and the other webhooks use it."
                external_plan_id:
                  type: string
                  description: The external_id you synced. It tells you which port, modem or VPN pool to use.
                customer_id:
                  type: string
                  description: ProxyMarket customer ID, for your own records. The customer never sees it.
                quantity:
                  type: integer
                  description: How many were ordered (usually 1).
                duration_days:
                  type: integer
                  description: How long the customer paid for, in days, or hours when duration_unit is hours.
                duration_unit:
                  type: string
                  enum:
                    - days
                    - hours
                bandwidth_gb:
                  type:
                    - number
                    - "null"
                  description: Data limit in GB. null means unlimited.
                plan_name:
                  type: string
                  description: Name of the plan.
                total_usd:
                  type: number
                  description: What the customer paid.
                provisioned_at:
                  type: string
                  format: date-time
                  description: When the payment cleared (UTC).
            example:
              order_id: a1b2c3d4-uuid
              external_plan_id: port-1
              customer_id: x9y8z7-uuid
              quantity: 1
              duration_days: 30
              duration_unit: days
              bandwidth_gb: null
              plan_name: US Mobile 4G - Port 1
              total_usd: 25
              provisioned_at: 2026-04-17T12:00:00Z
      responses:
        "200":
          description: Your answer. `status` is provisioned, pending or error; with provisioned, include the proxy login (all four fields) or `vpn_config_file`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                properties:
                  status:
                    type: string
                    enum:
                      - provisioned
                      - pending
                      - error
                  proxy_ip:
                    type: string
                  proxy_port:
                    type: integer
                  proxy_username:
                    type: string
                  proxy_password:
                    type: string
                  rotation_link:
                    type: string
                  vpn_config_file:
                    type: string
                    description: Full client file for VPN and VLESS orders.
                  expires_at:
                    type: string
                    format: date-time
                    description: When access ends on your side.
                  message:
                    type: string
                    description: With status error, why you cannot deliver.
              examples:
                proxy:
                  summary: Provisioned, proxy
                  value:
                    status: provisioned
                    proxy_ip: 203.0.113.1
                    proxy_port: 8080
                    proxy_username: cust_abc123
                    proxy_password: YOUR_PROXY_PASSWORD
                    rotation_link: https://your-vendor-host.com/api/rotate/port-1?token=YOUR_ROTATE_TOKEN
                    expires_at: 2026-05-17T12:00:00Z
                vpn:
                  summary: Provisioned, WireGuard
                  value:
                    status: provisioned
                    vpn_config_file: |-
                      [Interface]
                      PrivateKey = YOUR_CLIENT_PRIVATE_KEY
                      Address = 10.0.0.2/32

                      [Peer]
                      PublicKey = YOUR_SERVER_PUBLIC_KEY
                      Endpoint = vpn.example.com:51820
                      AllowedIPs = 0.0.0.0/0
                    expires_at: 2026-05-17T12:00:00Z
                pending:
                  summary: Pending, deliver later
                  value:
                    status: pending
                error:
                  summary: Error, cannot deliver
                  value:
                    status: error
                    message: Port offline, modem not responding
        "401":
          description: X-Signature did not match. ProxyMarket did not send this, or the body was changed.
  /deprovision:
    servers:
      - url: "{webhook_url}"
        description: Your webhook server, the webhook_url you gave when you created your key.
        variables:
          webhook_url:
            default: https://your-vendor-host.com/marketplace
    post:
      operationId: deprovisionWebhook
      tags:
        - Webhooks
      summary: An order ended, remove the customer's access
      description: |-
        ProxyMarket calls this when an order expires, is cancelled or is refunded. Expiry is automatic: a sweep every 5 minutes marks ended orders expired and calls you, with `expired_at` set.

        Remove the customer's proxy login or turn their VPN profile off (for VLESS, take the client UUID out of your inbound), then put the product back on sale with [Update stock and visibility](/docs/api/market/update-stock). ProxyMarket retries on network errors, so a second call for the same `order_id` must also answer 200.
      x-xproxy-safety: destructive
      x-agent-note: Removes a customer's access on the vendor server. Only call it against a test server, after the user asked for it.
      x-auth-note: Check X-Signature before anything else; answer 401 when it does not match.
      security:
        - webhookSignature: []
      parameters:
        - name: X-ProxyMarket-Event
          in: header
          required: true
          description: Which event this call is.
          schema:
            type: string
            const: order.deprovision
          example: order.deprovision
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - order_id
                - external_plan_id
                - customer_id
                - reason
              properties:
                order_id:
                  type: string
                external_plan_id:
                  type: string
                customer_id:
                  type: string
                reason:
                  type: string
                  enum:
                    - expired
                    - cancelled
                    - refunded
                  description: "expired: the rental time ended. cancelled: cancelled before it started. refunded: an admin refunded it."
                expired_at:
                  type: string
                  format: date-time
                  description: Only when reason is expired. When the rental time ended (UTC).
            example:
              order_id: a1b2c3d4-uuid
              external_plan_id: port-1
              customer_id: x9y8z7-uuid
              reason: expired
              expired_at: 2026-05-04T12:34:56+00:00
      responses:
        "200":
          description: Access removed, or it was already gone.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: deprovisioned
              example:
                status: deprovisioned
        "401":
          description: X-Signature did not match.
  /update-settings:
    servers:
      - url: "{webhook_url}"
        description: Your webhook server, the webhook_url you gave when you created your key.
        variables:
          webhook_url:
            default: https://your-vendor-host.com/marketplace
    post:
      operationId: updateSettingsWebhook
      tags:
        - Webhooks
      summary: A customer changed their IP whitelist or TCP fingerprint
      description: |-
        Proxy orders only, never VPN. Apply what you support and answer 200; a field you cannot apply can be ignored.

        - `ip_whitelist`: only these IPs may use the proxy. An empty list `[]` removes the restriction. `null` leaves it as it is.
        - `tcp_fingerprint`: the OS the proxy's TCP/IP fingerprint should look like. `null` turns spoofing off (plain Linux).

        Profiles: `linux` (no spoofing), `win1` Windows 11, `win2` Windows 10, `win3` Windows 7, `mac1` MacBook Pro
        (macOS 13 to 15), `ipad1` iPad Air 4 (iOS 18), `ios1` iPhone 15 (iOS 17.7.1), `ios2` iPhone 13 (iOS 15.1.1),
        `android1` Galaxy S24 (Android 14), `android2` a common Android phone.
      x-xproxy-safety: action
      x-agent-note: Changes who can use a customer's proxy. Only call it against a test server, after the user asked for it.
      x-auth-note: Check X-Signature before anything else; answer 401 when it does not match.
      security:
        - webhookSignature: []
      parameters:
        - name: X-ProxyMarket-Event
          in: header
          required: true
          description: Which event this call is.
          schema:
            type: string
            const: order.update_settings
          example: order.update_settings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - order_id
                - customer_id
              properties:
                order_id:
                  type: string
                customer_id:
                  type: string
                ip_whitelist:
                  type:
                    - array
                    - "null"
                  items:
                    type: string
                  description: IPv4 or IPv6 addresses allowed to use the proxy. [] removes the restriction; null leaves it unchanged.
                tcp_fingerprint:
                  type:
                    - string
                    - "null"
                  enum:
                    - linux
                    - win1
                    - win2
                    - win3
                    - mac1
                    - ipad1
                    - ios1
                    - ios2
                    - android1
                    - android2
                    - null
                  description: OS profile to copy. null turns fingerprint spoofing off.
            example:
              order_id: a1b2c3d4-uuid
              customer_id: x9y8z7-uuid
              ip_whitelist:
                - 203.0.113.10
                - 198.51.100.0
              tcp_fingerprint: win1
      responses:
        "200":
          description: Applied (or the parts you support were applied).
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: ok
              example:
                status: ok
        "401":
          description: X-Signature did not match.
        "404":
          description: You do not know this order_id.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  message:
                    type: string
              example:
                status: error
                message: Order not found
