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

# Create a Public Internet Gateway

> Create a new Public Internet Gateway.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/networking/networking.yml post /public_internet_gateways
openapi: 3.1.0
info:
  title: Telnyx Networking API
  version: 2.0.0
  description: API for Networking.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /public_internet_gateways:
    post:
      tags:
        - Public Internet Gateways
      summary: Create a Public Internet Gateway
      description: Create a new Public Internet Gateway.
      operationId: CreatePublicInternetGateway
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicInternetGatewayCreate'
        required: true
      responses:
        '202':
          $ref: '#/components/responses/PublicInternetGatewayResponse'
        '422':
          $ref: '#/components/responses/netapps_UnprocessableEntity'
        default:
          $ref: '#/components/responses/netapps_GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


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


            const publicInternetGateway = await
            client.publicInternetGateways.create();


            console.log(publicInternetGateway.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            public_internet_gateway = client.public_internet_gateways.create()
            print(public_internet_gateway.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpublicInternetGateway, err := client.PublicInternetGateways.New(context.TODO(), telnyx.PublicInternetGatewayNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", publicInternetGateway.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.publicinternetgateways.PublicInternetGatewayCreateParams;

            import
            com.telnyx.sdk.models.publicinternetgateways.PublicInternetGatewayCreateResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    PublicInternetGatewayCreateResponse publicInternetGateway = client.publicInternetGateways().create();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            public_internet_gateway = telnyx.public_internet_gateways.create

            puts(public_internet_gateway)
        - lang: CLI
          source: |-
            telnyx public-internet-gateways create \
              --api-key 'My API Key'
components:
  schemas:
    PublicInternetGatewayCreate:
      allOf:
        - $ref: '#/components/schemas/PublicInternetGateway'
        - type: object
          title: PublicInternetGatewayCreate
    PublicInternetGateway:
      allOf:
        - $ref: '#/components/schemas/Record'
        - $ref: '#/components/schemas/Interface'
        - type: object
          title: PublicInternetGateway
          properties:
            region_code:
              description: The region interface is deployed to.
              type: string
              example: ashburn-va
            record_type:
              type: string
              description: Identifies the type of the resource.
              readOnly: true
              example: public_internet_gateway
            public_ip:
              description: The publically accessible ip for this interface.
              type: string
              example: 127.0.0.1
              readOnly: true
    PublicInternetGatewayRead:
      allOf:
        - $ref: '#/components/schemas/PublicInternetGateway'
    netapps_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/netapps_Error'
      type: object
    Record:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Identifies the resource.
          readOnly: true
          example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
        record_type:
          type: string
          description: Identifies the type of the resource.
          readOnly: true
          example: sample_record_type
        created_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            created.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
        updated_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            updated.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
    Interface:
      type: object
      properties:
        network_id:
          description: The id of the network associated with the interface.
          type: string
          format: uuid
          example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
        name:
          type: string
          description: A user specified name for the interface.
          example: test interface
        status:
          $ref: '#/components/schemas/InterfaceStatus'
    netapps_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
    InterfaceStatus:
      type: string
      enum:
        - created
        - provisioning
        - provisioned
        - deleting
      description: The current status of the interface deployment.
      readOnly: true
      example: provisioned
  responses:
    PublicInternetGatewayResponse:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/PublicInternetGatewayRead'
    netapps_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/netapps_Errors'
    netapps_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/netapps_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````