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

# Share a porting order

> Creates a sharing token for a porting order. The token can be used to share the porting order with non-Telnyx users.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/porting-orders.yml post /porting_orders/{id}/actions/share
openapi: 3.1.0
info:
  title: Telnyx Porting Orders API
  version: 2.0.0
  description: API for managing porting order lifecycle.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /porting_orders/{id}/actions/share:
    post:
      tags:
        - Porting Orders
      summary: Share a porting order
      description: >-
        Creates a sharing token for a porting order. The token can be used to
        share the porting order with non-Telnyx users.
      operationId: SharePortingOrder
      parameters:
        - $ref: '#/components/parameters/PathPortingOrderID'
      requestBody:
        $ref: '#/components/requestBodies/SharePortingOrder'
      responses:
        '201':
          $ref: '#/components/responses/SharePortingOrder'
        '401':
          description: Unauthorized
        '404':
          description: Porting Order not found
      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 response = await
            client.portingOrders.actions.share('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');


            console.log(response.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
            )
            response = client.porting_orders.actions.share(
                id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(response.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\tresponse, err := client.PortingOrders.Actions.Share(\n\t\tcontext.TODO(),\n\t\t\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n\t\ttelnyx.PortingOrderActionShareParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.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.portingorders.actions.ActionShareParams;

            import
            com.telnyx.sdk.models.portingorders.actions.ActionShareResponse;


            public final class Main {
                private Main() {}

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

                    ActionShareResponse response = client.portingOrders().actions().share("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response =
            telnyx.porting_orders.actions.share("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")


            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->portingOrders->actions->share(
                '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
                expiresInSeconds: 3600,
                permissions: 'porting_order.document.read',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx porting-orders:actions share \
              --api-key 'My API Key' \
              --id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e
components:
  parameters:
    PathPortingOrderID:
      name: id
      description: Porting Order id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  requestBodies:
    SharePortingOrder:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              expires_in_seconds:
                description: The number of seconds the token will be valid for
                type: integer
                minimum: 1
                maximum: 172800
              permissions:
                description: The permissions the token will have
                type: string
                enum:
                  - porting_order.document.read
                  - porting_order.document.update
            example:
              expires_in_seconds: 3600
              permissions: porting_order.document.read
  responses:
    SharePortingOrder:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/PortingOrderSharingToken'
          example:
            data:
              id: 03a35311-ad92-46b3-95d7-8ad6dccf2d7c
              porting_order_id: fd4b86c8-497d-4c6d-9609-a789e4e14cfe
              expires_in_seconds: 3600
              permissions:
                - porting_order.document.read
                - porting_order.document.update
              token: >-
                eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODk4OTQ2NzcsImlzdCI6MTY4OTg5MTA3NywicGVybWlzc2lvbnMiOlsicG9ydGluZ19vcmRlci5kb2N1bWVudC5yZWFkIl0sInBvcnRpbmdfb3JkZXJfaWQiOiJmZDRiODZjOC00OTdkLTRjNmQtOTYwOS1hNzg5ZTRlMTRjZmUifQ.CT0HRF6OLj7VPZ8p5Y_0S8rOL8SEUznwJJkR-YReKwc
              record_type: porting_order_sharing_token
              expires_at: '2023-07-20T23:11:17Z'
              created_at: '2023-07-20T22:11:17.292573Z'
  schemas:
    PortingOrderSharingToken:
      type: object
      properties:
        id:
          type: string
          description: Uniquely identifies this sharing token
          format: uuid
          example: 0a4b78a0-d416-4761-94f7-46c72ec56547
        porting_order_id:
          type: string
          format: uuid
          description: Identifies the porting order resource being shared
          example: f1486bae-f067-460c-ad43-73a92848f902
        expires_in_seconds:
          type: integer
          minimum: 1
          description: The number of seconds until the sharing token expires
          example: 3600
        permissions:
          type: array
          description: The permissions granted to the sharing token
          items:
            type: string
            enum:
              - porting_order.document.read
              - porting_order.document.update
          example:
            - porting_order.document.read
            - porting_order.document.update
        token:
          type: string
          description: A signed JWT token that can be used to access the shared resource
          example: >-
            eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODk4OTQ2NzcsImlzdCI6MTY4OTg5MTA3NywicGVybWlzc2lvbnMiOlsicG9ydGluZ19vcmRlci5kb2N1bWVudC5yZWFkIl0sInBvcnRpbmdfb3JkZXJfaWQiOiJmZDRiODZjOC00OTdkLTRjNmQtOTYwOS1hNzg5ZTRlMTRjZmUifQ.CT0HRF6OLj7VPZ8p5Y_0S8rOL8SEUznwJJkR-YReKwc
        expires_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the sharing token expires.
          example: '2021-03-19T10:07:15.527000Z'
        record_type:
          type: string
          example: porting_order_sharing_token
          description: Identifies the type of the resource.
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: ISO 8601 formatted date indicating when the resource was created.
          example: '2021-03-19T10:07:15.527000Z'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````