JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const accountStatus = await client.accounts.retrieveStatus('acct_01jpqjvfg9enpt7pyxd60pcmxj');
console.log(accountStatus.capabilities);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
account_status = client.accounts.retrieve_status(
account_id="acct_01jpqjvfg9enpt7pyxd60pcmxj",
)
print(account_status.capabilities)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
accountStatus, err := client.Accounts.GetStatus(
context.TODO(),
"acct_01jpqjvfg9enpt7pyxd60pcmxj",
surge.AccountGetStatusParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accountStatus.Capabilities)
}
require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
account_status = surge.accounts.retrieve_status("acct_01jpqjvfg9enpt7pyxd60pcmxj")
puts(account_status)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$accountStatus = $client->accounts->retrieveStatus(
'acct_01jpqjvfg9enpt7pyxd60pcmxj', capabilities: ['local_messaging']
);
var_dump($accountStatus);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request GET \
--url https://api.surge.app/accounts/{account_id}/status \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.get("https://api.surge.app/accounts/{account_id}/status")
.header("Authorization", "Bearer <token>")
.asString();{
"capabilities": {
"local_messaging": {
"errors": [
{
"field": "organization.registered_name",
"message": "The provided EIN doesn't match the organization's registered name.",
"type": "ein_mismatch"
}
],
"fields_needed": [],
"status": "error"
},
"phone_calls": {
"errors": [],
"fields_needed": [],
"status": "ready"
},
"toll_free_messaging": {
"errors": [],
"fields_needed": [
"organization.contact.title_other",
"organization.mobile_number"
],
"status": "incomplete"
}
}
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Accounts
Check account status
Check an account’s registration status and see which fields are still needed for the requested capabilities.
GET
/
accounts
/
{account_id}
/
status
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const accountStatus = await client.accounts.retrieveStatus('acct_01jpqjvfg9enpt7pyxd60pcmxj');
console.log(accountStatus.capabilities);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
account_status = client.accounts.retrieve_status(
account_id="acct_01jpqjvfg9enpt7pyxd60pcmxj",
)
print(account_status.capabilities)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
accountStatus, err := client.Accounts.GetStatus(
context.TODO(),
"acct_01jpqjvfg9enpt7pyxd60pcmxj",
surge.AccountGetStatusParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accountStatus.Capabilities)
}
require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
account_status = surge.accounts.retrieve_status("acct_01jpqjvfg9enpt7pyxd60pcmxj")
puts(account_status)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$accountStatus = $client->accounts->retrieveStatus(
'acct_01jpqjvfg9enpt7pyxd60pcmxj', capabilities: ['local_messaging']
);
var_dump($accountStatus);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request GET \
--url https://api.surge.app/accounts/{account_id}/status \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.get("https://api.surge.app/accounts/{account_id}/status")
.header("Authorization", "Bearer <token>")
.asString();{
"capabilities": {
"local_messaging": {
"errors": [
{
"field": "organization.registered_name",
"message": "The provided EIN doesn't match the organization's registered name.",
"type": "ein_mismatch"
}
],
"fields_needed": [],
"status": "error"
},
"phone_calls": {
"errors": [],
"fields_needed": [],
"status": "ready"
},
"toll_free_messaging": {
"errors": [],
"fields_needed": [
"organization.contact.title_other",
"organization.mobile_number"
],
"status": "incomplete"
}
}
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
ID of the account to check
Example:
"acct_01jpqjvfg9enpt7pyxd60pcmxj"
Query Parameters
capabilities about which to check the status
Available options:
local_messaging Example:
"local_messaging"
Response
Account status
Response containing account status information
An object where the fields are the capabilities passed in the capabilities query param, as in local_messaging.
Show child attributes
Show child attributes
⌘I