ClickSend REST API v3

Description

This is the official API documentation for ClickSend.com

Below you will find a current list of the available methods for clicksend.

NOTE: You will need to create a free account to use the API.

You can Register Here.

API URL

The API should always be accessed over SSL.

Base URL: https://rest.clicksend.com/v3/

Authentication

Basic HTTP authentication should be used in the header.

Either:

username: Your API username

password: Your API key

You can get your API credentials by clicking 'API Credentials' on the top right of the dashboard.

OR

username: Your account username

password: Your account password

These are the same credentials that you use to login to the dashboard.

Authorization Header

The Authorization header is constructed as follows:

  1. Username and password are combined into a string username:password
  2. The resulting string is then encoded using Base64 encoding
  3. The authorization method and a space i.e. “Basic " is then put before the encoded string.

For example, if the user uses Aladdin as the username and open sesame as the password then the header is formed as follows:

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

PHP Authentication Header Example (using cURL)

curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Basic ' . base64_encode("$username:$password")]);

Verbs

The API uses restful verbs.

VerbDescription
GETSelect one or more items. Success returns 200 status code.
POSTCreate a new item. Success returns 200 status code.
PUTUpdate an item. Success returns 200 status code.
DELETEDelete an item. Success returns 200 status code.

Status Codes

The API will respond with one of the following HTTP status codes.

CodeResponseDescription
200SUCCESSRequest completed successfully.
400BAD_REQUESTThe request was invalid or cannot be otherwise served. An accompanying error message will explain further.
401UNAUTHORIZEDAuthentication credentials were missing or incorrect.
403FORBIDDENThe request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why.
404NOT_FOUNDThe URI requested is invalid or the resource requested does not exists.
405NOT_FOUNDMethod doesn’t exist or is not allowed.
429TOO_MANY_REQUESTSRate Limit Exceeded. Returned when a request cannot be served due to the application’s rate limit having been exhausted for the resource. See Rate Limiting.
500INTERNAL_SERVER_ERRORSomething is broken

Application Status Codes

The following status codes can be returned in addition to the HTTP status code. For example, when using the Send SMS endpoint:

ResponseDescription
SUCCESSMessage added to queue OK. Use delivery reports to get an update on the delivery status.
MISSING_CREDENTIALSNot enough information has been supplied for authentication. Please ensure that your Username and Unique Key are supplied in your request.
ACCOUNT_NOT_ACTIVATEDYour account has not been activated.
INVALID_RECIPIENTThe destination mobile number is invalid.
THROTTLEDIdentical message body recently sent to the same recipient. Please try again in a few seconds.
INVALID_SENDER_IDInvalid Sender ID. Please ensure Sender ID is no longer than 11 characters (if alphanumeric), and contains no spaces.
INSUFFICIENT_CREDITYou have reached the end of your message credits. You will need to purchase more message credits.
INVALID_CREDENTIALSYour Username or Unique Key is incorrect.
ALREADY_EXISTSThe resource you’re trying to add already exists.
EMPTY_MESSAGEMessage is empty.
TOO_MANY_RECIPIENTSToo many recipients.
MISSING_REQUIRED_FIELDSSome required fields are missing.
INVALID_SCHEDULEThe schedule specified is invalid. Use a unix timestamp e.g. 1429170372.
NOT_ENOUGH_PERMISSION_TO_LIST_IDDon’t have enough privilege to access or send to a list_id.
INTERNAL_ERRORInternal error.
INVALID_LANGAn invalid language option has been provided.
INVALID_VOICEAn invalid voice (gender) option has been provided.
SUBJECT_REQUIREDUsually happens when MMS Subject is empty.
INVALID_MEDIA_FILEUsually MMS media file is invalid file.
SOMETHING_IS_WRONGGeneric Error happened.

Required Headers

You’ll need to send some headers when making API calls.

HeaderValue
Content-typeapplication/json

Pagination

Some methods are paginated. By default, 1 page of 15 items will be returned. You can set the pagination parameters by adding ?page={page}&limit={limit} to the URL.

Request

ParameterTypeDefaultValue
pageinteger1The page number to return in the response.
limitinteger15The number of results per page. Min 15, Max 100.

