### Example JSON response for messages Source: https://developers.sms.to/ A sample JSON response structure returned by the GET messages endpoint. ```json { "success": true, "data": [ { "id": "11ec-8330-c25f5870-a614-02420a0002ab", "campaign_id": null, "sender_id": "SMSto", "message": "This is a test message", "to": "+35799999999999", "status": "REJECTED", "cost": 0, "sms_count": 1, "type": "viber", "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "updated_at": "2022-02-01 07:30:07", "created_at": "2022-02-01 07:29:59", "sent_at": "2022-02-01 07:30:07", "is_api": true, "failed_reason": null, "internal_failed_reason": null }, { "id": "11ec-8330-9adf8e1e-954e-0242ac120004", "campaign_id": null, "sender_id": "SMSto", "message": "This is a test message", "to": "+35799999999999", "status": "REJECTED", "cost": 0, "sms_count": 1, "type": "fsms", "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "updated_at": "2022-02-01 07:29:06", "created_at": "2022-02-01 07:28:53", "sent_at": "2022-02-01 07:29:06", "is_api": true, "failed_reason": null, "internal_failed_reason": null }, { "id": "11ec-8330-4bb915e4-8a5f-02420a0002b9", "campaign_id": "11ec-8330-49701b2a-9992-0242ac120004", "sender_id": "SMSto", "message": "This is test", "to": "+35799999999999", "status": "REJECTED", "cost": 0, "sms_count": 1, "type": "sms", "callback_url": "https://example.com/callback/handler", "scheduled_for": 1672467300, "timezone": "Asia/Kathmandu", "updated_at": "2022-02-01 07:27:06", "created_at": "2022-02-01 07:26:39", "sent_at": "2022-02-01 07:27:06", "is_api": true, "failed_reason": null, "internal_failed_reason": null }, { "id": "11ec-8330-4bbddfb6-822b-02420a0002b9", "campaign_id": "11ec-8330-49701b2a-9992-0242ac120004", "sender_id": "SMSto", "message": "This is test", "to": "+35799999999998", "status": "REJECTED", "cost": 0, "sms_count": 1, "type": "sms", "callback_url": "https://example.com/callback/handler", "scheduled_for": 1672467300, "timezone": "Asia/Kathmandu", "updated_at": "2022-02-01 07:27:06", "created_at": "2022-02-01 07:26:39", "sent_at": "2022-02-01 07:27:06", "is_api": true, "failed_reason": null, "internal_failed_reason": null }, { "id": "11ec-8330-18403efe-8608-0242ac120004", "campaign_id": "11ec-8330-17b862b8-b4a7-02420a0002ab", "sender_id": "SMSto", "message": "This is a test message", "to": "+35799999999999", "status": "REJECTED", "cost": 0, "sms_count": 1, "type": "sms", "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "updated_at": "2022-02-01 07:26:06", "created_at": "2022-02-01 07:25:13", "sent_at": "2022-02-01 07:26:06", "is_api": true, "failed_reason": null, "internal_failed_reason": null }, { "id": "11ec-8330-1846f046-bf6c-0242ac120004", "campaign_id": "11ec-8330-17b862b8-b4a7-02420a0002ab", "sender_id": "SMSto", "message": "Hello world!", "to": "+35799585001", "status": "FAILED", "cost": 0.018, "sms_count": 1, ``` -------------------------------- ### Fetch Campaigns List with Query Parameters Source: https://developers.sms.to/ Example URL demonstrating how to fetch campaigns with query parameters for limit, page, and search. ```URL https://api.sms.to/campaigns?limit=10&page=1&search=2019-11-18 ``` -------------------------------- ### Get Campaigns Request (cURL) Source: https://developers.sms.to/ Use this cURL command to make a GET request to the SMS.to API to fetch a list of campaigns. Ensure you replace '' with your actual API key. ```curl curl --location 'https://api.sms.to/v2/campaigns' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Example Campaign Response Source: https://developers.sms.to/ This JSON object represents a successful response when fetching campaign details. It includes various metrics and status information about the campaign. ```json { "id": "11ec-8330-49701b2a-9992-0242ac120004", "type": "sms", "user_id": 342847, "sender_id": "SMSto", "template_id": null, "message": "This is test", "list_id": null, "status": "SCHEDULED", "client_total_cost": 0, "estimated_cost": 0, "delivered_messages": 0, "failed_messages": 0, "pending_messages": 2, "sent_messages": 2, "bypass_optout": 0, "callback_url": "https://example.com/callback/handler", "scheduled_for": 1672467300, "timezone": "Asia/Kathmandu", "created_at": "2022-02-01 07:26:36", "updated_at": "2022-02-01 07:26:36", "sms_count": 1, "is_api": 1, "canceled_at": "" } ``` -------------------------------- ### GET /v2/campaigns/{id} Source: https://developers.sms.to/ Retrieves the details of a specific campaign by its unique identifier. ```APIDOC ## GET /v2/campaigns/{id} ### Description Fetch the details of a specific campaign using its unique ID. ### Method GET ### Endpoint https://api.sms.to/v2/campaigns/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the campaign. ### Request Example curl --location 'https://api.sms.to/v2/campaigns/11ec-8330-49701b2a-9992-0242ac120004' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ### Response #### Success Response (200) - **id** (string) - Campaign ID - **type** (string) - Campaign type - **user_id** (integer) - User ID - **sender_id** (string) - Sender ID - **message** (string) - Message content - **status** (string) - Campaign status - **scheduled_for** (integer) - Scheduled timestamp - **created_at** (string) - Creation timestamp #### Response Example { "id": "11ec-8330-49701b2a-9992-0242ac120004", "type": "sms", "user_id": 342847, "sender_id": "SMSto", "message": "This is test", "status": "SCHEDULED", "scheduled_for": 1672467300, "created_at": "2022-02-01 07:26:36" } ``` -------------------------------- ### Example Campaign Response Source: https://developers.sms.to/ This JSON object represents a successful response when fetching campaign data. It includes details about campaign status, costs, and message counts. ```json { "success": true, "data": [ { "id": "11ec-8330-49701b2a-9992-0242ac120004", "type": "sms", "user_id": 342847, "sender_id": "SMSto", "template_id": null, "message": "This is test", "list_id": null, "status": "SCHEDULED", "client_total_cost": 0, "estimated_cost": 0, "delivered_messages": 0, "failed_messages": 2, "pending_messages": 2, "sent_messages": 2, "bypass_optout": 0, "callback_url": "https://example.com/callback/handler", "scheduled_for": 1672467300, "timezone": "Asia/Kathmandu", "created_at": "2022-02-01 07:26:36", "updated_at": "2022-02-01 07:26:36", "sms_count": 1, "is_api": 1, "canceled_at": "" }, { "id": "11ec-8330-17b862b8-b4a7-02420a0002ab", "type": "sms", "user_id": 342847, "sender_id": "SMSto", "template_id": null, "message": "This is a test message", "list_id": null, "status": "DONE", "client_total_cost": 0.018, "estimated_cost": 0.018, "delivered_messages": 0, "failed_messages": 2, "pending_messages": 0, "sent_messages": 2, "bypass_optout": 0, "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "created_at": "2022-02-01 07:25:12", "updated_at": "2022-02-01 07:26:59", "sms_count": 1, "is_api": 1, "canceled_at": "" }, { "id": "11ec-832f-ecdf64f6-8109-0242ac120004", "type": "sms", "user_id": 342847, "sender_id": "SMSto", "template_id": null, "message": "This is test", "list_id": "[27300]", "status": "DONE", "client_total_cost": 0.018, "estimated_cost": 0.018, "delivered_messages": 1, "failed_messages": 0, "pending_messages": 0, "sent_messages": 1, "bypass_optout": 0, "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "created_at": "2022-02-01 07:24:02", "updated_at": "2022-02-01 07:25:00", "sms_count": 1, "is_api": 1, "canceled_at": "" }, { "id": "11ec-832f-99ba49c6-aa80-0242ac120004", "type": "sms", "user_id": 342847, "sender_id": "SMSto", "template_id": null, "message": "This is a test message", "list_id": null, "status": "DONE", "client_total_cost": 0, "estimated_cost": 0, "delivered_messages": 0, "failed_messages": 2, "pending_messages": 0, "sent_messages": 2, "bypass_optout": 0, "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "created_at": "2022-02-01 07:21:42", "updated_at": "2022-02-01 07:22:58", "sms_count": 1, "is_api": 1, "canceled_at": "" } ], "links": [ { "url": null, "label": "pagination.previous", "active": false }, { "url": "https://api.sms.to/v2/campaigns?page=1", "label": "1", "active": true }, { "url": null, "label": "pagination.next", "active": false } ], "current_page": 1, "from": 1, "last_page": 1, "path": "https://api.sms.to/v2/campaigns", "per_page": 15, "to": 4, "total": 4 } ``` -------------------------------- ### GET /v2/campaigns Source: https://developers.sms.to/ Fetches a paginated list of campaigns. Supports filtering by search keywords and pagination parameters. ```APIDOC ## GET https://api.sms.to/v2/campaigns ### Description Fetch a paginated list of campaigns from the SMS.to platform. ### Method GET ### Endpoint https://api.sms.to/v2/campaigns ### Parameters #### Query Parameters - **limit** (integer) - Optional - The number of campaigns per page. Default: 100 - **page** (integer) - Optional - The page number. Default: 1 - **search** (string) - Optional - Keywords to search for. Filters campaigns by phone number, date, or source type. ### Request Example curl --location 'https://api.sms.to/v2/campaigns' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (array) - List of campaign objects. - **links** (array) - Pagination links. - **current_page** (integer) - Current page number. - **total** (integer) - Total number of campaigns. #### Response Example { "success": true, "data": [ { "id": "11ec-8330-49701b2a-9992-0242ac120004", "type": "sms", "status": "SCHEDULED", "message": "This is test" } ], "current_page": 1, "total": 4 } ``` -------------------------------- ### GET /v2/messages Source: https://developers.sms.to/ Fetch a paginated list of messages with optional filters for status, recipient, and date ranges. ```APIDOC ## GET /v2/messages ### Description Fetch paginated messages from the SMS.to platform. Results are sorted by creation date (latest first) and limited to a 31-day window. ### Method GET ### Endpoint https://api.sms.to/v2/messages ### Parameters #### Query Parameters - **limit** (integer) - Optional - The number of messages per page. Default: 15 - **order_direction** (string) - Optional - Sort messages. Default: desc - **order_by** (string) - Optional - Field to sort by. Accepted fields: 'created_at', 'id', 'sent_at', 'sender_id', 'is_api', 'status', 'cost'. Default: created_at - **status** (string) - Optional - Filter by status - **to** (string) - Optional - Filter by recipient number - **created_at_from** (string) - Optional - Filter by From date (Format: Y-m-d H:i:s) - **created_at_to** (string) - Optional - Filter by To date (Format: Y-m-d H:i:s) ### Request Example curl --location 'https://api.sms.to/v2/messages' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful - **data** (array) - List of message objects #### Response Example { "success": true, "data": [ { "id": "11ec-8330-c25f5870-a614-02420a0002ab", "message": "This is a test message", "to": "+35799999999999", "status": "REJECTED", "created_at": "2022-02-01 07:29:59" } ] } ``` -------------------------------- ### Get Campaign by ID using cURL Source: https://developers.sms.to/ Use this cURL command to fetch a specific campaign by its ID. Ensure you replace `` with your actual API key. ```bash curl --location 'https://api.sms.to/v2/campaigns/11ec-8330-49701b2a-9992-0242ac120004' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Retrieve messages via cURL Source: https://developers.sms.to/ Use this cURL command to fetch messages from the SMS.to API. Ensure the Authorization header includes your valid Bearer token. ```bash curl --location 'https://api.sms.to/v2/messages' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' ``` -------------------------------- ### SMS Message Details Source: https://developers.sms.to/ This section details the structure of an SMS message object as returned by the API. It includes information about the message content, recipient, status, and associated metadata. ```APIDOC ## SMS Message Object ### Description Represents a single SMS message with its associated metadata. ### Fields - **id** (string) - Unique identifier for the SMS message. - **campaign_id** (string) - Identifier for the campaign this message belongs to, if applicable. - **sender_id** (string) - The sender ID or name used for the message. - **message** (string) - The content of the SMS message. - **to** (string) - The recipient's phone number. - **status** (string) - The current status of the SMS message (e.g., DELIVERED, REJECTED, FAILED). - **cost** (number) - The cost incurred for sending the SMS message. - **sms_count** (integer) - The number of SMS units consumed by the message. - **type** (string) - The type of message, typically "sms". - **callback_url** (string) - The URL to which delivery status notifications should be sent. - **scheduled_for** (string) - The date and time the message is scheduled to be sent (null if sent immediately). - **timezone** (string) - The timezone for scheduled messages (null if not applicable). - **updated_at** (string) - Timestamp of the last update to the message record. - **created_at** (string) - Timestamp when the message record was created. - **sent_at** (string) - Timestamp when the message was sent. - **is_api** (boolean) - Indicates if the message was sent via the API. - **failed_reason** (string) - Reason for failure, if the message failed to send (null otherwise). - **internal_failed_reason** (string) - Internal system reason for failure (null otherwise). ### Example Response ```json { "id": "11ec-832f-ee550d2c-ab2a-0242ac120004", "campaign_id": "11ec-832f-ecdf64f6-8109-0242ac120004", "sender_id": "SMSto", "message": "This is test", "to": "+35794000000", "status": "DELIVERED", "cost": 0.018, "sms_count": 1, "type": "sms", "callback_url": "https://example.com/callback/handler", "scheduled_for": null, "timezone": null, "updated_at": "2022-02-01 07:24:05", "created_at": "2022-02-01 07:24:02", "sent_at": "2022-02-01 07:24:03", "is_api": true, "failed_reason": null, "internal_failed_reason": null } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.