# Sip Profiles

## Create a SIP profile

`sip_profiles.create(SipProfileCreateParams**kwargs)  -> SipProfile`

**post** `/v3/sip-profiles`

## SIP configuration

Your Linq representative provides the signaling and media IP ranges and
ports to allow through your firewall during onboarding.

Set `primary_uri` to your endpoint as scheme + host — `sips:` for TLS or
`sip:` for UDP, with no user part (we add it). Each call arrives at your
endpoint as:

```
sip:<called-number>@<your-host>
```

so you can route on the dialed number. The caller's number is in the
`From` header in E.164.

---

Create a SIP routing profile for your inbound calls, then assign it to a
phone number to start routing calls to its SIP URI.

### Parameters

- `name: str`

- `primary_uri: str`

  Your SIP endpoint as scheme + host, e.g. `sips:sip.partner.example`. Must start with `sip:` (UDP) or `sips:` (TLS) — the scheme sets the transport. Do not include a user part: we set it to the called number on each call (`sip:<called-number>@<your-host>`). A bare host with no scheme is rejected.

- `backup_uri: Optional[str]`

  Optional failover SIP URI

### Returns

- `class SipProfile: …`

  - `id: str`

    Unique identifier for the SIP profile

  - `assigned_number_count: int`

    How many phone numbers reference this profile

  - `created_at: datetime`

  - `name: str`

    Human-readable name

  - `primary_uri: str`

    Your SIP endpoint as scheme + host (`sip:` UDP / `sips:` TLS); no user part — we set it to the called number on each call.

  - `updated_at: datetime`

  - `version: int`

    Monotonic version, incremented on each update

  - `backup_uri: Optional[str]`

    Optional failover SIP URI. Null when unset.

### Example

```python
import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
sip_profile = client.sip_profiles.create(
    name="byoc-primary",
    primary_uri="sips:sip.partner.example",
)
print(sip_profile.id)
```

#### Response

```json
{
  "id": "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
  "assigned_number_count": 0,
  "created_at": "2026-10-29T10:30:00Z",
  "name": "byoc-primary",
  "primary_uri": "sips:sip.partner.example",
  "updated_at": "2026-10-29T10:30:00Z",
  "version": 1,
  "backup_uri": null
}
```

## List SIP profiles

`sip_profiles.list()  -> SipProfileListResponse`

**get** `/v3/sip-profiles`

Retrieve all SIP profiles for the authenticated partner.

### Returns

- `class SipProfileListResponse: …`

  - `sip_profiles: List[SipProfile]`

    The partner's SIP profiles

    - `id: str`

      Unique identifier for the SIP profile

    - `assigned_number_count: int`

      How many phone numbers reference this profile

    - `created_at: datetime`

    - `name: str`

      Human-readable name

    - `primary_uri: str`

      Your SIP endpoint as scheme + host (`sip:` UDP / `sips:` TLS); no user part — we set it to the called number on each call.

    - `updated_at: datetime`

    - `version: int`

      Monotonic version, incremented on each update

    - `backup_uri: Optional[str]`

      Optional failover SIP URI. Null when unset.

### Example

```python
import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
sip_profiles = client.sip_profiles.list()
print(sip_profiles.sip_profiles)
```

#### Response

```json
{
  "sip_profiles": [
    {
      "id": "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
      "assigned_number_count": 0,
      "created_at": "2026-10-29T10:30:00Z",
      "name": "byoc-primary",
      "primary_uri": "sips:sip.partner.example",
      "updated_at": "2026-10-29T10:30:00Z",
      "version": 1,
      "backup_uri": null
    }
  ]
}
```

## Get a SIP profile by ID

`sip_profiles.retrieve(strsip_profile_id)  -> SipProfile`

**get** `/v3/sip-profiles/{sipProfileId}`

Retrieve details for a specific SIP profile.

### Parameters

- `sip_profile_id: str`

### Returns

- `class SipProfile: …`

  - `id: str`

    Unique identifier for the SIP profile

  - `assigned_number_count: int`

    How many phone numbers reference this profile

  - `created_at: datetime`

  - `name: str`

    Human-readable name

  - `primary_uri: str`

    Your SIP endpoint as scheme + host (`sip:` UDP / `sips:` TLS); no user part — we set it to the called number on each call.

  - `updated_at: datetime`

  - `version: int`

    Monotonic version, incremented on each update

  - `backup_uri: Optional[str]`

    Optional failover SIP URI. Null when unset.

### Example

```python
import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
sip_profile = client.sip_profiles.retrieve(
    "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
)
print(sip_profile.id)
```

#### Response

```json
{
  "id": "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
  "assigned_number_count": 0,
  "created_at": "2026-10-29T10:30:00Z",
  "name": "byoc-primary",
  "primary_uri": "sips:sip.partner.example",
  "updated_at": "2026-10-29T10:30:00Z",
  "version": 1,
  "backup_uri": null
}
```

## Update a SIP profile

`sip_profiles.update(strsip_profile_id, SipProfileUpdateParams**kwargs)  -> SipProfile`

**put** `/v3/sip-profiles/{sipProfileId}`

Update a SIP profile. Only the fields you send are changed; omitted
fields keep their current value. Set `backup_uri` to an empty string to
clear it.

### Parameters

- `sip_profile_id: str`

