# Quickstart Guide | Signal House API Docs

> Go from zero to your first SMS with the Signal House API: create a subgroup, register a brand and campaign, buy a number, and send.

Source: https://docs.signalhouse.io/getting-started

---

# Quickstart Guide

Go from zero to sending your first SMS in minutes.

## Prerequisites

- A **Signal House account** with valid credentials
- Your **API token** (JWT) obtained by logging in via the portal or the Auth API

## SDKs

#### Install the SDK

Install

```
dotnet add package SignalHouseSms.Sdk
```

Or via NuGet Package Manager:

Install

```
Install-Package SignalHouseSms.Sdk
```

#### Initialize the SDK

Initialize

```
using SignalHouse.SDK;

var client = new SignalHouseClient(
    apiKey: "your-api-token",
    baseUrl: "https://v2.signalhouse.io"
);
```

#### Install the SDK

Install

```
go get github.com/signalhouse-sms/sdk-go
```

#### Initialize the SDK

Initialize

```
client, err := signalhouse.NewClient(signalhouse.Config{
    APIKey:  "your-api-token",
    BaseURL: "https://v2.signalhouse.io",
})
if err != nil {
    log.Fatal(err)
}
```

#### Install the SDK

Install

```
npm install @signalhouse-sms/sdk
```

#### Initialize the SDK

Initialize

```
import { SignalHouseSDK } from "@signalhouse-sms/sdk";

const signalHouse = new SignalHouseSDK({
    apiKey: "your-api-token",
    baseUrl: "https://v2.signalhouse.io",
});
```

#### Install the SDK

Install

```
composer require signalhouse-sms/sdk
```

#### Initialize the SDK

Initialize

```
use SignalHouse\SDK\SignalHouseSDK;

$sdk = new SignalHouseSDK(
    apiKey: 'your-api-token',
    baseUrl: 'https://v2.signalhouse.io'
);
```

#### Install the SDK

Install

```
pip install signalhouse-sms
```

#### Initialize the SDK

Initialize

```
from signalhouse_sms import SignalHouseSDK

sdk = SignalHouseSDK(
    api_key="your-api-token",
    base_url="https://v2.signalhouse.io",
)
```

#### Install the SDK

Install

```
gem install signalhouse-sms
```

Or add to your Gemfile:

Install

```
gem "signalhouse-sms"
```

#### Initialize the SDK

Initialize

```
require "signalhouse_sms"

client = SignalHouseSms::Client.new(
    api_key: "your-api-token",
    base_url: "https://v2.signalhouse.io"
)
```

#### Install the SDK

Add to your `Cargo.toml`:

Install

```
[dependencies]
	signalhouse-sms = "1.5"
	tokio = { version = "1", features = ["full"] }
	serde_json = "1"
```

#### Initialize the SDK

Initialize

```
use signalhouse_sms::{SignalHouseClient, SignalHouseConfig};

let client = SignalHouseClient::new(SignalHouseConfig {
    api_key: "your_api_token".into(),
    base_url: "https://v2.signalhouse.io".into(),
})?;
```

## AI One-Shot Integration Prompts

Select an SDK above to view AI integration prompts.

## Understanding the Response Format

The shape depends on whether you call through an SDK or directly over HTTP.

**SDK responses** are wrapped in a standardized envelope:

**Success (2xx):**

SDK Success

```
{
  "success": true,
  "data": { ... },
  "status": 200
}
```

**Error (4xx/5xx):**

SDK Failure

```json
{
  "success": false,
  "error": "Invalid phone number format",
  "status": 400
}
```

When using an SDK, always check `response.success` before accessing `response.data`.

**Raw HTTP responses** return the resource JSON directly (no envelope). Errors are returned as `{ "error": "...", "details": [...] }`.

## Authentication

The Signal House API uses JSON Web Tokens (JWT) for authentication. Tokens can be obtained in two ways:

1. User login — Exchange email and password for a short-lived JWT (12-hour expiry).
2. Service user creation — Generate a long-lived API key (365-day expiry) for server-to-server integrations.

All authenticated requests must include the token in the `Authorization` header as a Bearer token.

A third kind of token exists but cannot be used here: the access token issued by the OAuth connector flow. Every route under `/user`, and the authenticated routes under `/auth`, reject a connector token with `403`. A connector acts for a user who signed in through their Signal House account rather than handing over a credential, so it must not be able to mint API keys, change a password, read token history, or end sessions. Tokens from user login and from a service user are unaffected.

## User Authentication Flow

Authenticate a user by posting their credentials to the `/auth` endpoint. On success, the response contains a JWT valid for 12 hours.

### POST /auth

Exchange email and password for a JWT Bearer token valid for 12 hours.

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | String | Required | The registered email address. |
| `password` | String | Required | Account password (min 8 characters). |

#### Example Request

Request

```json
{
  "email": "user@example.com",
  "password": "your-password"
}
```

#### Example Response 200

Response

