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

# Verify verification code by phone number



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/verify.yml post /verifications/by_phone_number/{phone_number}/actions/verify
openapi: 3.1.0
info:
  title: Telnyx Verify API
  version: 2.0.0
  description: API for Verify.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /verifications/by_phone_number/{phone_number}/actions/verify:
    post:
      tags:
        - Verify
      summary: Verify verification code by phone number
      operationId: VerifyVerificationCodeByPhoneNumber
      parameters:
        - required: true
          description: >-
            The phone number associated with the verification code being
            verified.
          schema:
            example: '+13035551234'
            type: string
            description: +E164 formatted phone number.
          name: phone_number
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyVerificationCodeRequestByPhoneNumber'
        required: true
      responses:
        '200':
          description: Expected verify response to a valid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifyVerificationCodeResponse'
        '400':
          $ref: '#/components/responses/verify_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 verifyVerificationCodeResponse = await
            client.verifications.byPhoneNumber.actions.verify(
              '+13035551234',
              { code: '17686', verify_profile_id: '12ade33a-21c0-473b-b055-b3c836e1c292' },
            );


            console.log(verifyVerificationCodeResponse.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
            )

            verify_verification_code_response =
            client.verifications.by_phone_number.actions.verify(
                phone_number="+13035551234",
                code="17686",
                verify_profile_id="12ade33a-21c0-473b-b055-b3c836e1c292",
            )

            print(verify_verification_code_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\tverifyVerificationCodeResponse, err := client.Verifications.ByPhoneNumber.Actions.Verify(\n\t\tcontext.TODO(),\n\t\t\"+13035551234\",\n\t\ttelnyx.VerificationByPhoneNumberActionVerifyParams{\n\t\t\tCode:            \"17686\",\n\t\t\tVerifyProfileID: \"12ade33a-21c0-473b-b055-b3c836e1c292\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", verifyVerificationCodeResponse.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.verifications.byphonenumber.actions.ActionVerifyParams;

            import
            com.telnyx.sdk.models.verifications.byphonenumber.actions.VerifyVerificationCodeResponse;


            public final class Main {
                private Main() {}

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

                    ActionVerifyParams params = ActionVerifyParams.builder()
                        .phoneNumber("+13035551234")
                        .code("17686")
                        .verifyProfileId("12ade33a-21c0-473b-b055-b3c836e1c292")
                        .build();
                    VerifyVerificationCodeResponse verifyVerificationCodeResponse = client.verifications().byPhoneNumber().actions().verify(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            verify_verification_code_response =
            telnyx.verifications.by_phone_number.actions.verify(
              "+13035551234",
              code: "17686",
              verify_profile_id: "12ade33a-21c0-473b-b055-b3c836e1c292"
            )


            puts(verify_verification_code_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 {
              $verifyVerificationCodeResponse = $client
                ->verifications
                ->byPhoneNumber
                ->actions
                ->verify(
                '+13035551234',
                code: '17686',
                verifyProfileID: '12ade33a-21c0-473b-b055-b3c836e1c292',
              );

              var_dump($verifyVerificationCodeResponse);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx verifications:by-phone-number:actions verify \
              --api-key 'My API Key' \
              --phone-number +13035551234 \
              --code 17686 \
              --verify-profile-id 12ade33a-21c0-473b-b055-b3c836e1c292
components:
  schemas:
    VerifyVerificationCodeRequestByPhoneNumber:
      title: VerifyVerificationCodeRequestByPhoneNumber
      required:
        - code
        - verify_profile_id
      type: object
      properties:
        code:
          example: '17686'
          type: string
          description: This is the code the user submits for verification.
        verify_profile_id:
          example: 12ade33a-21c0-473b-b055-b3c836e1c292
          type: string
          format: uuid
          description: The identifier of the associated Verify profile.
    VerifyVerificationCodeResponse:
      title: VerifyVerificationCodeResponse
      required:
        - data
      type: object
      properties:
        data:
          required:
            - phone_number
            - response_code
          type: object
          properties:
            phone_number:
              example: '+13035551234'
              type: string
              description: +E164 formatted phone number.
            response_code:
              enum:
                - accepted
                - rejected
              type: string
              example: accepted
              description: >-
                Identifies if the verification code has been accepted or
                rejected.
    verify_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/verify_Error'
      type: object
    verify_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
          example: '10015'
        title:
          type: string
          example: Invalid sorting value
        detail:
          type: string
          example: >-
            The value provided for sorting is not valid. Check the value used
            and try again.
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
              example: /sort
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          properties:
            url:
              type: string
              description: URL with additional information on the error.
              example: https://developers.telnyx.com/docs/overview/errors/10015
      type: object
  responses:
    verify_GenericErrorResponse:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/verify_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````