Claim a line
curl --request POST \
--url https://osis.co/api/v1/comms/lines/claim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"e164": "<string>"
}
'import requests
url = "https://osis.co/api/v1/comms/lines/claim"
payload = { "e164": "<string>" }
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({e164: '<string>'})
};
fetch('https://osis.co/api/v1/comms/lines/claim', 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://osis.co/api/v1/comms/lines/claim",
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([
'e164' => '<string>'
]),
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://osis.co/api/v1/comms/lines/claim"
payload := strings.NewReader("{\n \"e164\": \"<string>\"\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://osis.co/api/v1/comms/lines/claim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"e164\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://osis.co/api/v1/comms/lines/claim")
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 \"e164\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyLines
Claim a line
POST /api/v1/comms/lines/claim — attach an available dedicated line to your account.
POST
/
lines
/
claim
Claim a line
curl --request POST \
--url https://osis.co/api/v1/comms/lines/claim \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"e164": "<string>"
}
'import requests
url = "https://osis.co/api/v1/comms/lines/claim"
payload = { "e164": "<string>" }
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({e164: '<string>'})
};
fetch('https://osis.co/api/v1/comms/lines/claim', 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://osis.co/api/v1/comms/lines/claim",
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([
'e164' => '<string>'
]),
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://osis.co/api/v1/comms/lines/claim"
payload := strings.NewReader("{\n \"e164\": \"<string>\"\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://osis.co/api/v1/comms/lines/claim")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"e164\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://osis.co/api/v1/comms/lines/claim")
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 \"e164\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAttach an available dedicated iMessage/SMS line to the authenticated workspace and put it in API / webhooks inbound mode.
This endpoint is allowlisted. Accounts that are not on the list receive
403. Checkout for everyone else comes later.
Scope: comms_lines_write
Request
List available numbers first, then passe164 to claim one. Omit e164 to take the next free dedicated number.
curl -X POST "https://osis.co/api/v1/comms/lines/claim" \
-H "Authorization: Bearer $COMMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
curl -X POST "https://osis.co/api/v1/comms/lines/claim" \
-H "Authorization: Bearer $COMMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "e164": "+16285551212" }'
Body parameters
string
Dedicated line to claim, E.164. Omit to attach the first available number.
Response
{
"e164": "+16285551212",
"inbound_mode": "api",
"status": "active"
}
| Field | Meaning |
|---|---|
e164 | Number now on this account |
inbound_mode | Always api after a successful claim |
status | Line status (active when the claim lands) |
Errors
| Status | Code | When |
|---|---|---|
403 | line_claim_not_allowed | This account cannot claim lines through the API |
409 | no_available_line | Inventory has no free dedicated number |
409 | line_number_in_use | That number already belongs to another account |
400 | invalid_line_number | e164 is not a valid +E.164 number |
⌘I