Response

AttributeTypeValue
totalintegerTotal number of results available.
per_pageintegerNumber of results returned per page.
current_pageintegerCurrent page number.
last_pageintegerLast page number.
next_page_urlstringA URL of the next page. null if not available.
prev_page_urlstringA URL of the previous page. null if not available.
fromintegerNumber of the first result in current page.
tointegerNumber of the last result in current page.

Searching and Sorting

Most GET endpoints allow searching and sorting. Searches are not case-sensitive.

To perform a search, add q as a query parameter. For example:

/subaccounts?q=field:value,field2:value

Order

To perform a sort, add order_by as a query parameter. For example:

/subaccounts?order_by=field:desc/asc

AND / OR

By default, it will search using the AND operator. This can be set using operator as a query parameter. For example:

/subaccounts?q=field:value&operator=OR

Options:

  • AN - returns results matching all query fields specified

  • OR - returns results matching any query fields specified

Example

/subaccounts?q=first_name:john,last_name:smith&order_by=subaccount_id:asc&operator=AND

CORS

When creating your API app, specify the JavaScript (CORS) origins you’ll be using. We use these origins to return the headers needed for CORS.

Date and Time

All date/timestamps will be returned in Unix time (also known as POSIX time or erroneously as Epoch time) with no leap seconds.

For example: 1435255816

(ISO 8601: 2015-06-25T18:10:16Z)

More information: Wikipedia: Unix time.

There is ony one Unix time and it is created by using the UTC/GMT time zone. This means you might have convert time zones to calculate timestamps. Most programming language have libraries to help you converting time zones.

The current Unix time can be found here: Epoch Converter

Testing

Test Credentials

These API credentials can be used to test specific scenarios.

Note: you will need to create a free account to test other scenarios. Refer to introduction.

API UsernameAPI KeyDescription
nocreditD83DED51-9E35-4D42-9BB9-0E34B7CA85AEThis account has no credit.
notactiveD83DED51-9E35-4D42-9BB9-0E34B7CA85AEThis account is not active.
bannedD83DED51-9E35-4D42-9BB9-0E34B7CA85AEThis account is banned.

Test SMS/MMS Numbers

The following numbers can be used when testing. No messages will be sent, and your account won’t be charged. A success response will be returned.

  • +61411111111

  • +61422222222

  • +61433333333

  • +61444444444

  • +14055555555

  • +14055555666

  • +447777777777

  • +8615555555555

Test Voice Numbers

The following numbers can be used when testing. No messages will be sent, and your account won’t be charged. A success response will be returned.

  • +61411111111

  • +61422222222

  • +61433333333

  • +61444444444

  • +14055555555

  • +14055555666

  • +447777777777

  • +8615555555555

Test Fax Numbers

The following numbers can be used when testing. No messages will be sent, and your account won’t be charged. A success response will be returned.

  • +61261111111

  • +61262222222

  • +61263333333

Test Email Addresses

The following email addresses can be used when testing. No messages will be sent, and your account won’t be charged. A success response will be returned.

  • test1@test.com

  • test2@test.com

  • test3@test.com

Test Post Letter Addresses

The following Postal Codes (address_postal_code) can be used when testing. No messages will be sent when using these post codes, and your account won’t be charged. A success response will be returned.

  • 11111

  • 22222

  • 33333

Use this page to mock ClickSend REST API v3 in your testing and development.

Run our mock API sample using the open source WireMock library, or in the free edition of WireMock Cloud. You'll have a working API server simulating the behavior of ClickSend REST API v3, which will allow you to keep building and testing even if the actual API you isn't currently available.

Related mocks

Mailscript

EmailVerify

OTP email verification API by PayPI.

Mailsquad

MailSquad offers an affordable and super

Postmark API

Postmark makes sending and receiving

Postmark Account-level API

Postmark makes sending and receiving

MailboxValidator Free Email Checker

The MailboxValidator Free Email Checker

Ready to accelerate your development flow

Shorter release cycles, more predictable schedules and fewer defects in production.
Start Mocking for Free *Free forever. No credit card needed