```json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "role": "admin"
}
```

## Service Users and API Keys

Service users are non-interactive accounts designed for programmatic access. They issue tokens with a 365-day expiry, making them ideal for backend integrations, scripts, and automated workflows.

### POST /user/serviceuser

Create a non-login Service User (API Key) and instantly receive a JWT with a 365-day expiry.

**The following roles are required to use this endpoint:** `admin`, `developer`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | String | Optional | Group ID the service user belongs to (starts with G, exactly 8 chars). Required when role is 'api'; omit for 'signalhouse\_api'. |
| `name` | String | Required | A descriptive name for the service user. |
| `role` | String | Required | Must be 'api' (or 'signalhouse\_api' for internal accounts). |
| `allowedIps` | Array<String> | Optional | Only accept this key from these IPv4/IPv6 addresses or CIDR ranges, e.g. \["203.0.113.10", "198.51.100.0/24"\]. Max 100. Omit or \[\] for no IP restriction. 'api' keys only. |
| `allowedCountries` | Array<String> | Optional | Only accept this key from these countries (ISO 3166-1 alpha-2, e.g. \["US", "CA"\]). Must be an assigned code: "UK" is rejected (use "GB"), as is "ZZ". Max 250. Omit or \[\] for no country restriction. When both lists are set, a request must match both. 'api' keys only. |
| `allowedDestinationCountries` | Array<String> | Optional | Only let this key send messages to these countries (ISO 3166-1 alpha-2, e.g. \["US", "CA"\]). A send with any recipient elsewhere is rejected with 403 DESTINATION\_COUNTRY\_NOT\_ALLOWED and nothing goes out. US toll-free numbers count as US; Guernsey (GG), Jersey (JE) and the Isle of Man (IM) are separate from GB. Max 250. Omit or \[\] for any country. 'api' keys only. |

#### Role Reference

| Role | Description |
| --- | --- |
| `admin` | Full access to the customer's group and all its resources. |
| `developer` | Access to messaging, numbers, API keys, and webhooks. |
| `billing` | Access to billing, invoices, and payment settings. |
| `user` | Basic access with limited permissions. |
| `api` | Programmatic access for service users (API keys). One of the two roles allowed when creating a service user, alongside the internal signalhouse\_api role. |

#### Example Request

Request

```json
{
  "groupId": "G1234567",
  "name": "My Integration Bot",
  "role": "api"
}
```

#### Example Response 201

Response

```json
{
  "user": {
    "user": {
      "_id": "60f7b2a1c9e77c001a2b3c5d",
      "firstName": "My Integration Bot",
      "role": "api",
      "activeGroupId": "G1234567",
      "status": "active",
      "mfaEnabled": false,
      "viewGroupIds": [
        "G1234567"
      ],
      "createdAt": "2024-01-15T12:00:00.000Z",
      "updatedAt": "2024-01-15T12:00:00.000Z"
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
  }
}
```

## Using Tokens

#### Authorization Header Format

When making raw HTTP requests, include the token in the `Authorization` header:

Header

```
Authorization: Bearer <token>
```

#### Default API Key

When you initialize the SDK with an `apiKey`, that token is sent automatically with every request.

#### Per-Request Token Override

You can override the default API key on any individual call by passing `options: { token }`. This is useful when an application authenticates on behalf of multiple users.

## Token Best Practices

1. **Use service user tokens for server-to-server integrations.** Their 365-day expiry avoids frequent re-authentication. Rotate them periodically.
2. **Never expose tokens in client-side code or version control.** Store them in environment variables or a secrets manager.
3. **Restrict each API key to where it runs.** Set `allowedIps` and/or `allowedCountries` when creating the key (or later with `PUT /user/:id`, or on the API Keys page) so a leaked key is useless anywhere else. A request from outside the allowed IPs or countries gets a `403` whose message names the caller's IP and country, so a misconfiguration is easy to spot. The IP checked is the address that connects to Signal House, so allow your servers' public egress IPs. To cap what a leaked key could cost you, also set `allowedDestinationCountries` to the countries you actually message: a send anywhere else is rejected before it goes out.
4. **Use the least-privileged role.** Service users may only be created with the `api` role (or `signalhouse_api` for internal accounts). Scope each service user to a single group and reuse it only for the integration it was created for.
5. **Handle token expiry gracefully.** Check for `401` responses and re-authenticate or refresh the token when needed.
6. **Use per-request token overrides** (`options: { token }`) when your application acts on behalf of multiple users, rather than reinitializing the SDK.
7. **Log and monitor auth history.** Use the auth history endpoint to audit login activity and detect unauthorized access.
8. **Rotate service user tokens before they expire.** Create a new service user, migrate your integration, then deactivate the old one.

# Full Workflow — Zero to Sending Messages

Registered channels require an approved brand, an active campaign, and a purchased number. Brand, campaign, number, message and opt-out records carry an ISO-2 region; missing or blank historical values mean US. Here is the registered-channel workflow.

