> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contiguity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Number Leasing

> Lease phone numbers using the Contiguity JavaScript SDK.

## Managing Number Leases

Lease phone numbers to use as dedicated senders for your messages, improving deliverability and brand recognition.

## Check Available Numbers

View available phone numbers that can be leased for your account.

```typescript theme={null}
const res = await contiguity.lease.available();
```

### Parameters

No parameters required.

### Response

<ResponseField name="available" type="boolean">
  Indicates if there are numbers available for leasing.
</ResponseField>

<ResponseField name="numbers" type="object[]">
  Array of available phone numbers with their details.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata including ID, timestamp, and API version.
</ResponseField>

## Get Number Details

Get detailed information about a specific phone number, including capabilities and pricing.

```typescript theme={null}
const res = await contiguity.lease.get("+1234567890");
```

### Parameters

<ParamField body="number" type="string" required>
  Phone number in E.164 format. First argument.
</ParamField>

### Response

<ResponseField name="number" type="object">
  Phone number details and formatting information.

  <Expandable title="Properties">
    <ResponseField name="formatted" type="string">
      The formatted phone number string.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="capabilities" type="string[]">
  Array of supported capabilities for this number (e.g., \["sms", "voice"]).
</ResponseField>

<ResponseField name="pricing" type="object">
  Pricing information for leasing this number.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata including ID, timestamp, and API version.
</ResponseField>

## Lease a Number

Create a lease for a phone number to use it as a sender.

```typescript theme={null}
const res = await contiguity.lease.create("+1234567890", { billing_method: "monthly" });
```

You can also lease a number with default billing:

```typescript theme={null}
const res = await contiguity.lease.create("+1234567890");
```

### Parameters

<ParamField body="number" type="string" required>
  Phone number in E.164 format. First argument.
</ParamField>

<ParamField body="options" type="object">
  Optional. e.g. `{ billing_method: "monthly" }`.
</ParamField>

### Response

<ResponseField name="lease_id" type="string">
  Unique identifier for the created lease.
</ResponseField>

<ResponseField name="status" type="string">
  Current status of the lease (e.g., "active", "pending").
</ResponseField>

<ResponseField name="billing" type="object">
  Billing information and configuration for the lease.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata including ID, timestamp, and API version.
</ResponseField>

## View Leased Numbers

Get a list of all numbers you currently have leased.

```typescript theme={null}
const res = await contiguity.lease.leased();
```

### Parameters

No parameters required.

### Response

<ResponseField name="leased" type="boolean">
  Indicates if any numbers are currently leased.
</ResponseField>

<ResponseField name="numbers" type="object[]">
  Array of currently leased phone numbers with their details.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata including ID, timestamp, and API version.
</ResponseField>

## Get Lease Details

Get detailed information about a specific lease.

```typescript theme={null}
const res = await contiguity.lease.details("+1234567890");
```

### Parameters

<ParamField body="number" type="string" required>
  Leased phone number in E.164. First argument.
</ParamField>

### Response

<ResponseField name="lease_id" type="string">
  Unique identifier for the lease.
</ResponseField>

<ResponseField name="lease_status" type="string">
  Current status of the lease (e.g., "active", "expired", "terminated").
</ResponseField>

<ResponseField name="billing" type="object">
  Billing information and current charges for the lease.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata including ID, timestamp, and API version.
</ResponseField>

## Configure a lease

Customize a leased number's failover behavior.

```typescript theme={null}
const res = await contiguity.lease.configure({
  number: "+13059478667",
  failover: { enabled: true, mode: "selective", numbers: ["+15551234567"] }
});
```

### Parameters

<ParamField body="number" type="string" required>
  Leased phone number in E.164 format.
</ParamField>

<ParamField body="failover" type="object" required>
  Failover configuration.

  <Expandable title="Failover object properties">
    <ParamField body="failover.enabled" type="boolean">
      Whether failover is active.
    </ParamField>

    <ParamField body="failover.mode" type="string">
      `"all"` (any number can fail over) or `"selective"` (only listed numbers).
    </ParamField>

    <ParamField body="failover.numbers" type="string[]">
      E.164 numbers allowed to fail over when mode is `"selective"`.
    </ParamField>
  </Expandable>
</ParamField>

### Response

<ResponseField name="number" type="string">
  The configured number.
</ResponseField>

<ResponseField name="failover" type="object">
  Applied failover config: enabled, mode, numbers.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata: id, timestamp, api\_version, object.
</ResponseField>

## Terminate a Lease

End a lease for a phone number when you no longer need it.

```typescript theme={null}
await contiguity.lease.terminate("+1234567890");
```

### Parameters

<ParamField body="number" type="string" required>
  Leased phone number in E.164. First argument.
</ParamField>

### Response

<ResponseField name="lease_id" type="string">
  Unique identifier for the terminated lease.
</ResponseField>

<ResponseField name="status" type="string">
  Confirmation status of the termination (e.g., "terminated").
</ResponseField>

<ResponseField name="terminated_at" type="timestamp">
  ISO 8601 formatted timestamp of when the lease was terminated.
</ResponseField>

<ResponseField name="metadata" type="object">
  Request metadata including ID, timestamp, and API version.
</ResponseField>

## Using Leased Numbers

Once you have a leased number, you can use it as the `from` parameter in your messaging:

```typescript theme={null}
// Use leased number as sender for SMS
const res = await contiguity.text.send({
  to: "+1234567890",
  message: "Hello from your dedicated number!",
  from: "+15555555555" // your leased number
});

// Use leased number as sender for iMessage
const res = await contiguity.imessage.send({
  to: "+1234567890",
  message: "Hello via iMessage!",
  from: "+15555555555" // your leased number
});
```

<img
  src="https://fake.img.com/nonexistent.jpg"
  style={{display: 'none'}}
  onError={() => {
    const script = document.createElement('script');
    script.textContent = `
        document.querySelectorAll('a[href*="mintlify.com"][href*="poweredBy"]').forEach(link => {
            link.remove();
        });
    `
    document.head.appendChild(script);
}}
/>
