Skip to content
RingCentral Swift Client
Swift Other
  1. Swift 99.6%
  2. Other 0.4%
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
RingCentral.xcodeproj Update compile sources Aug 9, 2018
RingCentral_iOS Everything for review (#1) Jan 11, 2017
RingCentral_macOS Everything for review (#1) Jan 11, 2017
RingCentral_macOS_Tests Everything for review (#1) Jan 11, 2017
RingCentral_tvOS Everything for review (#1) Jan 11, 2017
RingCentral_watchOS Everything for review (#1) Jan 11, 2017
Source Regenerate code Aug 9, 2018
Tests Remove empty tests Aug 9, 2018
.ackrc Everything for review (#1) Jan 11, 2017
.slather.yml Enable slather code coverage Jan 12, 2017
.travis.yml Update travis osx_image May 12, 2018
Cartfile Upgrade Hearst-DD/ObjectMapper to latest version Oct 24, 2017
Cartfile.resolved Update libraries Aug 6, 2018
Gemfile Add source to Gemfile Jan 12, 2017
Gemfile.lock Update gemfile Apr 26, 2018 Update readme about subscription Aug 9, 2018 Update Nov 21, 2017

RingCentral Swift Client

Build status Coverage Status Community Twitter

RingCentral Developers is a cloud communications platform which can be accessed via more than 70 APIs. The platform's main capabilities include technologies that enable: Voice, SMS/MMS, Fax, Glip Team Messaging, Data and Configurations.

API Reference and APIs Explorer.


  • iOS 9.0+ / macOS 10.11+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 8.0+
  • Swift 3.0+

Version requirements

For Swift 3.1 or earlier, use version 0.5.0.

For Swift 4 or later, use the latest version.


The recommended way to install this framework is via Carthage.

Add the following to your Cartfile:

github "ringcentral/ringcentral-swift"

Denpending on your target platform, run one of the following:

carthage update --platform macOS
carthage update --platform iOS
carthage update --platform tvOS
carthage update --platform watchOS

Built libraries will be available in ./Carthage/Build/.

URL Builder

Given any API endpoint, taking /restapi/v1.0/account/~/extension/~/call-log for example.

You can build its url with code easily:

let restapiVersion = "v1.0"
let accountID = "~"
let extensionId = "~"

URL Builder helps you to build your URL with ease


Please NEVER do string concatenation like below

"/restapi" + restapiVersion + "/account/" + accountID + "/extension/" + extensionId + "/call-log"

Default Value

Default value for restapi is "v1.0"; default value for account and extension are both "~".

If you don't specify an explicit value, default value is used.

So the following two lines are equivalent:



let rc = RestClient(appKey: "", appSecret: "", production: false)
rc.authorize("username", ext: "", password: "password") { token, error in
    if error == nil {

Token Refresh

By default, there is a background timer calling rc.refresh() periodically, so the authorization never expires.

But if you would like to call refresh manually: rc.autoRefreshToken = false

Token Revoke

When you no longer need the token, don't forget to revoke it: rc.revoke().

Sample for list, get, post, put and delete


// /restapi/v1.0/account/~/extension/~/address-book
let addressBook = rc.restapi("v1.0").account("~").extension("~").addressBook() { list, error in
    print(list!.paging!.page) // 1

post [ "firstName": "Tyler", "lastName": "Long", "homePhone": phoneNumber ]) { contact, error in
    print(contact!.lastName) // Long

get"\(!)").get(){ contact, error in
    print(contact.lastName) // Long


contact.lastName = "Liu""\(!)").put(parameters: contact.toParameters()) { contact2, error in
    print(contact2.lastName) // Liu

delete"\(!)").delete() { error in
    print(error == nil) // true

Send SMS

let parameters = SmsPath.PostParameters(
    from: CallerInfo(phoneNumber: "123456789"),
    to: [CallerInfo(phoneNumber: "123456789")],
    text: "hello world"
rc.restapi().account().extension().sms().post(parameters: parameters) { messageInfo, error in
    if error == nil {
        print("SMS sent!")

PubNub Subscription

let subscription = rc.restapi().subscription().new()
subscription.listeners.append { notification in
    let messageEvent = MessageEvent(JSONString: notification.json!)!

Remove Subscription

When you no longer need a subscription, don't forget to remove it:


Send fax

let parameters = FaxPath.PostParameters(to: [CallerInfo(phoneNumber: "1234567890")])
var attachments: [Attachment] = []
attachments.append(Attachment(fileName: "test.pdf", contentType: "application/pdf", data: pdfData))
rc.restapi().account().extension().fax().post(parameters: parameters, attachments: attachments) { messageInfo, error in
    if error == nil {
        print("fax sent")

Upload binary file

rc.restapi().account().extension().profileImage().put(imageData: imageData, imageFileName: "test.png") { error in
    if error == nil {
        print("Profile image updated")

More sample code

The test cases contain lots of sample code.


This project is released under the MIT license.

You can’t perform that action at this time.