curl --request PATCH \
--url https://api.isnap.ai/v1/lines/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"crm_account_id": "acc_123"
},
"billing_anchor_at": "2026-09-11T09:15:00Z"
}
'import requests
url = "https://api.isnap.ai/v1/lines/{id}"
payload = {
"metadata": { "crm_account_id": "acc_123" },
"billing_anchor_at": "2026-09-11T09:15:00Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {crm_account_id: 'acc_123'},
billing_anchor_at: '2026-09-11T09:15:00Z'
})
};
fetch('https://api.isnap.ai/v1/lines/{id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'crm_account_id' => 'acc_123'
],
'billing_anchor_at' => '2026-09-11T09:15: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}"
payload := strings.NewReader("{\n \"metadata\": {\n \"crm_account_id\": \"acc_123\"\n },\n \"billing_anchor_at\": \"2026-09-11T09:15:00Z\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.isnap.ai/v1/lines/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"crm_account_id\": \"acc_123\"\n },\n \"billing_anchor_at\": \"2026-09-11T09:15:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/lines/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"crm_account_id\": \"acc_123\"\n },\n \"billing_anchor_at\": \"2026-09-11T09:15: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>"
}Update the metadata or billing anchor of a line
Merges metadata into a line you own, and sets or clears its billing anchor.
curl --request PATCH \
--url https://api.isnap.ai/v1/lines/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"crm_account_id": "acc_123"
},
"billing_anchor_at": "2026-09-11T09:15:00Z"
}
'import requests
url = "https://api.isnap.ai/v1/lines/{id}"
payload = {
"metadata": { "crm_account_id": "acc_123" },
"billing_anchor_at": "2026-09-11T09:15:00Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {crm_account_id: 'acc_123'},
billing_anchor_at: '2026-09-11T09:15:00Z'
})
};
fetch('https://api.isnap.ai/v1/lines/{id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'crm_account_id' => 'acc_123'
],
'billing_anchor_at' => '2026-09-11T09:15: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}"
payload := strings.NewReader("{\n \"metadata\": {\n \"crm_account_id\": \"acc_123\"\n },\n \"billing_anchor_at\": \"2026-09-11T09:15:00Z\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.isnap.ai/v1/lines/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"crm_account_id\": \"acc_123\"\n },\n \"billing_anchor_at\": \"2026-09-11T09:15:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/lines/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"crm_account_id\": \"acc_123\"\n },\n \"billing_anchor_at\": \"2026-09-11T09:15: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>"
}- Credential: an API key. The operation works on any line you own, in any status and of any kind. See Metadata and Anniversary and billing anchor.
- Line-scoped keys: the list of a line-scoped key is not applied here. The key can change the
metadataand the billing anchor of any line of its account. Idempotency-Key: not honored. The operation merges, so the same request sent twice leaves the line in the same state.- Events: none. See What events do not announce.
- Two fields, two changes: when the body carries both fields,
billing_anchor_atis applied first andmetadatasecond. If themetadatais refused, the change of the billing anchor is already stored.
Errors
| Status | error.code | When |
|---|---|---|
| 400 | no_fields_to_patch | The body has neither metadata nor billing_anchor_at. |
| 400 | validation_failed | The metadata of the request holds more than 20 keys or more than 8,192 bytes, or billing_anchor_at is not an ISO 8601 timestamp with a Z suffix. |
| 400 | reserved_metadata_key | metadata names migration_ref or proof_line, even with null. |
| 400 | metadata_too_large | The merged metadata holds more than 20 keys or more than 8,192 bytes. |
| 400 | billing_anchor_too_far | billing_anchor_at is more than 31 days after the call. |
| 404 | not_found | No line has this id, or you do not own the line. |
| 409 | billing_anchor_change_conflict | The line changed owner 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
Send metadata, billing_anchor_at, or both.
Keys to merge into the metadata of the line: a key with a value is set, a key with null is removed, a key you do not send is kept. The result holds at most 20 keys and 8,192 bytes once serialized as JSON (400 metadata_too_large); a request that only removes keys is never refused for the size of the result. The keys migration_ref and proof_line are reserved (400 reserved_metadata_key). Never put personal data or secrets in it.
Show child attributes
Show child attributes
{ "crm_account_id": "acc_123" }
The billing anchor of the line: an ISO 8601 timestamp in UTC, with a Z suffix, or null to clear it. A line billed on the monthly wholesale invoice is charged one full month at each monthly occurrence of this timestamp: the same day of the month, moved to the last day of a shorter month, at the same time of day. Without a billing anchor, the line is billed at each monthly occurrence of its activation. A change applies from the next occurrence and does not alter a month already billed. A past timestamp is accepted. A timestamp more than 31 days after the request returns 400 billing_anchor_too_far. Sending the value the line already has changes nothing.
"2026-09-11T09:15:00Z"
Response
The updated line.
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.