- `backup_uri: Optional[str]`

  Set to "" to clear the backup URI.

- `name: Optional[str]`

- `primary_uri: Optional[str]`

### Returns

- `class SipProfile: …`

  - `id: str`

    Unique identifier for the SIP profile

  - `assigned_number_count: int`

    How many phone numbers reference this profile

  - `created_at: datetime`

  - `name: str`

    Human-readable name

  - `primary_uri: str`

    Your SIP endpoint as scheme + host (`sip:` UDP / `sips:` TLS); no user part — we set it to the called number on each call.

  - `updated_at: datetime`

  - `version: int`

    Monotonic version, incremented on each update

  - `backup_uri: Optional[str]`

    Optional failover SIP URI. Null when unset.

### Example

```python
import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
sip_profile = client.sip_profiles.update(
    sip_profile_id="sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
    name="byoc-east",
)
print(sip_profile.id)
```

#### Response

```json
{
  "id": "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
  "assigned_number_count": 0,
  "created_at": "2026-10-29T10:30:00Z",
  "name": "byoc-primary",
  "primary_uri": "sips:sip.partner.example",
  "updated_at": "2026-10-29T10:30:00Z",
  "version": 1,
  "backup_uri": null
}
```

## Delete a SIP profile

`sip_profiles.delete(strsip_profile_id)`

**delete** `/v3/sip-profiles/{sipProfileId}`

Delete a SIP profile. The profile must not be assigned to any phone number; unassign it first or the request is rejected.

### Parameters

- `sip_profile_id: str`

### Example

```python
import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
client.sip_profiles.delete(
    "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
)
```

#### Response

```json
{
  "error": {
    "status": 401,
    "code": 2004,
    "message": "Unauthorized - missing or invalid authentication token",
    "doc_url": "https://docs.linqapp.com/channel/imessage/error/codes/2xxx/2004/"
  },
  "success": false
}
```

## Assign or clear a phone number's SIP profile

`sip_profiles.assign(strphone_number, SipProfileAssignParams**kwargs)  -> SipProfileAssignResponse`

**put** `/v3/phone-numbers/{phoneNumber}/sip-profile`

## SIP configuration

Your Linq representative provides the signaling and media IP ranges and
ports to allow through your firewall during onboarding.

Set `primary_uri` to your endpoint as scheme + host — `sips:` for TLS or
`sip:` for UDP, with no user part (we add it). Each call arrives at your
endpoint as:

```
sip:<called-number>@<your-host>
```

so you can route on the dialed number. The caller's number is in the
`From` header in E.164.

---

Assign a SIP profile to route inbound calls to its SIP URI. This takes
precedence over an existing `forwarding_number` without clearing it.
Send `sip_profile_id: null` to remove the SIP assignment and resume
existing forwarding, if configured. Allow about 5 minutes for routing
changes to propagate. The phone number must belong to the authenticated
partner.

### Parameters

- `phone_number: str`

- `sip_profile_id: Optional[str]`

  The SIP profile to assign, or null to clear the number's current assignment.

### Returns

- `class SipProfileAssignResponse: …`

  - `phone_number: str`

    The phone number whose assignment changed

  - `sip_profile_id: Optional[str]`

    The assigned SIP profile id, or null when cleared

### Example

```python
import os
from linq import LinqAPIV3

client = LinqAPIV3(
    api_key=os.environ.get("LINQ_API_V3_API_KEY"),  # This is the default and can be omitted
)
response = client.sip_profiles.assign(
    phone_number="+14254758217",
    sip_profile_id="sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c",
)
print(response.sip_profile_id)
```

#### Response

```json
{
  "phone_number": "+14254758217",
  "sip_profile_id": "sip_8a3f9c2b1d4e4f5a9b8c7d6e5f4a3b2c"
}
```

## Domain Types

### Sip Profile

- `class SipProfile: …`

  - `id: str`

    Unique identifier for the SIP profile

  - `assigned_number_count: int`

    How many phone numbers reference this profile

  - `created_at: datetime`

  - `name: str`

    Human-readable name

  - `primary_uri: str`

    Your SIP endpoint as scheme + host (`sip:` UDP / `sips:` TLS); no user part — we set it to the called number on each call.

  - `updated_at: datetime`

  - `version: int`

    Monotonic version, incremented on each update

  - `backup_uri: Optional[str]`

    Optional failover SIP URI. Null when unset.

### Sip Profile List Response

- `class SipProfileListResponse: …`

  - `sip_profiles: List[SipProfile]`

    The partner's SIP profiles

    - `id: str`

      Unique identifier for the SIP profile

    - `assigned_number_count: int`

      How many phone numbers reference this profile

    - `created_at: datetime`

    - `name: str`

      Human-readable name

    - `primary_uri: str`

      Your SIP endpoint as scheme + host (`sip:` UDP / `sips:` TLS); no user part — we set it to the called number on each call.

    - `updated_at: datetime`

    - `version: int`

      Monotonic version, incremented on each update

    - `backup_uri: Optional[str]`

      Optional failover SIP URI. Null when unset.

### Sip Profile Assign Response

- `class SipProfileAssignResponse: …`

  - `phone_number: str`

    The phone number whose assignment changed

  - `sip_profile_id: Optional[str]`

    The assigned SIP profile id, or null when cleared
