> ## 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 hosted number verification codes

> Create verification codes to validate numbers of the hosted order. The verification codes will be sent to the numbers of the hosted order.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/messaging/hosted-numbers.yml post /messaging_hosted_number_orders/{id}/verification_codes
openapi: 3.1.0
info:
  title: Telnyx Messaging Hosted Numbers API
  version: 2.0.0
  description: API for messaging hosted number orders.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /messaging_hosted_number_orders/{id}/verification_codes:
    post:
      tags:
        - Hosted Numbers
      summary: Create hosted number verification codes
      description: >-
        Create verification codes to validate numbers of the hosted order. The
        verification codes will be sent to the numbers of the hosted order.
      operationId: CreateVerificationCodesForMessagingHostedNumberOrder
      parameters:
        - name: id
          in: path
          description: Order ID to have a verification code created.
          required: true
          schema:
            type: string
      requestBody:
        description: Message payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerificationCodesRequest'
      responses:
        '200':
          description: >-
            Verification codes created and sent to the phone numbers of the
            hosted order.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedVerificationCodesResponse'
        4XX:
          $ref: '#/components/responses/messaging_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 response = await
            client.messagingHostedNumberOrders.createVerificationCodes('id', {
              phone_numbers: ['string'],
              verification_method: 'sms',
            });


            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.messaging_hosted_number_orders.create_verification_codes(
                id="id",
                phone_numbers=["string"],
                verification_method="sms",
            )

            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.MessagingHostedNumberOrders.NewVerificationCodes(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t\ttelnyx.MessagingHostedNumberOrderNewVerificationCodesParams{\n\t\t\tPhoneNumbers:       []string{\"string\"},\n\t\t\tVerificationMethod: telnyx.MessagingHostedNumberOrderNewVerificationCodesParamsVerificationMethodSMS,\n\t\t},\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.messaginghostednumberorders.MessagingHostedNumberOrderCreateVerificationCodesParams;

            import
            com.telnyx.sdk.models.messaginghostednumberorders.MessagingHostedNumberOrderCreateVerificationCodesResponse;


            public final class Main {
                private Main() {}

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

                    MessagingHostedNumberOrderCreateVerificationCodesParams params = MessagingHostedNumberOrderCreateVerificationCodesParams.builder()
                        .id("id")
                        .addPhoneNumber("string")
                        .verificationMethod(MessagingHostedNumberOrderCreateVerificationCodesParams.VerificationMethod.SMS)
                        .build();
                    MessagingHostedNumberOrderCreateVerificationCodesResponse response = client.messagingHostedNumberOrders().createVerificationCodes(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response =
            telnyx.messaging_hosted_number_orders.create_verification_codes(
              "id",
              phone_numbers: ["string"],
              verification_method: :sms
            )


            puts(response)
        - lang: CLI
          source: |-
            telnyx messaging-hosted-number-orders create-verification-codes \
              --api-key 'My API Key' \
              --id id \
              --phone-number string \
              --verification-method sms
components:
  schemas:
    VerificationCodesRequest:
      type: object
      properties:
        phone_numbers:
          type: array
          items:
            type: string
            x-format: +E.164
        verification_method:
          type: string
          enum:
            - sms
            - call
      required:
        - phone_numbers
        - verification_method
    CreatedVerificationCodesResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            title: VerificationCodeResult
            description: Verification code result response
            required:
              - phone_number
            properties:
              phone_number:
                type: string
                x-format: +E.164
                description: Phone number for which the verification code was created
              verification_code_id:
                type: string
                format: uuid
                description: Unique identifier for the verification code
              type:
                type: string
                enum:
                  - sms
                  - call
                description: Type of verification method used
              error:
                type: string
                description: >-
                  Error message describing why the verification code creation
                  failed
      required:
        - data
    messaging_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/messaging_Error'
    messaging_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
          x-format: integer
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
              format: json-pointer
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
  responses:
    messaging_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/messaging_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````