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

# Create a proxy

> Provisions a proxy of the requested type for the caller in the selected country.



## OpenAPI

````yaml /api-reference/mobilerun-proxy/proxies.yaml post /connect/proxies
openapi: 3.1.0
info:
  title: Proxies
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /connect/proxies:
    post:
      tags:
        - Proxies
      summary: Create a proxy
      description: >-
        Provisions a proxy of the requested type for the caller in the selected
        country.
      operationId: CreateConnectProxy
      parameters:
        - description: >-
            Optional idempotency key, unique per owner (1-128 characters after
            trimming; surrounding whitespace is ignored). Reusing a key returns
            the originally created proxy with its original credentials,
            regardless of changed request parameters.
          in: header
          name: Idempotency-Key
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProxyRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyWithSecret'
          description: The created proxy, including its password.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Mobilerun from '@mobilerun/sdk';

            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.connect.proxies.buy({
              country: 'country',
              type: 'dedicated_residential',
            });

            console.log(response.id);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            response = client.connect.proxies.buy(
                country="country",
                type="dedicated_residential",
            )
            print(response.id)
components:
  schemas:
    CreateProxyRequest:
      properties:
        country:
          description: ISO 3166-1 alpha-2 country code to provision the proxy in.
          format: country-code
          type: string
        name:
          description: >-
            Display name for the proxy, up to 64 characters excluding
            surrounding whitespace, and containing no NUL. Omit it (or send only
            whitespace) to get a generated label built from the country, type,
            and id.
          type: string
        type:
          $ref: '#/components/schemas/ProxyType'
      required:
        - country
        - type
      type: object
    ProxyWithSecret:
      allOf:
        - $ref: '#/components/schemas/Proxy'
        - properties:
            password:
              type: string
            paymentUrl:
              description: >-
                Checkout URL to complete payment while status is
                `pending_payment`. Null once paid or when no payment was
                required.
              nullable: true
              type: string
          required:
            - password
          type: object
      description: >-
        A proxy including its password. Returned only on create and single-proxy
        reads.
    ProxyType:
      enum:
        - dedicated_residential
        - residential
        - mobile
      type: string
    Proxy:
      description: A provisioned proxy without its credentials.
      properties:
        billingMode:
          $ref: '#/components/schemas/ProxyBillingMode'
        country:
          description: ISO 3166-1 alpha-2 country code (lowercase).
          type: string
        createdAt:
          format: date-time
          type: string
        host:
          type: string
        id:
          format: uuid
          type: string
        name:
          description: >-
            Display name for the proxy. Set it on create or change it with
            PATCH; when no name has been set, a label generated from the proxy's
            country, type, and id is returned instead — so this is never empty.
          example: 🇩🇪 Germany · Dedicated residential · 769fc289
          type: string
        port:
          format: int32
          type: integer
        status:
          $ref: '#/components/schemas/ProxyStatus'
        type:
          $ref: '#/components/schemas/ProxyType'
        username:
          type: string
      required:
        - id
        - name
        - country
        - type
        - status
        - host
        - port
        - username
        - createdAt
      type: object
    ConnectErrorResponse:
      description: A Problem Details (RFC 7807-style) error response.
      properties:
        detail:
          description: Human-readable explanation of this occurrence.
          type: string
        errors:
          description: Per-input errors, when applicable.
          items:
            $ref: '#/components/schemas/ConnectErrorDetail'
          type: array
        status:
          description: HTTP status code.
          type: integer
        title:
          description: Short, human-readable summary of the error type.
          type: string
      required:
        - title
        - status
        - detail
        - errors
      type: object
    ProxyBillingMode:
      enum:
        - included
        - standalone_paid
      type: string
    ProxyStatus:
      description: >-
        Lifecycle of a proxy. A freshly created proxy is `checking` while its
        billing identity is being resolved — clients should poll until a
        `paymentUrl` or a later status appears — then `provisioning` — or
        `pending_payment` until the customer completes checkout — and becomes
        `active` once its upstream is assigned. `cancelling` retains full access
        through the paid period; when the subscription expires the proxy is
        `ended`. `error` marks a failed provisioning attempt.
      enum:
        - checking
        - pending_payment
        - provisioning
        - active
        - cancelling
        - ended
        - error
      type: string
    ConnectErrorDetail:
      description: A single error, locating an offending input where applicable.
      properties:
        location:
          description: Path to the offending input, e.g. "body.proxyId".
          type: string
        message:
          description: Human-readable description of this error.
          type: string
        value:
          description: The offending value, when available.
      required:
        - location
        - message
      type: object
  responses:
    BadRequest:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ConnectErrorResponse'
      description: The request was invalid.
    Unauthorized:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ConnectErrorResponse'
      description: Missing or invalid credentials.
    Conflict:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ConnectErrorResponse'
      description: >-
        The request cannot be fulfilled in the current state (e.g. no capacity
        is available for the requested country/type).
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

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