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

> Creates a proxy config. The body is a discriminated union on `protocol`: `socks5` requires name, host, port, user, and password, while `wireguard` requires name and a config string. Returns the created config with its generated `proxyId`.



## OpenAPI

````yaml /api-reference/mobilerun-proxy/custom-proxies.yaml post /proxies
openapi: 3.1.0
info:
  title: Custom Proxies
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /proxies:
    post:
      tags:
        - Custom Proxies
      summary: Create a proxy config
      description: >-
        Creates a proxy config. The body is a discriminated union on `protocol`:
        `socks5` requires name, host, port, user, and password, while
        `wireguard` requires name and a config string. Returns the created
        config with its generated `proxyId`.
      operationId: createProxy
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProxyBody'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/ProxyConfig'
                  message:
                    type: string
                  success:
                    enum:
                      - true
                    type: boolean
                required:
                  - success
                  - message
                  - data
                type: object
          description: Proxy created
        '400':
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/CredentialErrorResponse'
                  - $ref: '#/components/schemas/ApiErrorEnvelope'
          description: >-
            Bad Request — invalid_request, package_exists, create_failed,
            update_failed, protocol_change_not_allowed (legacy body + additive
            code/message), or a generic request validation failure
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorEnvelope'
          description: Unauthorized
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
          description: Internal Server Error
      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 proxy = await client.proxies.create({
              host: 'x',
              name: 'xxx',
              password: 'x',
              port: 1,
              protocol: 'socks5',
              user: 'x',
            });

            console.log(proxy.data);
        - 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
            )
            proxy = client.proxies.create(
                host="x",
                name="xxx",
                password="x",
                port=1,
                protocol="socks5",
                user="x",
            )
            print(proxy.data)
components:
  schemas:
    CreateProxyBody:
      discriminator:
        mapping:
          socks5: '#/components/schemas/CreateSocks5Proxy'
          wireguard: '#/components/schemas/CreateWireguardProxy'
        propertyName: protocol
      oneOf:
        - $ref: '#/components/schemas/CreateSocks5Proxy'
        - $ref: '#/components/schemas/CreateWireguardProxy'
    ProxyConfig:
      discriminator:
        mapping:
          socks5: '#/components/schemas/Socks5ProxyConfig'
          wireguard: '#/components/schemas/WireguardProxyConfig'
        propertyName: protocol
      oneOf:
        - $ref: '#/components/schemas/Socks5ProxyConfig'
        - $ref: '#/components/schemas/WireguardProxyConfig'
    CredentialErrorResponse:
      properties:
        code:
          $ref: '#/components/schemas/CredentialErrorCode'
        message:
          type: string
      required:
        - code
        - message
      type: object
    ApiErrorEnvelope:
      properties:
        code:
          type: string
        details: {}
        message:
          type: string
        retryAfterSeconds:
          type: number
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    InternalServerError:
      properties:
        code:
          type: string
        message:
          type: string
        traceId:
          type: string
      required:
        - code
        - message
      type: object
    CreateSocks5Proxy:
      properties:
        host:
          minLength: 1
          type: string
        name:
          maxLength: 50
          minLength: 3
          type: string
        password:
          minLength: 1
          type: string
        port:
          maximum: 65535
          minimum: 1
          type: integer
        protocol:
          enum:
            - socks5
          type: string
        user:
          minLength: 1
          type: string
      required:
        - name
        - protocol
        - host
        - port
        - user
        - password
      type: object
    CreateWireguardProxy:
      properties:
        config:
          maxLength: 10000
          minLength: 1
          type: string
        name:
          maxLength: 50
          minLength: 3
          type: string
        protocol:
          enum:
            - wireguard
          type: string
      required:
        - name
        - protocol
        - config
      type: object
    Socks5ProxyConfig:
      properties:
        host:
          minLength: 1
          type: string
        name:
          maxLength: 50
          minLength: 3
          type: string
        password:
          minLength: 1
          type: string
        port:
          maximum: 65535
          minimum: 1
          type: integer
        protocol:
          enum:
            - socks5
          type: string
        proxyId:
          format: uuid
          type: string
        user:
          minLength: 1
          type: string
      required:
        - name
        - protocol
        - host
        - port
        - user
        - password
        - proxyId
      type: object
    WireguardProxyConfig:
      properties:
        config:
          maxLength: 10000
          minLength: 1
          type: string
        name:
          maxLength: 50
          minLength: 3
          type: string
        protocol:
          enum:
            - wireguard
          type: string
        proxyId:
          format: uuid
          type: string
      required:
        - name
        - protocol
        - config
        - proxyId
      type: object
    CredentialErrorCode:
      enum:
        - credential_read_only
        - credential_source_unavailable
        - credential_source_rate_limited
        - onepassword_not_connected
        - onepassword_token_invalid
        - onepassword_no_vaults
        - onepassword_reference_invalid
        - invalid_request
        - package_exists
        - credential_not_found
        - proxy_not_found
        - create_failed
        - update_failed
        - protocol_change_not_allowed
      type: string
  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.