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

# Deletes all numbers associated with a phone number block

> Creates a new background job to delete all the phone numbers associated with the given block. We will only consider the phone number block as deleted after all phone numbers associated with it are removed, so multiple executions of this job may be necessary in case some of the phone numbers present errors during the deletion process.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/management-config.yml post /phone_number_blocks/jobs/delete_phone_number_block
openapi: 3.1.0
info:
  title: Telnyx Phone Number Management API
  version: 2.0.0
  description: API for managing and configuring phone numbers.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /phone_number_blocks/jobs/delete_phone_number_block:
    post:
      tags:
        - Phone Number Blocks Background Jobs
      summary: Deletes all numbers associated with a phone number block
      description: >-
        Creates a new background job to delete all the phone numbers associated
        with the given block. We will only consider the phone number block as
        deleted after all phone numbers associated with it are removed, so
        multiple executions of this job may be necessary in case some of the
        phone numbers present errors during the deletion process.
      operationId: CreatePhoneNumberBlockDeletionJob
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/PhoneNumberBlocksJobDeletePhoneNumberBlockRequest
      responses:
        '202':
          description: Phone number blocks job delete phone numbers requested.
          content:
            application/json:
              schema:
                type: object
                title: Phone Number Blocks Job Delete Phone Number Block
                properties:
                  data:
                    $ref: '#/components/schemas/PhoneNumberBlocksJob'
        '400':
          $ref: '#/components/responses/numbers_BadRequestResponse'
        '401':
          $ref: '#/components/responses/numbers_UnauthorizedResponse'
        '404':
          $ref: '#/components/responses/numbers_NotFoundResponse'
        '422':
          $ref: '#/components/responses/numbers_UnprocessableEntity'
        '500':
          $ref: '#/components/responses/numbers_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.phoneNumberBlocks.jobs.deletePhoneNumberBlock({
              phone_number_block_id: 'f3946371-7199-4261-9c3d-81a0d7935146',
            });


            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.phone_number_blocks.jobs.delete_phone_number_block(
                phone_number_block_id="f3946371-7199-4261-9c3d-81a0d7935146",
            )

            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.PhoneNumberBlocks.Jobs.DeletePhoneNumberBlock(context.TODO(), telnyx.PhoneNumberBlockJobDeletePhoneNumberBlockParams{\n\t\tPhoneNumberBlockID: \"f3946371-7199-4261-9c3d-81a0d7935146\",\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.phonenumberblocks.jobs.JobDeletePhoneNumberBlockParams;

            import
            com.telnyx.sdk.models.phonenumberblocks.jobs.JobDeletePhoneNumberBlockResponse;


            public final class Main {
                private Main() {}

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

                    JobDeletePhoneNumberBlockParams params = JobDeletePhoneNumberBlockParams.builder()
                        .phoneNumberBlockId("f3946371-7199-4261-9c3d-81a0d7935146")
                        .build();
                    JobDeletePhoneNumberBlockResponse response = client.phoneNumberBlocks().jobs().deletePhoneNumberBlock(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response =
            telnyx.phone_number_blocks.jobs.delete_phone_number_block(
              phone_number_block_id: "f3946371-7199-4261-9c3d-81a0d7935146"
            )


            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->phoneNumberBlocks->jobs->deletePhoneNumberBlock(
                phoneNumberBlockID: 'f3946371-7199-4261-9c3d-81a0d7935146'
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx phone-number-blocks:jobs delete-phone-number-block \
              --api-key 'My API Key' \
              --phone-number-block-id f3946371-7199-4261-9c3d-81a0d7935146
components:
  schemas:
    PhoneNumberBlocksJobDeletePhoneNumberBlockRequest:
      type: object
      required:
        - phone_number_block_id
      properties:
        phone_number_block_id:
          type: string
      example:
        phone_number_block_id: f3946371-7199-4261-9c3d-81a0d7935146
    PhoneNumberBlocksJob:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 42587e44-3a3e-46de-9255-0c9a7a1d1ec7
          description: Identifies the resource.
          readOnly: true
        record_type:
          type: string
          example: phone_number_block_job
          description: Identifies the type of the resource.
          readOnly: true
        status:
          type: string
          enum:
            - pending
            - in_progress
            - completed
            - failed
          default: pending
          example: pending
          description: Indicates the completion status of the background operation.
          readOnly: true
        type:
          type: string
          enum:
            - delete_phone_number_block
          example: delete_phone_number_block
          description: Identifies the type of the background job.
          readOnly: true
        etc:
          type: string
          format: date-time
          description: >-
            ISO 8601 formatted date indicating when the estimated time of
            completion of the background job.
          readOnly: true
        created_at:
          type: string
          description: ISO 8601 formatted date indicating when the resource was created.
          readOnly: true
        updated_at:
          type: string
          description: ISO 8601 formatted date indicating when the resource was updated.
          readOnly: true
        successful_operations:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumberBlocksJobSuccessfulOperation'
            description: The phone numbers successfully updated.
          readOnly: true
        failed_operations:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumberBlocksJobFailedOperation'
          readOnly: true
      example:
        id: 42587e44-3a3e-46de-9255-0c9a7a1d1ec7
        record_type: phone_numbers_job
        status: pending
        type: delete_phone_number_block
        etc: '2020-10-30T18:10:00.000Z'
        created_at: '2020-10-23T18:10:00.000Z'
        updated_at: '2020-10-23T18:10:01.000Z'
        successful_operations: []
        failed_operations: []
    PhoneNumberBlocksJobSuccessfulOperation:
      properties:
        phone_number:
          type: string
          description: The phone number in e164 format.
        id:
          type: string
          description: The phone number's ID
      type: object
    PhoneNumberBlocksJobFailedOperation:
      properties:
        phone_number:
          type: string
          description: The phone number in e164 format.
        id:
          type: string
          description: The phone number's ID
        errors:
          type: array
          items:
            $ref: '#/components/schemas/numbers_Error'
      type: object
    numbers_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/numbers_Error'
      type: object
    numbers_Error:
      properties:
        code:
          type: string
          example: '10007'
        title:
          type: string
          example: Unexpected error
        detail:
          type: string
          example: An unexpected error occured.
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
              example: /base
            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:
    numbers_BadRequestResponse:
      description: >-
        Bad request, the request was unacceptable, often due to missing a
        required parameter.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
    numbers_UnauthorizedResponse:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
          examples:
            Authentication Failed:
              value:
                errors:
                  - code: '10009'
                    title: Authentication failed
                    detail: Could not understand the provided credentials.
                    meta:
                      url: https://developers.telnyx.com/docs/overview/errors/10009
    numbers_NotFoundResponse:
      description: The requested resource doesn't exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
    numbers_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
    numbers_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````