curl --request POST \
--url https://api.isnap.ai/v1/lines/{id}/variant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inbound_only": true,
"not_before": "2027-08-11T14:30:00Z"
}
'import requests
url = "https://api.isnap.ai/v1/lines/{id}/variant"
payload = {
"inbound_only": True,
"not_before": "2027-08-11T14:30:00Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({inbound_only: true, not_before: '2027-08-11T14:30:00Z'})
};
fetch('https://api.isnap.ai/v1/lines/{id}/variant', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/lines/{id}/variant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inbound_only' => true,
'not_before' => '2027-08-11T14:30:00Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/lines/{id}/variant"
payload := strings.NewReader("{\n \"inbound_only\": true,\n \"not_before\": \"2027-08-11T14:30:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.isnap.ai/v1/lines/{id}/variant")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inbound_only\": true,\n \"not_before\": \"2027-08-11T14:30:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/lines/{id}/variant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inbound_only\": true,\n \"not_before\": \"2027-08-11T14:30:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"phone_number": "<string>",
"area_code": "<string>",
"country_code": "<string>",
"state": "<string>",
"state_name": "<string>",
"billing_tier": "rental_iphone",
"byod": true,
"inbound_only": true,
"status": "<string>",
"monthly_price": 1,
"stripe_subscription_id": "<string>",
"activated_at": "<string>",
"expires_at": "<string>",
"anniversary_at": "<string>",
"cancel_at": "<string>",
"billing_anchor_at": "<string>",
"next_anchor_at": "<string>",
"pending_variant": {
"inbound_only": true,
"effective_at": "<string>"
},
"created_at": "<string>",
"metadata": {},
"test_line": true,
"shared": true,
"capabilities": "<unknown>",
"fulfillment_status": "<string>"
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}Change the variant of a line
Moves a rented line between inbound-only and two-way, immediately or at a billing anchor of the line.
curl --request POST \
--url https://api.isnap.ai/v1/lines/{id}/variant \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inbound_only": true,
"not_before": "2027-08-11T14:30:00Z"
}
'import requests
url = "https://api.isnap.ai/v1/lines/{id}/variant"
payload = {
"inbound_only": True,
"not_before": "2027-08-11T14:30:00Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({inbound_only: true, not_before: '2027-08-11T14:30:00Z'})
};
fetch('https://api.isnap.ai/v1/lines/{id}/variant', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/lines/{id}/variant",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'inbound_only' => true,
'not_before' => '2027-08-11T14:30:00Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/lines/{id}/variant"
payload := strings.NewReader("{\n \"inbound_only\": true,\n \"not_before\": \"2027-08-11T14:30:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.isnap.ai/v1/lines/{id}/variant")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"inbound_only\": true,\n \"not_before\": \"2027-08-11T14:30:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/lines/{id}/variant")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"inbound_only\": true,\n \"not_before\": \"2027-08-11T14:30:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"phone_number": "<string>",
"area_code": "<string>",
"country_code": "<string>",
"state": "<string>",
"state_name": "<string>",
"billing_tier": "rental_iphone",
"byod": true,
"inbound_only": true,
"status": "<string>",
"monthly_price": 1,
"stripe_subscription_id": "<string>",
"activated_at": "<string>",
"expires_at": "<string>",
"anniversary_at": "<string>",
"cancel_at": "<string>",
"billing_anchor_at": "<string>",
"next_anchor_at": "<string>",
"pending_variant": {
"inbound_only": true,
"effective_at": "<string>"
},
"created_at": "<string>",
"metadata": {},
"test_line": true,
"shared": true,
"capabilities": "<unknown>",
"fulfillment_status": "<string>"
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}- Credential: an API key of the owner of the line. The line must be an
activerented line with no per-line subscription. A line with one returns409 variant_bound_to_stripe_price. See Variant changes for the effect on billing. - Line-scoped keys: a line-scoped key gets
403 forbiddenunless the line is in its list. - Test keys: a change sent with an
isnap_test_account key changes the real line and its billing: see Test keys. Idempotency-Key: not honored. Witheffectiveabsent ornow, asking for the value that the line already has returns200and changes nothing. Witheffective: "next_anchor", resending the pending change returns it unchanged. Scheduling the value that the line already has returns200and stores nothing when no change is pending, and409 variant_change_already_pendingwhile a change to the other value is pending.- Events:
line.variant_changedwhen a change is applied,line.variant_scheduledwhen a change is scheduled. A scheduled change that is dropped sends no event.
Errors
| Status | error.code | When |
|---|---|---|
| 400 | not_before_in_the_past | not_before is before the time of the call. |
| 403 | forbidden | The request uses a line-scoped key, and the line is not in its list. |
| 404 | not_found | No line has this id, or you do not own the line. |
| 409 | not_a_rental_line | The line is not a rented line. |
| 409 | line_not_active | The line is not active. |
| 409 | variant_bound_to_stripe_price | The line has a per-line subscription. |
| 409 | variant_change_already_pending | A different change is already scheduled. |
| 409 | line_has_no_billing_anchor | The change is scheduled on a line that has neither a billing anchor nor an activation timestamp. |
| 409 | variant_change_conflict | The line changed during the call. Nothing was written. |
Authorizations
An API key created in the iSnap dashboard, or a trial key, sent as Authorization: Bearer <key>. An API key starts with isnap_live_ or isnap_test_; both act on the same account, lines and billing. A trial key acts on its trial only.
Path Parameters
Id of a line: line_ followed by 25 letters or digits.
^line_[0-9A-Za-z]{25}$Body
The variant to give the line, and when the change applies. A field that the body does not declare is ignored: a misspelled effective applies the change immediately.
true for the inbound-only variant: the line can message a contact only after that contact has messaged it. false for the two-way variant.
When the change applies. now, the default: immediately, so the next send obeys the new value. next_anchor: at a billing anchor occurrence of the line; until then inbound_only keeps its value and pending_variant holds the change. An immediate change does not withdraw a scheduled one: use DELETE /v1/lines/{id}/variant for that.
now, next_anchor Used only with effective: "next_anchor"; ignored otherwise. The earliest timestamp at which the change can apply (ISO 8601, UTC, with a Z suffix). The change applies at the first billing anchor occurrence at or after it, returned as pending_variant.effective_at. Defaults to the time of the request. A past timestamp returns 400 not_before_in_the_past.
"2027-08-11T14:30:00Z"
Response
The line. After an immediate change, inbound_only holds the requested value. After a scheduled one, inbound_only is unchanged and pending_variant holds the requested value and the date it applies.
Always true on a success response.
true A line. billing_tier, byod, shared, test_line and inbound_only tell the kinds of line apart: a rented line (two-way or inbound-only), a BYOD line, a shared line, a test line.
Show child attributes
Show child attributes
Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.
Id of the request that produced this response: req_ followed by 25 letters or digits.