Skip to content

Messaging Switch

A record representing a Switch configuration, supporting SMS and MMS protocols.

Note: The API key provided in the Authorization header must have the apik_ prefix, and requires the API key to have a user with sufficient permissions assigned to it.

NameTypeDescription
idULIDUnique identifier
nameStringDisplay name or canonical name of the Switch
inserted_atString (format: datetime)Creation timestamp
updated_atString (format: datetime)Last update timestamp
sms_auth_methodEnum:StringAuth method for SMS. NONE - no auth; BASIC - uses identity + secret; BEARER - uses secret/token only
sms_enabledBooleanWhether the switch can process SMS messages
sms_protocolEnum:StringProtocol for delivering inbound SMS. NONE - discard; HTTP - deliver over HTTP; MAILBOX - write to internal mailbox for manual retrieval via API; EMAIL - deliver via email; SMTP - transmit as barebones ISO8601 message
sms_endpointsArray:StringTargets for message delivery depending on chosen protocol. EG URLs for HTTP, or emails addresses for EMAIL.
sms_identityStringUsername component when using BASIC auth
sms_message_formatEnum:StringPayload format for SMS (primarily HTTP). MERCURY_SMS_1_0 - default; LEGACY_SMS_2_0 - backwards compatibility
sms_secretStringBASIC auth password, or BEARER auth token/secret
mms_auth_methodEnum:StringAuth method for MMS webhook. NONE - no auth; BASIC - uses identity + secret; BEARER - uses secret/token only
mms_enabledBooleanWhether the switch can process MMS messages
mms_protocolEnum:StringTransport protocol for MMS delivery. NONE - discard; HTTP - deliver over HTTP; MM4 - industry-standard MMS transport; EMAIL - deliver via email; SMTP - deliver raw over SMTP
mms_endpointsArray:StringEndpoint(s) for the switch to act on. Can be URLs for a webhook, or email
mms_identityStringUsername component when using BASIC auth
mms_message_formatEnum:StringPayload format for MMS (primarily HTTP). MERCURY_SMS_1_0 - default; LEGACY_SMS_2_0 - backwards compatibility
mms_secretStringBASIC auth password, or BEARER auth token/secret

Request:

POST https://api.swift-api.com/api/v1/switches HTTP/1.1
Accept: application/json, text/plain
Content-Type: application/json
Authorization: Bearer apik_ABC123
{
"data": {
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_protocol": "HTTP",
"sms_secret": "string"
},
"type": "switch"
}

Success response:

HTTP/1.1 201
Content-Type: application/json
Content-Length: 402
{
"data": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"inserted_at": "2024-06-14T00:00:00.000000Z",
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_options": null,
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_options": null,
"sms_protocol": "HTTP",
"sms_secret": "string",
"updated_at": "2024-06-14T00:00:00.000000Z"
},
"type": "switch"
}

Invalid parameter response (can apply to any parameter):

HTTP/1.1 422
Content-Type: application/json
Content-Length: 402
{
"errors": [
{
"code": "invalid_parameter",
"source": {
"in": "body",
"pointer": "/data/name"
},
"detail": "has already been taken",
"sub_code": "constraint.unique"
}
]
}

Request:

POST https://api.swift-api.com/api/v1/accounts/{account_id}/switches
Accept: application/json, text/plain
Content-Type: application/json
Authorization: Bearer apik_ABC123
{
"data": {
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_protocol": "HTTP",
"sms_secret": "string"
},
"type": "switch"
}

Success response:

HTTP/1.1 201
Content-Type: application/json
Content-Length: 402
{
"data": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"inserted_at": "2024-06-14T00:00:00.000000Z",
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_options": null,
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_options": null,
"sms_protocol": "HTTP",
"sms_secret": "string",
"updated_at": "2024-06-14T00:00:00.000000Z"
},
"type": "switch"
}

Request:

