curl --request PUT \
--url https://app.thinnest.ai/api/v1/phone-numbers/carrier-accounts/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "AC3f9e2b7d41c08a6e5b1d2f7c9e04a41c",
"token": "9b7c2e4f1a8d3065c7e2b9f14d6a8e3c"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 'AC3f9e2b7d41c08a6e5b1d2f7c9e04a41c',
token: '9b7c2e4f1a8d3065c7e2b9f14d6a8e3c'
})
};
fetch('https://app.thinnest.ai/api/v1/phone-numbers/carrier-accounts/{provider}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.thinnest.ai/api/v1/phone-numbers/carrier-accounts/{provider}"
payload = {
"accountId": "AC3f9e2b7d41c08a6e5b1d2f7c9e04a41c",
"token": "9b7c2e4f1a8d3065c7e2b9f14d6a8e3c"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"provider": "twilio",
"accountEnding": "a41c"
}{
"error": "Both the ID and the token are needed."
}{
"error": "Send a valid API key as `Authorization: Bearer <key>`."
}{
"error": "This API key is read-only: it can read everything but change nothing."
}{
"error": "Unknown provider. Use one of plivo, vobiz, twilio, telnyx."
}{
"error": "This workspace already has Twilio numbers on a different Twilio account. Remove those numbers first, then connect the other account — one workspace works with one Twilio account."
}{
"error": "The carrier did not accept that ID and token. Check both and try again."
}{
"error": "Over 240 requests a minute. Slow down and retry."
}{
"error": "Could not save those credentials. Try again."
}{
"error": "The carrier could not be reached just now. Try again in a moment."
}Save Carrier Account
Saves the keys of your own account with a carrier, which lets its brought numbers be confirmed, answered and called out from. The keys are checked with the carrier before anything is stored, stored sealed, and never returned. One account per carrier: switching to a different account while numbers are still brought on the first is refused. telnyx takes its API key as token alone. Needs a full key — a carrier credential can spend money on your account.
curl --request PUT \
--url https://app.thinnest.ai/api/v1/phone-numbers/carrier-accounts/{provider} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "AC3f9e2b7d41c08a6e5b1d2f7c9e04a41c",
"token": "9b7c2e4f1a8d3065c7e2b9f14d6a8e3c"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 'AC3f9e2b7d41c08a6e5b1d2f7c9e04a41c',
token: '9b7c2e4f1a8d3065c7e2b9f14d6a8e3c'
})
};
fetch('https://app.thinnest.ai/api/v1/phone-numbers/carrier-accounts/{provider}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.thinnest.ai/api/v1/phone-numbers/carrier-accounts/{provider}"
payload = {
"accountId": "AC3f9e2b7d41c08a6e5b1d2f7c9e04a41c",
"token": "9b7c2e4f1a8d3065c7e2b9f14d6a8e3c"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"provider": "twilio",
"accountEnding": "a41c"
}{
"error": "Both the ID and the token are needed."
}{
"error": "Send a valid API key as `Authorization: Bearer <key>`."
}{
"error": "This API key is read-only: it can read everything but change nothing."
}{
"error": "Unknown provider. Use one of plivo, vobiz, twilio, telnyx."
}{
"error": "This workspace already has Twilio numbers on a different Twilio account. Remove those numbers first, then connect the other account — one workspace works with one Twilio account."
}{
"error": "The carrier did not accept that ID and token. Check both and try again."
}{
"error": "Over 240 requests a minute. Slow down and retry."
}{
"error": "Could not save those credentials. Try again."
}{
"error": "The carrier could not be reached just now. Try again in a moment."
}Authorizations
Your API key (ta_live_…) from Settings → API keys, sent as Authorization: Bearer <key>. Keep it on a server: it can message every customer you have. A key is full, build or read-only; a request its level does not allow is refused with 403.
Headers
Developers only: the customer workspace this request acts in — its org_… id from POST /customers. Leave it out to act in your own workspace.
"org_3fKq9TzQ1mN8vB2xR7cLpA"
Path Parameters
Which carrier the account is with. A carrier a brought number can be on — whose network your own account is with.
plivo, vobiz, twilio, telnyx "twilio"
Body
Response
The keys were checked and saved.
A carrier a brought number can be on — whose network your own account is with.
plivo, vobiz, twilio, telnyx "twilio"
The last four characters of the account id, so you can tell which account is connected; empty for an id too short to hint at.
"a41c"