Create Power2 sub account with credit transfer

POST /api/communications/sms/create-account

Overview

Sets a tenant up to send text messages. The call creates a sub-account under Gladstone's account with Power2 — the third-party gateway used for SMS — transfers 50 credits into it from the main account, and records the resulting sub-account name and sender id in the tenant's configuration so that every later SMS call uses them.

Treat this as one-time setup, and note that it is not idempotent: each call creates another sub-account and repoints the tenant's configuration at the newest one. The sub-account is named after the operator's trading name where one is configured, or P2SA- plus three random letters where it is not; if Power2 reports that name is already taken, a _1, _2 … suffix is appended until one is free, so the name you end up with is not necessarily the one you would predict.

A 200 does not mean it worked. Failures at Power2 are reported in the body rather than as an error status: check account.status for the sub-account and credit.status for the credit transfer, each with a message explaining a false. If the sub-account could not be created, the transfer is not attempted and credit.message reads No credits were transferred.

Once this has succeeded, Get SMS account balance reports the credits held by the new sub-account.

Endpoint

POST {base_url}/api/communications/sms/create-account

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Request body

FieldTypeRequiredDescription
originatorstringYesThe sender id recipients see in place of a phone number on texts from this tenant. Must be 3 to 11 characters once surrounding whitespace is trimmed; null, empty and whitespace-only values are each rejected with their own message. The value is stored in the tenant's configuration and reused for every later send and for the balance lookup, so it stays in force until this call is made again.

Sample request

cURL
curl -X POST '{base_url}/api/communications/sms/create-account' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "originator": "string"
}'

Errors

StatusMeaningWhen
400Bad requestoriginator is absent (Originator in request body is missing.), empty or whitespace only (There is an empty originator in the request.), or outside 3 to 11 characters (The originator must be 3 to 11 characters long.). Also returned when the tenant's SMS account details could not be assembled (Failed to retrieve SMS account details.).
404Not foundThe environment has no Power2 credentials configured — user name, secret key or main account name is missing (Attempting to retrieve Power2Sms user name but the user name does not exist.).
500Internal server errorAn unexpected failure while calling Power2 or interpreting its answer. Note that a Power2 refusal is not reported here: it comes back as 200 with account.status or credit.status set to false.

Notes

This page as markdown · All pages · llms.txt