openapi: 3.0.1
info:
  title: Porting
  description: >-
    Bandwidth's Porting API


    This API provides endpoints to manage port-in orders, including retrieving
    and updating activation status for telephone numbers being ported into the
    Bandwidth network.
  contact:
    name: Bandwidth
    url: https://dev.bandwidth.com/apis/numbers-apis/porting/portins/
    email: support@bandwidth.com
  version: 2.0.0
  termsOfService: https://www.bandwidth.com/legal/terms-of-service/
servers:
  - url: https://api.bandwidth.com/api/v2
    description: Production
security:
  - Basic: []
  - Bearer: []
paths:
  /accounts/{accountId}/csrs:
    get:
      tags:
        - Porting
      description: >-
        Retrieves the CSR orders for the given account ID.

        Please visit <a href='/docs/numbers/porting/port-ins/csrs'>Guides and
        Tutorials</a>
      summary: List CSR orders
      operationId: readCsrOrders
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
        - $ref: '#/components/parameters/modifiedDateFromQueryParam'
        - $ref: '#/components/parameters/modifiedDateToQueryParam'
        - $ref: '#/components/parameters/pageQueryParam'
        - $ref: '#/components/parameters/sizeQueryParam'
        - $ref: '#/components/parameters/statusQueryParam'
      responses:
        '200':
          $ref: '#/components/responses/csrListResponse200'
        '400':
          $ref: '#/components/responses/csrBadRequestError'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/errorResponse404'
        '405':
          $ref: '#/components/responses/errorResponse405'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
    post:
      tags:
        - Porting
      description: Creates the CSR order
      summary: Create CSR order
      operationId: createCsrOrder
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
      requestBody:
        $ref: '#/components/requestBodies/csrCreateRequestBody'
      responses:
        '201':
          $ref: '#/components/responses/csrCreateResponse201'
        '400':
          $ref: '#/components/responses/csrBadRequestError'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/errorResponse404'
        '405':
          $ref: '#/components/responses/errorResponse405'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
  /accounts/{accountId}/csrs/{orderId}:
    get:
      tags:
        - Porting
      description: Retrieves the CSR order for the given account ID by order ID.
      summary: Get CSR order
      operationId: readCsrOrder
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
        - $ref: '#/components/parameters/OrderIdPathParam'
      responses:
        '200':
          $ref: '#/components/responses/csrGetResponse200'
        '400':
          $ref: '#/components/responses/csrBadRequestError'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/errorResponse404'
        '405':
          $ref: '#/components/responses/errorResponse405'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
    put:
      tags:
        - Porting
      description: Update CSR order
      summary: Update CSR order
      operationId: updateCsrOrder
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
        - $ref: '#/components/parameters/OrderIdPathParam'
      requestBody:
        $ref: '#/components/requestBodies/csrUpdateRequestBody'
      responses:
        '200':
          $ref: '#/components/responses/csrUpdateResponse200'
        '400':
          $ref: '#/components/responses/csrBadRequestError'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/errorResponse404'
        '405':
          $ref: '#/components/responses/errorResponse405'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
  /accounts/{accountId}/portins/{orderId}/activationStatus:
    get:
      tags:
        - Porting
      operationId: retrievePortinActivationStatus
      summary: Retrieve port-in order activation status
      description: >-
        Retrieve the status (activated or not activated) of TNs associated with
        the customer activated (triggered) order. <br><br>

        At this time all phone numbers associated with a PON will be activated
        at the same time.
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
        - $ref: '#/components/parameters/OrderIdPathParam'
      responses:
        '200':
          $ref: '#/components/responses/activationStatusResponse200'
        '400':
          $ref: '#/components/responses/activationStatusResponse400'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/activationStatusResponse404'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
    put:
      tags:
        - Porting
      operationId: updatePortinActivationStatus
      summary: Update port-in order activation status
      description: >
        Sets the activation time for the port-in order.  <br> <br>

        This API call is used to set the Activation time of the customer
        activated (triggered) port.</p>


        <ul>

        <li>If the time is in the past all of the TNs in the port-in request
        will be activated 'immediately'.</li>

        <li>For automated on-net port-ins, if the time is within three days
        after the approved FoC date, the auto-activation time for the port will
        be set to that time.</li>

        <li>For automated off-net port-ins, if the date matches the actual FOC
        date and the time is between 6:00 AM ET and 10:00 PM ET, the
        auto-activation time for the port will be set to that time.</li>

        </ul>
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
        - $ref: '#/components/parameters/OrderIdPathParam'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/activationStatusJson'
            examples:
              example:
                value:
                  autoActivationDate: '2014-08-30T18:30:00+03:00'
          application/xml:
            schema:
              $ref: '#/components/schemas/activationStatus'
            examples:
              example:
                value: |-
                  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                  <ActivationStatus>
                      <AutoActivationDate>2014-08-30T18:30:00+03:00</AutoActivationDate>
                  </ActivationStatus>
      responses:
        '200':
          $ref: '#/components/responses/activationStatusPutResponse200'
        '400':
          $ref: '#/components/responses/activationStatusResponse400'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/activationStatusResponse404'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
  /accounts/{accountId}/tnPortoutPasscodes:
    get:
      tags:
        - Porting
      operationId: getTnPortOutPasscode
      summary: Retrieve tn port-out passcode
      description: >-
        Retrieve information about one or more Telephone Numbers (TNs) with port
        out passcode.
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
        - $ref: '#/components/parameters/tnPortoutPasscodesPageQueryParam'
        - $ref: '#/components/parameters/tnPortoutPasscodesSizeQueryParam'
      responses:
        '200':
          $ref: '#/components/responses/tnPortOutPasscodesGet200Response'
        '400':
          $ref: '#/components/responses/tnPortOutPasscodesGet400Response'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/errorResponse404'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
    post:
      tags:
        - Porting
      operationId: retrieveTnPortOutPasscodes
      summary: Retrieve tn port-out passcodes
      description: >-
        Retrieve information about one or more Telephone Numbers (TNs), where
        the TNs are specified in the POST body.
      parameters:
        - $ref: '#/components/parameters/AccountIdPathParam'
      requestBody:
        $ref: '#/components/requestBodies/tnPortOutPasscodesRequestBody'
      responses:
        '200':
          $ref: '#/components/responses/tnPortOutPasscodesPost200Response'
        '400':
          $ref: '#/components/responses/tnPortOutPasscodesPost400Response'
        '401':
          $ref: '#/components/responses/errorResponse401'
        '403':
          $ref: '#/components/responses/errorResponse403'
        '404':
          $ref: '#/components/responses/errorResponse404'
        '429':
          $ref: '#/components/responses/errorResponse429'
        5XX:
          $ref: '#/components/responses/errorResponse500'
