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

# Update the emergency settings from a batch of numbers

> Creates a background job to update the emergency settings of a collection of phone numbers. At most one thousand numbers can be updated per API call.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/management-config.yml post /phone_numbers/jobs/update_emergency_settings
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_numbers/jobs/update_emergency_settings:
    post:
      tags:
        - Bulk Phone Number Operations
      summary: Update the emergency settings from a batch of numbers
      description: >-
        Creates a background job to update the emergency settings of a
        collection of phone numbers. At most one thousand numbers can be updated
        per API call.
      operationId: CreatePhoneNumbersJobUpdateEmergencySettings
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/PhoneNumbersJobUpdateEmergencySettingsRequest
      responses:
        '202':
          description: Phone numbers enable emergency requested.
          content:
            application/json:
              schema:
                type: object
                title: Phone Numbers Enable Emergency
                properties:
                  data:
                    $ref: '#/components/schemas/PhoneNumbersJob'
        '400':
          $ref: '#/components/responses/numbers_BadRequestResponse'
        '401':
          $ref: '#/components/responses/numbers_UnauthorizedResponse'
        '403':
          $ref: '#/components/responses/numbers_ForbiddenResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/numbers_Errors'
              examples:
                Phone numbers must be present:
                  $ref: '#/components/examples/PhoneNumbersMustBePresent'
                Maximum allowed phone numbers:
                  $ref: '#/components/examples/MaximumAllowedPhoneNumbers'
                Minimum allowed phone numbers:
                  $ref: '#/components/examples/MinimumAllowedPhoneNumbers'
                Mixed IDs and E164 values:
                  $ref: '#/components/examples/MixedIdsAndE164Values'
                Phone number ownership:
                  $ref: '#/components/examples/PhoneNumberOwnership'
                Maximum jobs allowed:
                  value:
                    errors:
                      - code: '10015'
                        title: Bad Request
                        detail: You can have at most 500 pending or in progress jobs
                        source:
                          pointer: /base
                        meta:
                          url: >-
                            https://developers.telnyx.com/docs/overview/errors/10015
        '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.phoneNumbers.jobs.updateEmergencySettingsBatch({
              emergency_enabled: true,
              phone_numbers: ['+19705555098', '+19715555098', '32873127836'],
            });


            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_numbers.jobs.update_emergency_settings_batch(
                emergency_enabled=True,
                phone_numbers=["+19705555098", "+19715555098", "32873127836"],
            )

            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.PhoneNumbers.Jobs.UpdateEmergencySettingsBatch(context.TODO(), telnyx.PhoneNumberJobUpdateEmergencySettingsBatchParams{\n\t\tEmergencyEnabled: true,\n\t\tPhoneNumbers:     []string{\"+19705555098\", \"+19715555098\", \"32873127836\"},\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.phonenumbers.jobs.JobUpdateEmergencySettingsBatchParams;

            import
            com.telnyx.sdk.models.phonenumbers.jobs.JobUpdateEmergencySettingsBatchResponse;

            import java.util.List;


            public final class Main {
                private Main() {}

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

                    JobUpdateEmergencySettingsBatchParams params = JobUpdateEmergencySettingsBatchParams.builder()
                        .emergencyEnabled(true)
                        .phoneNumbers(List.of(
                          "+19705555098",
                          "+19715555098",
                          "32873127836"
                        ))
                        .build();
                    JobUpdateEmergencySettingsBatchResponse response = client.phoneNumbers().jobs().updateEmergencySettingsBatch(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response =
            telnyx.phone_numbers.jobs.update_emergency_settings_batch(
              emergency_enabled: true,
              phone_numbers: ["+19705555098", "+19715555098", "32873127836"]
            )


            puts(response)
        - lang: CLI
          source: |-
            telnyx phone-numbers:jobs update-emergency-settings-batch \
              --api-key 'My API Key' \
              --emergency-enabled \
              --phone-number "'+19705555098'" \
              --phone-number "'+19715555098'" \
              --phone-number "'32873127836'"
components:
  schemas:
    PhoneNumbersJobUpdateEmergencySettingsRequest:
      type: object
      required:
        - emergency_enabled
        - phone_numbers
      properties:
        phone_numbers:
          type: array
          items:
            description: >-
              Array of phone number ids and/or phone numbers in E164 format to
              update
            type: string
        emergency_enabled:
          type: boolean
          description: >-
            Indicates whether to enable or disable emergency services on the
            numbers.
        emergency_address_id:
          type:
            - string
            - 'null'
          description: >-
            Identifies the address to be used with emergency services. Required
            if emergency_enabled is true, must be null or omitted if
            emergency_enabled is false.
      example:
        emergency_enabled: true
        emergency_address_id: '53829456729313'
        phone_numbers:
          - '+19705555098'
          - '+19715555098'
          - '32873127836'
    PhoneNumbersJob:
      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_numbers_job
          description: Identifies the type of the resource.
          readOnly: true
        status:
          type: string
          enum:
            - pending
            - in_progress
            - completed
            - failed
            - expired
          default: pending
          example: pending
          description: Indicates the completion status of the background update.
          readOnly: true
        type:
          type: string
          enum:
            - update_emergency_settings
            - delete_phone_numbers
            - update_phone_numbers
          example: update_emergency_settings
          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
        phone_numbers:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumbersJobPhoneNumber'
            description: The unique phone numbers given as arguments in the job creation.
        successful_operations:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumbersJobSuccessfulOperation'
            description: The phone numbers successfully updated.
          readOnly: true
        pending_operations:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumbersJobPendingOperation'
            description: >-
              The phone numbers pending confirmation on update results. Entries
              in this list are transient, and will be moved to either
              successful_operations or failed_operations once the processing is
              done.
          readOnly: true
        failed_operations:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumbersJobFailedOperation'
          readOnly: true
      example:
        id: 42587e44-3a3e-46de-9255-0c9a7a1d1ec7
        record_type: phone_numbers_job
        status: pending
        type: update_emergency_settings
        etc: '2020-10-30T18:10:00.000Z'
        created_at: '2020-10-23T18:10:00.000Z'
        updated_at: '2020-10-23T18:10:01.000Z'
        phone_numbers:
          - id: '2637816387126861836'
          - phone_number: '+19715555098'
          - phone_number: '+19705555099'
          - id: '3388768018273'
        successful_operations:
          - id: '2637816387126861836'
            phone_number: '+19705555098'
          - id: '33081887126861836'
            phone_number: '+19715555098'
        pending_operations:
          - id: '2637816387126861837'
            phone_number: '+19705555099'
        failed_operations:
          - id: '3388768018273'
            phone_number: '+19705551234'
            errors:
              - code: '10015'
                title: Bad Request
                detail: The field is invalid.
                source:
                  pointer: /emergency_address_id
    numbers_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/numbers_Error'
      type: object
    PhoneNumbersJobPhoneNumber:
      properties:
        phone_number:
          type: string
          description: The phone number in e164 format.
          example: '+19705555000'
        id:
          type: string
          description: The phone number's ID
      type: object
    PhoneNumbersJobSuccessfulOperation:
      properties:
        phone_number:
          type: string
          description: The phone number in e164 format.
        id:
          type: string
          description: The phone number's ID
      type: object
    PhoneNumbersJobPendingOperation:
      properties:
        phone_number:
          type: string
          description: The phone number in e164 format.
        id:
          type: string
          description: The phone number's ID
      type: object
    PhoneNumbersJobFailedOperation:
      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_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_ForbiddenResponse:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
          examples:
            Not authorized:
              $ref: '#/components/examples/NotAuthorized'
    numbers_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/numbers_Errors'
  examples:
    PhoneNumbersMustBePresent:
      value:
        errors:
          - code: '10015'
            title: Bad Request
            detail: must be present
            source:
              pointer: /phone_numbers
            meta:
              url: https://developers.telnyx.com/docs/overview/errors/10015
    MaximumAllowedPhoneNumbers:
      value:
        errors:
          - code: '10015'
            title: Bad Request
            detail: 1000 numbers is the maximum allowed.
            source:
              pointer: /phone_numbers
            meta:
              url: https://developers.telnyx.com/docs/overview/errors/10015
    MinimumAllowedPhoneNumbers:
      value:
        errors:
          - code: '10015'
            title: Bad Request
            detail: You must provide at least 1 phone number.
            source:
              pointer: /phone_numbers
            meta:
              url: https://developers.telnyx.com/docs/overview/errors/10015
    MixedIdsAndE164Values:
      value:
        errors:
          - code: '10015'
            title: Bad Request
            detail: >-
              You must specify either all phone numbers in the e164 format or
              all as phone number ids
            source:
              pointer: /phone_numbers
            meta:
              url: https://developers.telnyx.com/docs/overview/errors/10015
    PhoneNumberOwnership:
      value:
        errors:
          - code: '10015'
            title: Bad Request
            detail: You must own every number in the bulk request
            source:
              pointer: /phone_numbers
            meta:
              url: https://developers.telnyx.com/docs/overview/errors/10015
    NotAuthorized:
      value:
        errors:
          - code: '10006'
            title: Not authorized
            detail: You are not authorized to access the requested resource.
            meta:
              url: https://developers.telnyx.com/docs/overview/errors/10006
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````