PATCH https://api.swift-api.com/api/v1/switches/{id} HTTP/1.1
Accept: application/json, text/plain
Content-Type: application/json
Authorization: Bearer apik_ABC123
{
"data": {
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_protocol": "HTTP",
"sms_secret": "string"
},
"type": "switch"
}

Success response:

HTTP/1.1 200
Content-Type: application/json
Content-Length: 402
{
"data": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"inserted_at": "2024-06-14T00:00:00.000000Z",
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_options": null,
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_options": null,
"sms_protocol": "HTTP",
"sms_secret": "string",
"updated_at": "2024-06-14T00:00:00.000000Z"
},
"type": "switch"
}

Invalid parameter response (can apply to any parameter):

HTTP/1.1 422
Content-Type: application/json
Content-Length: 402
{
"errors": [
{
"code": "invalid_parameter",
"source": {
"in": "body",
"pointer": "/data/name"
},
"detail": "has already been taken",
"sub_code": "constraint.unique"
}
]
}

Not found response:

HTTP/1.1 404
Content-Type: application/json
Content-Length: 402
{
"errors": [
{
"code": "not_found",
"title": "Not Found",
"params": {
"resource": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"type": "switch"
}
},
"sub_code": "none"
}
]
}

Request:

DELETE https://api.swift-api.com/api/v1/switches/{id} HTTP/1.1
Authorization: Bearer apik_ABC123

Success response (returns the deleted switch object):

HTTP/1.1 200
Content-Type: application/json
Content-Length: 402
{
"data": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"inserted_at": "2024-06-14T00:00:00.000000Z",
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_options": null,
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_options": null,
"sms_protocol": "HTTP",
"sms_secret": "string",
"updated_at": "2024-06-14T00:00:00.000000Z"
},
"type": "switch"
}

Not found response:

HTTP/1.1 404
Content-Type: application/json
Content-Length: 402
{
"errors": [
{
"code": "not_found",
"title": "Not Found",
"params": {
"resource": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"type": "switch"
}
},
"sub_code": "none"
}
]
}

Lists all the switches associated with the parent account, and all sub-accounts.

Request:

GET https://api.swift-api.com/api/v1/switches
Authorization: Bearer apik_ABC123

Success response (paginated list of switches):

HTTP/1.1 200
Content-Type: application/json
Content-Length: 402
{
"data": {
"items": [
{
"data": { /* Switch object */ },
"type": "switch"
}
],
"page_info": {
"after": "string",
"before": "string",
"limit": 0,
"total": 0
}
},
"type": "list"
}
GET https://api.swift-api.com/api/v1/switches/{id}
Authorization: Bearer apik_ABC123

Success response:

HTTP/1.1 200
Content-Type: application/json
Content-Length: 402
{
"data": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"inserted_at": "2024-06-14T00:00:00.000000Z",
"mms_auth_method": "NONE",
"mms_enabled": false,
"mms_endpoints": [
"https://example.com/path/for/inbound"
],
"mms_identity": "string",
"mms_message_format": "MERCURY_MMS_1_0",
"mms_options": null,
"mms_protocol": "HTTP",
"mms_secret": "string",
"name": "Pager Switch",
"sms_auth_method": "NONE",
"sms_enabled": false,
"sms_endpoints": [
"https://example.com/path/for/inbound"
],
"sms_identity": "string",
"sms_message_format": "MERCURY_SMS_1_0",
"sms_options": null,
"sms_protocol": "HTTP",
"sms_secret": "string",
"updated_at": "2024-06-14T00:00:00.000000Z"
},
"type": "switch"
}

Not found response:

HTTP/1.1 404
Content-Type: application/json
Content-Length: 402
{
"errors": [
{
"code": "not_found",
"title": "Not Found",
"params": {
"resource": {
"id": "01J0CRVTXX9KBD9NWS02R5R8RT",
"type": "switch"
}
},
"sub_code": "none"
}
]
}