components:
  examples:
    csrCreateRequestJsonExample:
      summary: JSON example for creating a CSR order
      value:
        workingOrBillingTelephoneNumber: '+19196191211'
        accountNumber: '987654321'
        accountTelephoneNumber: '+19196194444'
        endUserName: bandwidthGuy
        authorizingUserName: authorizingUserName
        customerCode: '123'
        endUserPin: '12345'
        endUserPassword: password
        addressLine1: 900 Main Campus Dr
        city: Raleigh
        state: NC
        zipCode: '27612'
        typeOfService: residential
    csrUpdateRequestJsonExample:
      summary: JSON example for updating a CSR order
      value:
        workingOrBillingTelephoneNumber: '+19196191211'
        workingTelephoneNumber: '+19196191211'
        billingTelephoneNumber: '+19196191211'
        customerName: name
        authorizingPersonName: name
        accountNumber: '987654321'
        workingTelephoneNumbersOnAccount:
          - '+19196191211'
        accountTelephoneNumber: '+19196194444'
        endUserName: bandwidthGuy
        authorizingUserName: authorizingUserName
        customerCode: '123'
        endUserPin: '12345'
        endUserPassword: password
        addressLine1: 900 Main Campus Dr
        city: Raleigh
        state: NC
        zipCode: '27612'
        typeOfService: residential
    csrListResponseJsonExample:
      summary: JSON example for listing CSR orders
      value:
        totalCount: 3
        csrOrders:
          - customerOrderId: someValue
            lastModifiedBy: systemUser
            orderCreateDate: '2019-10-25T09:51:17Z'
            accountId: 1
            orderId: a2f55ebe-782a-4242-983b-6ae6cfa97833
            lastModifiedDate: '2019-10-25T12:51:22Z'
            status: COMPLETE
            accountNumber: '987654321'
            accountTelephoneNumber: '+19196194444'
            endUserName: bandwidthGuy
            authorizingUserName: importantAuthGuy
            customerCode: '123'
            endUserPin: '12345'
            addressLine1: 900 Main Campus Dr
            city: Raleigh
            state: NC
            zipCode: '27612'
            typeOfService: residential
            csrData:
              accountNumber: '123456789'
              customerName: JOHN SMITH
              serviceAddress:
                unparsedAddress: 900 MAIN CAMPUS DR
                city: RALEIGH
                state: NC
                zip: '27616'
              workingTelephoneNumber: '+19196191211'
              workingTelephoneNumbersOnAccount:
                - '+19196191211'
    csrCreateResponseJsonExample:
      summary: JSON example for created CSR order response
      value:
        orderId: 93118edd-9874-41b6-89a3-d8c783fe83cf
        status: RECEIVED
    csrGetResponseJsonExample:
      summary: JSON example for a single CSR order
      value:
        customerOrderId: someValue
        lastModifiedBy: systemUser
        orderCreateDate: '2019-10-25T09:51:17Z'
        accountId: 1
        orderId: a2f55ebe-782a-4242-983b-6ae6cfa97833
        lastModifiedDate: '2019-10-25T12:51:22Z'
        status: COMPLETE
        accountNumber: '987654321'
        accountTelephoneNumber: '+19196194444'
        endUserName: bandwidthGuy
        authorizingUserName: importantAuthGuy
        customerCode: '123'
        endUserPin: '12345'
        addressLine1: 900 Main Campus Dr
        city: Raleigh
        state: NC
        zipCode: '27612'
        typeOfService: residential
        csrData:
          accountNumber: '123456789'
          customerName: JOHN SMITH
          serviceAddress:
            unparsedAddress: 900 MAIN CAMPUS DR
            city: RALEIGH
            state: NC
            zip: '27616'
          workingTelephoneNumber: '+19196191211'
          workingTelephoneNumbersOnAccount:
            - '+19196191211'
    csrBadRequestErrorJsonExample:
      summary: JSON example for CSR bad request error
      value:
        errors:
          - code: 54321
            description: Some error description
    csrListResponseXmlExample:
      summary: XML example for listing CSR orders
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <CsrResponses>
            <TotalCount>3</TotalCount>
            <CsrResponse>
                <CustomerOrderId>someValue</CustomerOrderId>
                <LastModifiedBy>systemUser</LastModifiedBy>
                <OrderCreateDate>2019-10-25T09:51:17Z</OrderCreateDate>
                <AccountId>1</AccountId>
                <OrderId>a2f55ebe-782a-4242-983b-6ae6cfa97833</OrderId>
                <LastModifiedDate>2019-10-25T12:51:22.139Z</LastModifiedDate>
                <Status>COMPLETE</Status>
                <AccountNumber>987654321</AccountNumber>
                <AccountTelephoneNumber>+19196194444</AccountTelephoneNumber>
                <EndUserName>bandwidthGuy</EndUserName>
                <AuthorizingUserName>importantAuthGuy</AuthorizingUserName>
                <CustomerCode>123</CustomerCode>
                <EndUserPIN>12345</EndUserPIN>
                <AddressLine1>900 Main Campus Dr</AddressLine1>
                <City>Raleigh</City>
                <State>NC</State>
                <ZIPCode>27612</ZIPCode>
                <TypeOfService>residential</TypeOfService>
            </CsrResponse>
        </CsrResponses>
    csrCreateRequestXmlExample:
      summary: XML example for creating a CSR order
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <Csr>
              <WorkingOrBillingTelephoneNumber>+19196191211</WorkingOrBillingTelephoneNumber>
              <AccountNumber>987654321</AccountNumber>
              <AccountTelephoneNumber>+19196194444</AccountTelephoneNumber>
              <EndUserName>bandwidthGuy</EndUserName>
              <AuthorizingUserName>authorizingUserName</AuthorizingUserName>
              <CustomerCode>123</CustomerCode>
              <EndUserPIN>12345</EndUserPIN>
              <EndUserPassword>password</EndUserPassword>
              <AddressLine1>900 Main Campus Dr</AddressLine1>
              <City>Raleigh</City>
              <State>NC</State>
              <ZIPCode>27612</ZIPCode>
              <TypeOfService>residential</TypeOfService>
        </Csr>
    csrCreateResponseXmlExample:
      summary: XML example for created CSR order response
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <CsrResponse>
            <OrderId>93118edd-9874-41b6-89a3-d8c783fe83cf</OrderId>
            <Status>RECEIVED</Status>
        </CsrResponse>
    csrGetResponseXmlExample:
      summary: XML example for a single CSR order
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <CsrResponse>
            <CustomerOrderId>someValue</CustomerOrderId>
            <LastModifiedBy>systemUser</LastModifiedBy>
            <OrderCreateDate>2019-10-25T09:51:17Z</OrderCreateDate>
            <AccountId>1</AccountId>
            <OrderId>a2f55ebe-782a-4242-983b-6ae6cfa97833</OrderId>
            <LastModifiedDate>2019-10-25T12:51:22.139Z</LastModifiedDate>
            <Status>COMPLETE</Status>
            <AccountNumber>987654321</AccountNumber>
            <AccountTelephoneNumber>+19196194444</AccountTelephoneNumber>
            <EndUserName>bandwidthGuy</EndUserName>
            <AuthorizingUserName>importantAuthGuy</AuthorizingUserName>
            <CustomerCode>123</CustomerCode>
            <EndUserPIN>12345</EndUserPIN>
            <AddressLine1>900 Main Campus Dr</AddressLine1>
            <City>Raleigh</City>
            <State>NC</State>
            <ZIPCode>27612</ZIPCode>
            <TypeOfService>residential</TypeOfService>
        </CsrResponse>
    csrUpdateRequestXmlExample:
      summary: XML example for updating a CSR order
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <Csr>
              <WorkingOrBillingTelephoneNumber>+19196191211</WorkingOrBillingTelephoneNumber>
              <WorkingTelephoneNumber>+19196191211</WorkingTelephoneNumber>
              <BillingTelephoneNumber>+19196191211</BillingTelephoneNumber>
              <CustomerName>name</CustomerName>
              <AuthorizingPersonName>name</AuthorizingPersonName>
              <AccountNumber>987654321</AccountNumber>
              <WorkingTelephoneNumbersOnAccount>
                      <TelephoneNumber>+19196191211</TelephoneNumber>
              </WorkingTelephoneNumbersOnAccount>
              <AccountTelephoneNumber>+19196194444</AccountTelephoneNumber>
              <EndUserName>bandwidthGuy</EndUserName>
              <AuthorizingUserName>authorizingUserName</AuthorizingUserName>
              <CustomerCode>123</CustomerCode>
              <EndUserPIN>12345</EndUserPIN>
              <EndUserPassword>password</EndUserPassword>
              <AddressLine1>900 Main Campus Dr</AddressLine1>
              <City>Raleigh</City>
              <State>NC</State>
              <ZIPCode>27612</ZIPCode>
              <TypeOfService>residential</TypeOfService>
        </Csr>
    csrBadRequestErrorXmlExample:
      summary: XML example for CSR bad request error
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <CsrOrderResponse>
            <Errors>
                <Error>
                    <Code>54321</Code>
                    <Description>Some error description</Description>
                </Error>
            </Errors>
        </CsrOrderResponse>
    tnPortOutPasscodesRequestBodyJsonExample:
      summary: JSON example for tn port-out passcodes request
      value:
        phoneNumbers:
          - '+13172000285'
          - '+13172000207'
          - '+13172000000'
    tnPortOutPasscodesRequestBodyXmlExample:
      summary: XML example for tn port-out passcodes request
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <TnList>
          <Tn>+13172000285</Tn>
          <Tn>+13172000207</Tn>
          <Tn>+13172000000</Tn>
          <Tn>+13172000100</Tn>
          <Tn>+13172110285</Tn>
          <Tn>+13172100285</Tn>
          <Tn>+199999999999</Tn>
          <Tn>+111111111111</Tn>
        </TnList>
    tnPortOutPasscodesGet200JsonExample:
      summary: JSON example for GET tn port-out passcodes 200 response
      value:
        phoneNumbers:
          - fullNumber: '+12018391000'
            passcode: '1234'
          - fullNumber: '+12024551000'
            passcode: '1234'
    tnPortOutPasscodesGet200XmlExample:
      summary: XML example for GET tn port-out passcodes 200 response
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <TelephoneNumbersResponse>
          <TelephoneNumbers>
            <TelephoneNumber>
              <FullNumber>+12018391000</FullNumber>
              <Passcode>1234</Passcode>
            </TelephoneNumber>
            <TelephoneNumber>
              <FullNumber>+12024551000</FullNumber>
              <Passcode>1234</Passcode>
            </TelephoneNumber>
          </TelephoneNumbers>
        </TelephoneNumbersResponse>
    tnPortOutPasscodesGet400JsonExample:
      summary: JSON example for GET tn port-out passcodes 400 response
      value:
        errors:
          - code: '15610'
            description: Telephone Numbers cannot be found on account(s) 2002013
    tnPortOutPasscodesGet400XmlExample:
      summary: XML example for GET tn port-out passcodes 400 response
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <TelephoneNumbersResponse>
          <ResponseStatus>
            <ErrorCode>15610</ErrorCode>
            <Description>Telephone Numbers cannot be found on account(s) 2002013</Description>
            <TelephoneNumbers>
              <TelephoneNumber>+12012035088</TelephoneNumber>
            </TelephoneNumbers>
          </ResponseStatus>
        </TelephoneNumbersResponse>
    tnPortOutPasscodesPost200JsonExample:
      summary: JSON example for POST tn port-out passcodes 200 response
      value:
        phoneNumbers:
          - fullNumber: '+13172000285'
            passcode: '1234'
          - fullNumber: '+13172000207'
            passcode: '1234'
    tnPortOutPasscodesPost200XmlExample:
      summary: XML example for POST tn port-out passcodes 200 response
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <TelephoneNumbersResponse>
          <TelephoneNumberCount>4</TelephoneNumberCount>
          <TelephoneNumbers>
            <TelephoneNumber>
              <FullNumber>+13172000285</FullNumber>
              <Passcode>1234</Passcode>
            </TelephoneNumber>
            <TelephoneNumber>
              <FullNumber>+13172000207</FullNumber>
              <Passcode>1234</Passcode>
            </TelephoneNumber>
          </TelephoneNumbers>
        </TelephoneNumbersResponse>
    tnPortOutPasscodesPost400JsonExample:
      summary: JSON example for POST tn port-out passcodes 400 response
      value:
        errors:
          - code: '15607'
            description: >-
              The count of Telephone numbers in POST body exceeds the maximum
              size of 2500
    tnPortOutPasscodesPost400XmlExample:
      summary: XML example for POST tn port-out passcodes 400 response
      value: |-
        <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <TelephoneNumbersResponse>
          <ResponseStatus>
            <ErrorCode>15607</ErrorCode>
            <Description>The count of Telephone numbers in POST body exceeds the maximum size of 2500</Description>
          </ResponseStatus>
        </TelephoneNumbersResponse>
  requestBodies:
    tnPortOutPasscodesRequestBody:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/tnListRequestJson'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesRequestBodyJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/tnListRequest'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesRequestBodyXmlExample'
    csrCreateRequestBody:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrRequestJson'
          examples:
            example:
              $ref: '#/components/examples/csrCreateRequestJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csr'
          examples:
            example:
              $ref: '#/components/examples/csrCreateRequestXmlExample'
    csrUpdateRequestBody:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrRequestJson'
          examples:
            example:
              $ref: '#/components/examples/csrUpdateRequestJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csr'
          examples:
            example:
              $ref: '#/components/examples/csrUpdateRequestXmlExample'
  responses:
    csrListResponse200:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrResponsesJson'
          examples:
            example:
              $ref: '#/components/examples/csrListResponseJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csrResponses'
          examples:
            example:
              $ref: '#/components/examples/csrListResponseXmlExample'
    csrCreateResponse201:
      description: Created
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrOrderResponseJson'
          examples:
            example:
              $ref: '#/components/examples/csrCreateResponseJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csrOrderResponse'
          examples:
            example:
              $ref: '#/components/examples/csrCreateResponseXmlExample'
    csrGetResponse200:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrGetResponseJson'
          examples:
            example:
              $ref: '#/components/examples/csrGetResponseJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csrGetResponse'
          examples:
            example:
              $ref: '#/components/examples/csrGetResponseXmlExample'
    csrUpdateResponse200:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrGetResponseJson'
          examples:
            example:
              $ref: '#/components/examples/csrGetResponseJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csrGetResponse'
          examples:
            example:
              $ref: '#/components/examples/csrGetResponseXmlExample'
    csrBadRequestError:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/csrErrorResponseJson'
          examples:
            example:
              $ref: '#/components/examples/csrBadRequestErrorJsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/csrErrorResponse'
          examples:
            example:
              $ref: '#/components/examples/csrBadRequestErrorXmlExample'
    errorResponse404:
      description: Not Found
    errorResponse405:
      description: Method Not Allowed
    activationStatusResponse200:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/activationStatusJson'
          examples:
            example:
              value:
                autoActivationDate: '2014-08-29T18:30:00+03:00'
                activatedPhoneNumbers:
                  - '+16052609021'
                notYetActivatedPhoneNumbers: []
        application/xml:
          schema:
            $ref: '#/components/schemas/activationStatusResponse'
          examples:
            example:
              value: |-
                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                <ActivationStatusResponse>
                    <ActivationStatus>
                        <AutoActivationDate>2014-08-29T18:30:00+03:00</AutoActivationDate>
                        <ActivatedTelephoneNumbersList>
                            <TelephoneNumber>+16052609021</TelephoneNumber>
                        </ActivatedTelephoneNumbersList>
                        <NotYetActivatedTelephoneNumbersList/>
                    </ActivationStatus>
                </ActivationStatusResponse>
    activationStatusPutResponse200:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/activationStatusJson'
          examples:
            example:
              value:
                autoActivationDate: '2014-08-30T18:30:00+03:00'
        application/xml:
          examples:
            example:
              value: |-
                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                <ActivationStatusResponse>
                    <ActivationStatus>
                        <AutoActivationDate>2014-08-30T18:30:00+03:00</AutoActivationDate>
                    </ActivationStatus>
                </ActivationStatusResponse>
    activationStatusResponse400:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/activationStatusErrorResponseJson'
          examples:
            example:
              value:
                code: '7342'
                description: On demand port-in activation not yet allowed.
        application/xml:
          examples:
            example:
              value: |-
                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                <ActivationStatusResponse>
                    <ResponseStatus>
                        <ErrorCode>7342</ErrorCode>
                        <Description>On demand port-in activation not yet allowed.</Description>
                    </ResponseStatus>
                </ActivationStatusResponse>
    activationStatusResponse404:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/activationStatusErrorResponseJson'
          examples:
            example:
              value:
                code: '7348'
                description: The order is already complete
        application/xml:
          examples:
            example:
              value: |-
                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                <ActivationStatusResponse>
                    <ResponseStatus>
                        <ErrorCode>7348</ErrorCode>
                        <Description>The order is already complete</Description>
                    </ResponseStatus>
                </ActivationStatusResponse>
    errorResponse401:
      description: Unauthorized
    errorResponse403:
      description: Forbidden
    errorResponse429:
      description: Too Many Requests
    tnPortOutPasscodesGet200Response:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/tnPortOutPasscodesResponseJson'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesGet200JsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/tnPortOutPasscodesResponse'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesGet200XmlExample'
    tnPortOutPasscodesGet400Response:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/tnPortOutPasscodesErrorResponseJson'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesGet400JsonExample'
        application/xml:
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesGet400XmlExample'
    tnPortOutPasscodesPost200Response:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/tnPortOutPasscodesResponseJson'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesPost200JsonExample'
        application/xml:
          schema:
            $ref: '#/components/schemas/tnPortOutPasscodesResponse'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesPost200XmlExample'
    tnPortOutPasscodesPost400Response:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/tnPortOutPasscodesErrorResponseJson'
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesPost400JsonExample'
        application/xml:
          examples:
            example:
              $ref: '#/components/examples/tnPortOutPasscodesPost400XmlExample'
    errorResponse500:
      description: Internal Server Error
  securitySchemes:
    Basic:
      type: http
      scheme: basic
      description: >-
        Basic authentication is a simple authentication scheme built into the
        HTTP protocol. To use it, send your HTTP requests with an Authorization
        header that contains the word Basic followed by a space and a
        base64-encoded string `username:password`.

        Example: `Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=`
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer authentication (also called token authentication) is an HTTP
        authentication scheme that involves security 

        tokens called bearer tokens. The name "Bearer authentication" can be
        understood as "give access to the bearer

        of this token." The client must send this token in the `Authorization`
        header when making requests to

        protected resources.


        - Example: `Authorization: Bearer <token>`


        Where `<token>` should be replaced with the token string without angle
        brackets.


        For more information, see the following guide:
        [Credentials](https://dev.bandwidth.com/docs/account/credentials/management)
  parameters:
    tnPortoutPasscodesPageQueryParam:
      name: page
      description: >-
        An ID of the first element in a page. This value will indicate the first
        value, not the count, of the initial entry in the page being requested.
        Note in the example that the page is the TN that begins the page. The
        initial page is tagged with the ID `1`.
      in: query
      required: true
      schema:
        type: string
        default: '1'
      example: '1'
    tnPortoutPasscodesSizeQueryParam:
      name: size
      description: The number of items to include in a page.
      in: query
      required: true
      schema:
        type: integer
        default: 500
      example: 250
    AccountIdPathParam:
      name: accountId
      description: User's account ID.
      in: path
      required: true
      schema:
        type: string
      example: '1234567'
    OrderIdPathParam:
      name: orderId
      description: The port-in order ID.
      in: path
      required: true
      schema:
        type: string
      example: d28f4d00-4af1-4b03-b1d4-fc0a9e9ef6b3
    modifiedDateFromQueryParam:
      name: modifiedDateFrom
      description: The earliest date that the order was last modified.
      in: query
      required: false
      schema:
        type: string
      example: '2014-08-05 00:00:00+00:00'
    modifiedDateToQueryParam:
      name: modifiedDateTo
      description: >-
        The latest date that the order was last modified. If no modifiedDateTo
        is specified when a modifiedDateFrom is specified then 'now' will be
        presumed to be the modifiedDateTo.
      in: query
      required: false
      schema:
        type: string
      example: '2014-08-05 00:00:00+00:00'
    pageQueryParam:
      name: page
      description: >-
        The CSR order id corresponding to the page that you want to start from.
        "1" is used as a convention for the first CSR order for the account.
        Defaults to 1, if not provided.
      in: query
      required: false
      schema:
        type: string
      example: ca8065d1-ec1a-43da-af40-1dcee43becb5
    sizeQueryParam:
      name: size
      description: The maximum number of results to retrieve.
      in: query
      required: false
      schema:
        type: integer
        default: 300
      example: 30
    statusQueryParam:
      name: status
      description: Displays the CSR orders with a given order status.
      in: query
      required: false
      schema:
        type: string
      example: complete
  schemas:
    csrRequestJson:
      type: object
      description: JSON request body for creating or updating a CSR order.
      required:
        - workingOrBillingTelephoneNumber
      properties:
        customerOrderId:
          type: string
          description: Optional customer-defined reference ID for this order.
          maxLength: 255
        workingOrBillingTelephoneNumber:
          type: string
          description: Working or Billing telephone number in E.164 format.
        accountNumber:
          type: string
          description: The main account number on the bill.
          maxLength: 20
        accountTelephoneNumber:
          type: string
          description: >-
            The account telephone number assigned by the current service
            provider.
          maxLength: 12
        endUserName:
          type: string
          description: The name of the end user associated with the telephone number.
          maxLength: 100
        authorizingUserName:
          type: string
          description: The name of the end user who signed the authorization.
          maxLength: 100
        customerCode:
          type: string
          description: The customer code associated with the service provider.
          maxLength: 3
        endUserPin:
          type: string
          description: The end user personal identification number (PIN).
          maxLength: 50
        endUserPassword:
          type: string
          description: The end user password to access the CSR, if applicable.
          maxLength: 100
        addressLine1:
          type: string
          description: Address line 1 portion of the service address.
          maxLength: 200
        city:
          type: string
          description: City where the telephone number is being serviced.
          maxLength: 100
        state:
          type: string
          description: State or province abbreviation (XX format).
          maxLength: 2
        zipCode:
          type: string
          description: >-
            ZIP code or postal code where the telephone number is being
            serviced.
          maxLength: 10
        typeOfService:
          type: string
          description: The type of service identifying the end user account.
          maxLength: 50
        status:
          type: string
          description: The order status.
        workingTelephoneNumber:
          type: string
          description: Working telephone number in E.164 format.
        billingTelephoneNumber:
          type: string
          description: Billing telephone number in E.164 format.
        customerName:
          type: string
          description: The subscriber name associated with the telephone number.
        authorizingPersonName:
          type: string
          description: The name of the person authorizing the CSR request.
        workingTelephoneNumbersOnAccount:
          type: array
          description: List of all telephone numbers on the account.
          items:
            type: string
        csrServiceAddress:
          type: object
          description: The service address for the CSR.
          properties:
            houseNumber:
              type: string
            streetName:
              type: string
            city:
              type: string
            stateCode:
              type: string
            zip:
              type: string
            country:
              type: string
            addressType:
              type: string
    csrOrderStatus:
      type: string
      description: The current status of the CSR order.
      enum:
        - RECEIVED
        - PROCESSING
        - ACTION_REQUIRED
        - COMPLETE
        - FAILED
        - REQUESTED_CANCEL
        - CANCELLED
    csrOrderResponseJson:
      type: object
      description: JSON response for a created CSR order.
      properties:
        orderId:
          type: string
          description: The Bandwidth-assigned identifier for this CSR order.
        status:
          $ref: '#/components/schemas/csrOrderStatus'
    csrOrderResponse:
      type: object
      properties:
        OrderId:
          type: string
        Status:
          type: string
    csrGetResponseJson:
      type: object
      description: JSON representation of a single CSR order.
      properties:
        customerOrderId:
          type: string
        lastModifiedBy:
          type: string
        orderCreateDate:
          type: string
          format: date-time
          example: '2019-10-25T09:51:17Z'
        accountId:
          type: integer
        orderId:
          type: string
        lastModifiedDate:
          type: string
          format: date-time
          example: '2019-10-25T12:51:22Z'
        status:
          $ref: '#/components/schemas/csrOrderStatus'
        accountNumber:
          type: string
        accountTelephoneNumber:
          type: string
        endUserName:
          type: string
        authorizingUserName:
          type: string
        customerCode:
          type: string
        endUserPin:
          type: string
        addressLine1:
          type: string
        city:
          type: string
        state:
          type: string
        zipCode:
          type: string
        typeOfService:
          type: string
        csrData:
          type: object
          properties:
            accountNumber:
              type: string
            customerName:
              type: string
            serviceAddress:
              type: object
              properties:
                unparsedAddress:
                  type: string
                city:
                  type: string
                state:
                  type: string
                zip:
                  type: string
            workingTelephoneNumber:
              type: string
            workingTelephoneNumbersOnAccount:
              type: array
              items:
                type: string
    csrResponsesJson:
      type: object
      description: JSON representation of a list of CSR orders for an account.
      properties:
        totalCount:
          type: integer
        csrOrders:
          type: array
          items:
            type: object
            properties:
              customerOrderId:
                type: string
              lastModifiedBy:
                type: string
              orderCreateDate:
                type: string
                format: date-time
                example: '2019-10-25T09:51:17Z'
              accountId:
                type: integer
              orderId:
                type: string
              lastModifiedDate:
                type: string
                format: date-time
                example: '2019-10-25T12:51:22Z'
              status:
                $ref: '#/components/schemas/csrOrderStatus'
              accountNumber:
                type: string
              accountTelephoneNumber:
                type: string
              endUserName:
                type: string
              authorizingUserName:
                type: string
              customerCode:
                type: string
              endUserPin:
                type: string
              addressLine1:
                type: string
              city:
                type: string
              state:
                type: string
              zipCode:
                type: string
              typeOfService:
                type: string
              csrData:
                type: object
                properties:
                  accountNumber:
                    type: string
                  customerName:
                    type: string
                  serviceAddress:
                    type: object
                    properties:
                      unparsedAddress:
                        type: string
                      city:
                        type: string
                      state:
                        type: string
                      zip:
                        type: string
                  workingTelephoneNumber:
                    type: string
                  workingTelephoneNumbersOnAccount:
                    type: array
                    items:
                      type: string
    csrResponses:
      type: object
      properties:
        TotalCount:
          type: integer
        CsrResponse:
          type: array
          items:
            type: object
    csrGetResponse:
      type: object
      properties:
        CustomerOrderId:
          type: string
        OrderId:
          type: string
        Status:
          type: string
    csrErrorResponseJson:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: integer
              description:
                type: string
    csrErrorResponse:
      type: object
      properties:
        CsrOrderResponse:
          type: object
          properties:
            Errors:
              type: array
              items:
                properties:
                  Code:
                    type: integer
                  Description:
                    type: string
    csr:
      type: object
      properties:
        WorkingOrBillingTelephoneNumber:
          type: string
        AccountNumber:
          type: string
        AccountTelephoneNumber:
          type: string
        EndUserName:
          type: string
        AuthorizingUserName:
          type: string
        CustomerCode:
          type: string
        EndUserPIN:
          type: string
        EndUserPassword:
          type: string
        AddressLine1:
          type: string
        City:
          type: string
        State:
          type: string
        ZIPCode:
          type: string
        TypeOfService:
          type: string
    activationStatus:
      type: object
      properties:
        ActivationStatus:
          type: object
          properties:
            AutoActivationDate:
              description: >-
                The date when auto activation is requested. It can be a
                date/time in the past, if immediate activation is desired.
              type: string
              format: date-time
            ActivatedTelephoneNumbersList:
              description: >-
                This is the list of TNs that have been activated for the port-in
                order.
              type: array
              items:
                type: string
            NotYetActivatedTelephoneNumbersList:
              description: >-
                This is the list of TNs that have not yet been activated for the
                port-in order.
              type: array
              items:
                type: string
    activationStatusResponse:
      type: object
      properties:
        ActivationStatusResponse:
          $ref: '#/components/schemas/activationStatus'
    activationStatusJson:
      type: object
      properties:
        activatedPhoneNumbers:
          description: >-
            List of phone numbers that have been activated for the port-in
            order.
          type: array
          items:
            type: string
        notYetActivatedPhoneNumbers:
          description: >-
            List of phone numbers that have not yet been activated for the
            port-in order.
          type: array
          items:
            type: string
        autoActivationDate:
          description: The date when auto activation is requested. RFC 3339 format.
          type: string
          format: date-time
    activationStatusErrorResponseJson:
      type: object
      properties:
        code:
          type: string
          description: Error code.
        description:
          type: string
          description: Error description.
    tnPortOutPasscodesResponseJson:
      type: object
      properties:
        phoneNumbers:
          type: array
          description: List of phone numbers with their associated port-out passcodes.
          items:
            type: object
            properties:
              fullNumber:
                type: string
                description: >-
                  Phone number in E.164 format starting with '+'. Example:
                  +15551234567
              passcode:
                type: string
                description: Port-out passcode for the phone number.
    tnPortOutPasscodesResponse:
      type: object
      properties:
        TelephoneNumbersResponse:
          type: object
          properties:
            TelephoneNumberCount:
              type: integer
            TelephoneNumbers:
              $ref: '#/components/schemas/tnPortOutPasscodesPayload'
            ErrorList:
              type: array
              items:
                type: object
                properties:
                  Code:
                    type: string
                  Description:
                    type: string
                  TelephoneNumbers:
                    type: object
                    properties:
                      TelephoneNumber:
                        type: array
                        items:
                          type: string
    tnPortOutPasscodesPayload:
      type: object
      properties:
        TelephoneNumber:
          type: array
          items:
            $ref: '#/components/schemas/tnPortOutPasscodePayload'
    tnPortOutPasscodePayload:
      type: object
      properties:
        FullNumber:
          type: string
        Passcode:
          type: string
    tnPortOutPasscodesErrorResponseJson:
      type: object
      properties:
        errors:
          type: array
          description: List of errors.
          items:
            type: object
            properties:
              code:
                type: string
                description: Error code.
              description:
                type: string
                description: Error description.
    tnListRequestJson:
      type: object
      properties:
        phoneNumbers:
          type: array
          items:
            type: string
          description: List of phone numbers in E.164 format.
    tnListRequest:
      type: object
      properties:
        TnList:
          type: object
          properties:
            Tn:
              type: array
              items:
                type: string
tags:
  - name: Porting
    description: Manage port-in orders and their activation status.
