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

# Assign new IP address to app



## OpenAPI

````yaml /api/machines/openapi.json post /v1/apps/{app_name}/ip_assignments
openapi: 3.1.0
info:
  title: Machines API
  description: >-
    This site hosts documentation generated from the Fly.io Machines API OpenAPI
    specification. Visit our complete [Machines API
    docs](https://fly.io/docs/machines/api/) for how to get started, more
    information about each endpoint, parameter descriptions, and examples.
  contact: {}
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: https://api.machines.dev
security:
  - FlyBearerAuth: []
tags:
  - name: Apps
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/apps-resource/) for details about
      using the Apps resource.
  - name: Machines
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/machines-resource/) for details
      about using the Machines resource.
  - name: TLS Certificates
    description: >
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/certificates-resource/) for details
      about using the TLS Certificates resource.
  - name: Volumes
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/volumes-resource/) for details
      about using the Volumes resource.
  - name: Postgres Clusters
    description: >-
      Create and manage Postgres clusters, including databases, users,
      extensions, backups, and app attachments.
externalDocs:
  url: https://fly.io/docs/machines/working-with-machines/
paths:
  /v1/apps/{app_name}/ip_assignments:
    post:
      tags:
        - Apps
      summary: Assign new IP address to app
      operationId: App_IPAssignments_create
      parameters:
        - name: app_name
          in: path
          description: Fly App Name
          required: true
          schema:
            type: string
      requestBody:
        description: Assign IP request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/assignIPRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssignIPResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: The app does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            The address could not be allocated, for example because of billing
            restrictions or exhausted address pools.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    assignIPRequest:
      type: object
      properties:
        network:
          type: string
          description: >-
            Only for `private_v6`: name of the private network to allocate the
            Flycast address in.

            Defaults to the organization's default network.
        org_slug:
          type: string
          description: >-
            Only for `private_v6`: slug of the organization whose private
            network the Flycast address

            is allocated in, to make the app reachable from that organization.
            Defaults to the app's

            organization.
        region:
          type: string
          description: >-
            Region to scope the address to. Required for egress types. Optional
            for `v4` and `v6`,

            which default to `global` (announced in all regions). Must be empty
            or `global` for

            `shared_v4` and `private_v6`.
        service_name:
          type: string
          description: >-
            Scope the address to a single service of the app. Not supported for
            egress types.
        type:
          type: object
          description: Type of IP address to allocate. Required.
          allOf:
            - $ref: '#/components/schemas/IPAssignmentType'
    AssignIPResponse:
      type: object
      properties:
        created_at:
          type: string
          description: When the address was assigned to the app, in RFC 3339 format.
        egress:
          type: boolean
          description: Whether this is an egress address.
        ip:
          type: string
          description: The allocated IP address. Null for `egress_pair`; see `ip_pair`.
        ip_pair:
          type: object
          description: >-
            The allocated IPv4 and IPv6 addresses when the `egress_pair` type
            was requested; null

            otherwise.
          allOf:
            - $ref: '#/components/schemas/IPPair'
        network:
          $ref: '#/components/schemas/IPAssignmentNetwork'
        region:
          type: string
          description: >-
            Region the address is scoped to, or `global` for addresses announced
            in all regions.
        service_name:
          type: string
          description: Name of the service the address is scoped to, if any.
        shared:
          type: boolean
          description: Whether this is the app's shared IPv4 address.
    ErrorResponse:
      type: object
      properties:
        details:
          type: object
          description: 'Deprecated: details about some errors. Do not rely on its contents.'
        error:
          type: string
          description: >-
            Human-readable description of the error. Its wording may change; use
            `status` to tell

            errors apart.
        status:
          type: object
          description: >-
            Machine-readable error code, set for some errors, such as
            `insufficient_capacity`,

            `volume_placement_capacity`, `name_taken`, `exec_request_too_large`,
            or

            `exec_output_too_large`.
          allOf:
            - $ref: '#/components/schemas/main.statusCode'
    IPAssignmentType:
      type: string
      description: >-
        Type of IP address to allocate. "egress_pair" allocates both v4 and v6
        egress IP addresses (recommended when using egress IPs).
      enum:
        - v4
        - v6
        - shared_v4
        - private_v6
        - egress_v4
        - egress_v6
        - egress_pair
      x-enum-varnames:
        - IPAssignmentType_v4
        - IPAssignmentType_v6
        - IPAssignmentType_shared_v4
        - IPAssignmentType_private_v6
        - IPAssignmentType_egress_v4
        - IPAssignmentType_egress_v6
        - IPAssignmentType_egress_pair
    IPPair:
      type: object
      properties:
        v4:
          type: string
          description: The egress IPv4 address.
        v6:
          type: string
          description: The egress IPv6 address.
    IPAssignmentNetwork:
      type: object
      properties:
        name:
          type: string
          description: Network name; empty for the organization's default network.
        org_slug:
          type: string
          description: Slug of the organization the network belongs to.
      description: >-
        The 6PN network a Flycast (private_v6) address belongs to. Null for all
        other IP types.
    main.statusCode:
      type: string
      enum:
        - unknown
        - insufficient_capacity
        - volume_placement_capacity
        - exec_request_too_large
        - exec_output_too_large
        - name_taken
      x-enum-varnames:
        - unknown
        - capacityErr
        - volumePlacementCapacityErr
        - execRequestTooLargeErr
        - execOutputTooLargeErr
        - nameTakenErr
  securitySchemes:
    FlyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        A Fly API token with access to the requested organization or resource.
        Send it as `Authorization: Bearer <Fly API token>`.

````