Opt-Out
Note: The API key provided in the Authorization header must have the apik_ prefix.
Schema
Request
| Name | Type | Description |
|---|---|---|
| host_number | String(format:e164) | The DID associated with the opt-out, in E.164 format excluding the + prefix (eg 17055551234). Can be omitted if the type is account, csp_brand, or csp_campaign. |
| remote_number | String(format:e164) | The recipient phone number associated with the opt-out, in E.164 format excluding the + prefix (eg 17055551234). |
| keyword | String | The keyword associated with the opt-out. |
| type | String | The scope of opt-out. Valid values are:
|
| tcr_brand_id | String | Optional TCR brand ID associated with the opt-out. Included only when the type is csp_brand. |
| tcr_campaign_id | String | Optional TCR campaign ID associated with the opt-out. Included only when the type is csp_campaign. |
Get all Opt-Outs
Request:
GET /api/v1/messaging/optout_itemsAuthorization: Bearer apik_ABC123Response:
HTTP/1.1 200 OKContent-Type: application/json
{ "data": { "items": [ { "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": null }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item" } ], "page_info": { "after": null, "before": null, "limit": 50, "total": null } }, "type": "list"}Get Opt-Outs for account
Request:
GET https://api.swift-api.com/api/v1/accounts/{account_id}/messaging/optout_itemsAuthorization: Bearer apik_ABC123Response:
HTTP/1.1 200 OKContent-Type: application/json
{ "data": { "items": [ { "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": null }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item" } ], "page_info": { "after": null, "before": null, "limit": 50, "total": null } }, "type": "list"}Get Opt-Out by ID
Request:
GET https://api.swift-api.com/api/v1/messaging/optout_items/{id}Authorization: Bearer apik_ABC123Response:
HTTP/1.1 200 OKContent-Type: application/json
{ "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": null }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item"}Create Opt-Out
Request:
POST https://api.swift-api.com/api/v1/messaging/optout_itemsAuthorization: Bearer apik_ABC123
{ "data": { "host_number": "string", "keyword": "string", "remote_number": "string", "type": "string" },}Response:
HTTP/1.1 201 CreatedContent-Type: application/json
{ "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": "string" }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item"}Create Opt-Out for account
Request:
POST https://api.swift-api.com/api/v1/accounts/{account_id}/messaging/optout_itemsAuthorization: Bearer apik_ABC123
{ "data": { "host_number": "string", "keyword": "string", "remote_number": "string", "type": "string" }}Response:
HTTP/1.1 201 CreatedContent-Type: application/json
{ "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": "string" }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item"}Update Opt-Out
Request:
PUT https://api.swift-api.com/api/v1/messaging/optout_items/{id}Authorization: Bearer apik_ABC123
{ "data": { "host_number": "string", "keyword": "string", "remote_number": "string", "type": "account" },}Response:
HTTP/1.1 200 OKContent-Type: application/json
{ "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": "string" }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item"}Delete Opt-Out
Returns the deleted Opt-Out.
Request:
DELETE https://api.swift-api.com/api/v1/messaging/optout_items/{id}Authorization: Bearer apik_ABC123Response:
HTTP/1.1 200 OKContent-Type: application/json
{ "associations": { "account": { "data": { "id": "string" }, "type": "account" }, "csp_brand": { "data": { "id": null }, "type": "csp_brand" }, "csp_campaign": { "data": { "id": null }, "type": "csp_campaign" }, "host_did": { "data": { "id": "string" }, "type": "did" }, "sms": { "data": { "id": null }, "type": "sms" } }, "data": { "host_number": "string", "id": "string", "inserted_at": "2024-06-14T00:00:00.000000Z", "keyword": "string", "remote_number": "string", "tcr_brand_id": null, "tcr_campaign_id": null, "type": "string", "updated_at": "2024-06-14T00:00:00.000000Z" }, "type": "messaging_optout_item"}