# REST Resource: projects.phoneNumberInstances

## Resource: PhoneNumberInstance

The phone number instance resource.

A phone number instance represents a provisioned phone number or range of phone numbers.

<div class="highlight"><span class="filename">JSON representation</span><pre><code><span class="p">{</span>
  <span class="s2">&quot;name&quot;</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
  <span class="s2">&quot;phoneNumber&quot;</span><span class="p">: </span><span class="p">{</span>
    <span class="kd">object (</span><a href="/docs/phone-numbers/api-reference/rest/v1beta1/phoneNumbers/overview/#resource-phonenumber"><strong><span class="kd">PhoneNumber</span></strong></a><span class="kd">)</span>
  <span class="p">}</span><span class="p">,</span>
  <span class="s2">&quot;displayName&quot;</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
  <span class="s2">&quot;labels&quot;</span><span class="p">: </span><span class="p">{</span>
    <span class="kd">string</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
    <span class="p">...</span>
  <span class="p">}</span><span class="p">,</span>
  <span class="s2">&quot;incomingMessageHandlerUris&quot;</span><span class="p">: </span><span class="p">[</span>
    <span class="kd">string</span>
  <span class="p">]</span><span class="p">,</span>
  <span class="s2">&quot;incomingCallHandlerUris&quot;</span><span class="p">: </span><span class="p">[</span>
    <span class="kd">string</span>
  <span class="p">]</span><span class="p">,</span>
  <span class="s2">&quot;callRecordingTrigger&quot;</span><span class="p">: </span><span class="kd">enum (</span><a href="#phonenumberinstancerecordingtrigger"><strong><span class="kd">RecordingTrigger</span></strong></a><span class="kd">)</span><span class="p">,</span>
  <span class="s2">&quot;createTime&quot;</span><span class="p">: </span><span class="kd">string (</span><a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank"><strong><span class="kd">Timestamp</span></strong></a><span class="kd">)</span><span class="p">,</span>
  <span class="s2">&quot;deleteTime&quot;</span><span class="p">: </span><span class="kd">string (</span><a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank"><strong><span class="kd">Timestamp</span></strong></a><span class="kd">)</span><span class="p">,</span>
  <span class="s2">&quot;activateTime&quot;</span><span class="p">: </span><span class="kd">string (</span><a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank"><strong><span class="kd">Timestamp</span></strong></a><span class="kd">)</span><span class="p">,</span>
  <span class="s2">&quot;lifecycleState&quot;</span><span class="p">: </span><span class="kd">enum (</span><a href="#phonenumberinstancelifecyclestate"><strong><span class="kd">LifecycleState</span></strong></a><span class="kd">)</span><span class="p">,</span>
  <span class="s2">&quot;range&quot;</span><span class="p">: </span><span class="p">{</span>
    <span class="kd">object (</span><a href="#phonenumberrange"><strong><span class="kd">PhoneNumberRange</span></strong></a><span class="kd">)</span>
  <span class="p">}</span><span class="p">,</span>
  <span class="s2">&quot;regulatoryListing&quot;</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
  <span class="s2">&quot;compliant&quot;</span><span class="p">: </span><span class="kd">boolean</span>
<span class="p">}</span></code></pre></div>

Fields | &nbsp;
--|--
<span class="e-code">name</span> | <span class="e-code">string</span><br/>Resource name of the phone number instance. It must match the pattern `projects/*/phoneNumberInstances/*`
<span class="e-code">phoneNumber</span> | <span class="e-code">object ([PhoneNumber](/docs/phone-numbers/api-reference/rest/v1beta1/phoneNumbers/overview/#resource-phonenumber))</span><br/>The phone number associated with the instance. Can only be set on creation.
<span class="e-code">displayName</span> | <span class="e-code">string</span><br/>The display name of the phone number for use in the UI. Max length 100 characters.
<span class="e-code">labels</span> | <span class="e-code">map (key: <span class="e-code">string</span>, value: <span class="e-code">string</span>)</span><br/>The labels associated with the phone number. Max key length 100.  Max value length 1000. Max keys 50.
<span class="e-code">incomingMessageHandlerUris[]</span> | <span class="e-code">string</span><br/>List of URIs in priority order where incoming messages will be sent to.<br/><br/>The first URI is the primary, and the subsequent URIs are used in order if the previous URIs fail.  If no URIs are specified, then no action is taken when receiving messages.<br/><br/>Currently URIs must be fully qualified HTTP/HTTPS URLs, but this may change to include other types of URIs.<br/><br/>Maximum 5 URIs.
<span class="e-code">incomingCallHandlerUris[]</span> | <span class="e-code">string</span><br/>List of URIs in priority order that will be executed for incoming calls.<br/><br/>The first URI is the primary, and the subsequent URIs are used in order if the previous URIs fail.  If no URIs are specified, then no action is taken when receiving messages.<br/><br/>The following URIs are supported: - absolute `http` and `https` URIs. - `sip` URIs in the format sip:user@domain.com[:port] - `tel` URIs in the format tel:+phone_number<br/><br/>Additional URIs may be supported in the future.<br/><br/>Maximum 5 URIs.
<span class="e-code">callRecordingTrigger</span> | <span class="e-code">enum ([RecordingTrigger](#phonenumberinstancerecordingtrigger))</span><br/>The trigger that will start call recording.<br/><br/>You need to comply with certain laws and regulations, including those regarding obtaining consent to record. Enfonica recommends that you consult with your legal counsel to make sure that you are complying with all applicable laws in connection with communications you record or store using Enfonica.<br/><br/>Defaults to DISABLED.
<span class="e-code">createTime</span> | <span class="e-code">string (<a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank">Timestamp</a> format)</span><br/>Output only. The creation time of the phone number instance.
<span class="e-code">deleteTime</span> | <span class="e-code">string (<a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank">Timestamp</a> format)</span><br/>Output only. The deletion time of the phone number instance, if it has been deleted.
<span class="e-code">activateTime</span> | <span class="e-code">string (<a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank">Timestamp</a> format)</span><br/>Output only. The time when the phone number instance became active. For a phone number purchased from inventory, this should match `create_time`. For a phone number that was ported in, this will be the time when the port in was successful. If not set, the instance has not become active. Output only.
<span class="e-code">lifecycleState</span> | <span class="e-code">enum ([LifecycleState](#phonenumberinstancelifecyclestate))</span><br/>Output only. The state of the phone number instance in its lifecycle.
<span class="e-code">range</span> | <span class="e-code">object ([PhoneNumberRange](#phonenumberrange))</span><br/>Output only. If this resource represents a range of phone numbers, this field will be set and will contain the details of the range. If this field is unset, this resource represents a single phone number.
<span class="e-code">regulatoryListing</span> | <span class="e-code">string</span><br/>Output only. The regulatory listing associated with this phone number instance. This field specifies the end-user that is using this resource. The requirements for regulatory listings varies depending on the region and type of phone number. Of the form `projects/*/regulatoryListings/*`.
<span class="e-code">compliant</span> | <span class="e-code">boolean</span><br/>Output only. Whether this phone number instance is compliant with the regulations for phone numbers that Enfonica has inferred. The value of this field is not a substitute for independent legal advice and should be used as a guide only.

## PhoneNumberInstance.RecordingTrigger

The trigger to start call recording.

Enums | &nbsp;
--|--
<span class="e-code">RECORDING_TRIGGER_UNSPECIFIED</span> | Unspecified recording trigger.
<span class="e-code">DISABLED</span> | Recording is disabled for calls to this phone number instance.
<span class="e-code">ANSWER</span> | Recording will begin when calls to this phone number instance are answered.
<span class="e-code">BRIDGE</span> | Recording will begin when calls to this phone number instance are bridged. This won't include any messages or menus played before the call was bridged. This is useful if you want to record only conversations.

## PhoneNumberInstance.LifecycleState

Lifecycle states of phone number instances.

Enums | &nbsp;
--|--
<span class="e-code">LIFECYCLE_STATE_UNSPECIFIED</span> | Unspecified lifecycle state.
<span class="e-code">ACTIVE</span> | The phone number instance is active and can be used.
<span class="e-code">DELETED</span> | The phone number instance has been deleted.
<span class="e-code">SUSPENDED</span> | The phone number instance has been suspended.
<span class="e-code">PENDING</span> | Activation for this phone number instance is pending, possibly because the associated phone number is awaiting port in.<br/><br/>This state is used when the associated phone number has not yet been activated (ie its `activate_time` is not set).

## PhoneNumberRange

Describes a phone number range.

A phone number range is a group of phone number instances that are managed by a primary phone number instance representing the first phone number in the range.

Phone number ranges simplify the management of multiple contiguous phone numbers.

<div class="highlight"><span class="filename">JSON representation</span><pre><code><span class="p">{</span>
  <span class="s2">&quot;primaryPhoneNumberInstance&quot;</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
  <span class="s2">&quot;startPhoneNumber&quot;</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
  <span class="s2">&quot;endPhoneNumber&quot;</span><span class="p">: </span><span class="kd">string</span><span class="p">,</span>
  <span class="s2">&quot;size&quot;</span><span class="p">: </span><span class="kd">number (</span><a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank"><strong><span class="kd">int32</span></strong></a><span class="kd">)</span>
<span class="p">}</span></code></pre></div>

Fields | &nbsp;
--|--
<span class="e-code">primaryPhoneNumberInstance</span> | <span class="e-code">string</span><br/>The resource name of the primary phone number instance of the range.
<span class="e-code">startPhoneNumber</span> | <span class="e-code">string</span><br/>The first phone number in the range.
<span class="e-code">endPhoneNumber</span> | <span class="e-code">string</span><br/>The last phone number in the range.
<span class="e-code">size</span> | <span class="e-code">number (<a href="https://developers.google.com/protocol-buffers/docs/proto3#json" target="_blank">int32</a> format)</span><br/>The total quantity of phone numbers in the range.

## Methods

Methods | &nbsp;
--|--
<span class="e-code">[create](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/create/)</span> | <span class="e-code">POST /v1beta1/{parent}/phoneNumberInstances</span><br/>Creates a phone number instance. This provisions a phone number against a project.<br/><br/>The caller must have `numbering.phoneNumberInstances.create` permission on the project.
<span class="e-code">[get](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/get/)</span> | <span class="e-code">GET /v1beta1/{name}</span><br/>Retrieves a phone number instance identified by the supplied resource name.<br/><br/>The caller must have `numbering.phoneNumberInstances.get` permission on the project.
<span class="e-code">[list](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/list/)</span> | <span class="e-code">GET /v1beta1/{parent}/phoneNumberInstances</span><br/>Lists all phone number instances.<br/><br/>List returns phone number instances sorted by `create_time` descending.<br/><br/>The caller must have `numbering.phoneNumberInstances.list` permission on the project.
<span class="e-code">[update](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/update/)</span> | <span class="e-code">PATCH /v1beta1/{name}</span><br/>Updates a phone number instance.<br/><br/>The caller must have `numbering.phoneNumberInstances.update` permission on the project. 
<span class="e-code">[delete](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/delete/)</span> | <span class="e-code">DELETE /v1beta1/{name}</span><br/>Deletes a phone number instance. This disconnects the phone number.<br/><br/>The caller must have `numbering.phoneNumberInstances.delete` permission on the project.
<span class="e-code">[move](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/move/)</span> | <span class="e-code">POST /v1beta1/{name}:move</span><br/>Moves the phone number instance to another project.<br/><br/>Warning: moving a phone number instance may cause the current configuration of the phone number instance to stop working. Any connected flows or SIP domains will need to be reconfigured in the destination project. Any programmable handler will need to accept the signing key of the destination project.<br/><br/>The caller must have `numbering.phoneNumberInstances.move` permission on both the source and destination projects.
<span class="e-code">[splitRange](/docs/phone-numbers/api-reference/rest/v1beta1/projects.phoneNumberInstances/splitRange/)</span> | <span class="e-code">POST /v1beta1/{phone_number_instance}:splitRange</span><br/>Splits a phone number range into two ranges.<br/><br/>To split a range, you specify how many numbers to keep in this range. These numbers are taken from the start of the range. The remaining numbers will be moved into a new range.<br/><br/>For example, if you have a range +61255501100-99 and you split it with a `size` of 20, then: - the original range will be modified to +61255501100-19 (size 20) - a new range will be created with +61255501120-99 (size 80)<br/><br/>The caller must have `numbering.phoneNumberInstances.splitRange` permission on the project.