## Step 1: Create a Subgroup

Subgroups partition your account for separate traffic and billing.

SDK

curl

```
curl -X POST https://v2.signalhouse.io/subgroup \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "subgroupName": "My First Subgroup",
    "groupId": "your-group-id"
  }'
```

## Step 2: Register a Brand

A brand represents your business identity for 10DLC messaging. After submission, wait for the brand status to reach `VERIFIED` before proceeding.

SDK

curl

```
curl -X POST https://v2.signalhouse.io/brand \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "subgroupId": "your-subgroup-id",
    "displayName": "My Business",
    "companyName": "My Business LLC",
    "entityType": "PRIVATE_PROFIT",
    "ein": "123456789",
    "phone": "5551234567",
    "street": "123 Main St",
    "city": "Springfield",
    "state": "MO",
    "postalCode": "65804",
    "country": "US",
    "email": "support@mybusiness.com",
    "vertical": "TECHNOLOGY"
  }'
```

> **Note:** Brand verification typically takes a few minutes. Poll the brand status or configure a webhook to be notified when it reaches `VERIFIED` or `UNVERIFIED`. If `UNVERIFIED`, the legal company name did not match the entity type and EIN registered with the IRS. Most non-US companies also fail first review. Providing tax documents (SS-4 for American companies and its comparator) will move the status to `VERIFIED`.

## Step 3: Purchase a Phone Number

Search for available numbers, then purchase one.

Search — SDK

Search — curl

```
curl -X GET "https://v2.signalhouse.io/number/available?npa=415&limit=5" \
  -H "Authorization: Bearer your-api-token"
```

Purchase — SDK

Purchase — curl

```
curl -X POST https://v2.signalhouse.io/number \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "phoneNumbers": ["14155551234"],
    "subgroupId": "your-subgroup-id"
  }'
```

## Step 4: Create a Campaign

A campaign ties your brand to a use case and assigns phone numbers. After creation, wait for the campaign status to reach **ACTIVE**. You can supply the full registration payload manually, or set `useDefaultTemplate` to `true` to auto-fill description, message flow, and related fields from your brand (portal “Use SH Default Template”).

SDK

curl (full payload)

```
curl -X POST https://v2.signalhouse.io/campaign \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "brandId": "your-brand-id",
    "usecase": "MIXED",
    "description": "General business messaging and customer notifications.",
    "messageFlow": "Customers opt in via our website form, then receive order and appointment updates.",
    "sample1": "Hello! Your order has shipped. Reply STOP to opt out.",
    "sample2": "Your appointment is tomorrow at 3 PM. Reply STOP to opt out.",
    "privacyPolicyLink": "https://mybusiness.com/privacy",
    "termsAndConditionsLink": "https://mybusiness.com/terms",
    "optinMessage": "You are now subscribed to My Business alerts. Reply HELP for help, STOP to cancel.",
    "optoutMessage": "You have been unsubscribed and will receive no further messages.",
    "helpMessage": "Reply STOP to unsubscribe. Msg & data rates may apply.",
    "embeddedLinkSample": "Your order shipped: https://mybusiness.com/track/abc123",
    "phoneNumbers": ["14155551234"]
  }'
```

curl (autofill)

```
curl -X POST https://v2.signalhouse.io/campaign \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "useDefaultTemplate": true,
    "brandId": "your-brand-id",
    "usecase": "MARKETING",
    "directLending": false,
    "ageGated": false,
    "phoneNumbers": ["14155551234"],
    "sample1": "We think you will love our new release today"
  }'
```

> **Note:** Campaign activation can take time as carriers review and approve your use case. Poll the campaign status or use a webhook. See the `POST /campaign` reference for autofill field details.

## Step 5: Send Messages

Once your campaign is **ACTIVE**, you can send messages using the phone number assigned to it.

SDK

curl

```
curl -X POST https://v2.signalhouse.io/message/sms \
  -H "Authorization: Bearer your-api-token" \
  -H "Content-Type: application/json" \
  -d '{
    "senderPhoneNumber": "14155551234",
    "recipientPhoneNumber": ["11234567891"],
    "messageBody": "Hello from Signal House!"
  }'
```

## Workflow Summary

Workflow Summary

```
Create Subgroup ──> Register Brand ──> (wait for VERIFIED)
                                            │
                    Purchase Number <────────┘
                          │
                    Create Campaign ──> (wait for ACTIVE)
                                            │
                      Send Messages <───────┘
```

**Waiting for async operations:** Brand creation and campaign approval are asynchronous. You can either subscribe to `BRAND_IDENTITY_STATUS_UPDATED` and `CAMPAIGN_APPROVED_BY_SIGNAL_HOUSE` webhooks for instant notification, or poll the `GET /brand` and `GET /campaign` endpoints every 10 seconds until the status reaches a terminal state. See the [Webhooks](https://docs.signalhouse.io/webhooks) section for full details and polling examples.
