Skip to main content

Integration Document

Cloudike PAYG integration documentation provides a comprehensive guide for customers to connect their systems with Cloudike’s platform, enabling seamless authentication, subscription management, and SMS notifications.

Definitions

The main subjects involved in the cross-integrations are described below:

TermDescription
Cloudike PAYG (or Cloudike)Cloudike PAYG (Pay-As-You-Go) is a universal software platform owned by Cloudike Inc. and hosted on its Amazon AWS account. The platform is designed to launch various projects for different Customers, enabling them to provide cloud services to their end users.
CustomerA company that has contracted with Cloudike Inc. and uses Cloudike PAYG resources to provision its users.
Customer Core SystemThe Customer Core System (hereafter referred to as Customer's System) is an infrastructure of the specific Customer that is located on the Customer’s hardware resources (i.e., outside of Cloudike PAYG). It can be integrated with Cloudike PAYG’s infrastructure via the Internet.
UserAn end user of Cloudike PAYG who belongs to a specific Customer (and hence to a specific Tenant).
TenantA tenant is an isolated entity in the Cloudike PAYG platform created for a specific Customer. The concept of a tenant includes: - Private tenant settings (e.g., name, description, logo, project domain, various Customer's System endpoints, etc.) - Customer’s Users - A set of Packages
PackageA product that includes Cloudike's cloud disk quota and can be purchased by Users.
SubscriptionA Package that has been activated for a specific User.

User Authentication Procedure

We assume that various client applications of the Cloudike PAYG platform (browser, desktop, Android, and iOS clients) will use the same user authentication method. This method will also be the same for all attached tenants.

The first API method is used by clients when the user first launches the client. This API method provides a list of all tenants available to end users on the Platform.

During the first launch, the user must select a Tenant (i.e., project) they wish to register or log into.

  • The API method accepts the user's phone number (optional parameter) as input.
  • As output, the client responds with a list of tenants recommended for this phone number.
  • Recommendation logic can be implemented by analyzing:
    • The phone number's country prefix
    • The source IP address of the requesting client
    • The domain entered by the user in the browser (for web clients)

If no phone number is provided, the method will return an array with all tenants available on the Platform.

The second API method is used to retrieve the public Privacy Policy content of the selected Tenant.
The third API method handles sign-up and sign-in procedures (i.e. specifically for authentication).

GET http://payg.cloudike.com/api/2/tenants/

Input Parameters

ParameterTypeRequiredDescription
phonestringOptionalIf provided, the system will return a sublist of a few recommended tenants.

Output

Returns an array of tenants with the following fields:

FieldTypeDescription
tenant_namestringThe name of the tenant (i.e., internal ID).
frontend_urlstringA web link to the public frontend.
titlestringA human-readable name of the tenant.
descriptionstringA brief summary of the project.
logo_urlstringA URL to the tenant's logo.
available_langsstringA list of languages available for the tenant.

Return Values (HTTP Status Codes)

CodeDescription
200 OKThe request was successful.

Example Response (JSON)

{
"_embedded": {
"tenants": [
{
"tenant_name": "star",
"title": "StarCloud",
"frontend_url": "https://web.star.cloud/",
"description": "The solution for backing up your best moments",
"logo_url": "https://web.star.cloud/assets/logo.svg",
"available_langs": "en, kz",
"_links": {
"self": {
"href": "http://payg.cloudike.com/api/2/tenants/101/"
}
}
},
{
"tenant_name": "ice",
"title": "IceCloud",
"frontend_url": "https://www.icebox.com/",
"description": "The super cold fridge to store your Ice Cream",
"logo_url": "https://domain.ice/ice-logo.svg",
"available_langs": "en, id",
"_links": {
"self": {
"href": "http://payg.cloudike.com/api/2/tenants/167/"
}
}
}
]
}
}

Get the "Privacy Policy" Document of the Tenant

GET http://payg.cloudike.com/api/2/offers/

Input Parameters

ParameterTypeRequiredDescription
offsetnumberNoThe starting position of the returned list.
limitnumberNoThe number of results to return.
tenant_namestringYesThe Tenant’s name.
typestringYesThe required offer’s code. Use "privacy_policy".
langstringYesThe language code of the offer (e.g., "en").

API documentation of the method: https://be-saas.cloudike.com/backend_docs/rest/api/2/core_pkg/offers_app/Offers/index.html

Example Request

GET http://payg.cloudike.com/api/2/offers/?offset=0&limit=2&tenant_name=star_cloud&type=privacy_policy&lang=en

Return Values (HTTP Status Codes)

CodeDescription
200 OKThe request was successful.

Example Response (JSON)

{
"_links": {
"self": {
"href": "http://payg.cloudike.com/api/2/offers/"
},
"next": {
"href": "http://payg.cloudike.com/api/2/offers/?limit=2&offset=2"
}
},
"_embedded": {
"offers": [
{
"created": "2025-02-14T13:01:57.117000+00:00",
"updated": "2025-02-14T13:01:57.117000+00:00",
"id": "67af3ec589695ea21a9ef830",
"tenant_name": "star_cloud",
"type": "privacy_policy",
"lang": "en",
"url": "",
"_links": {
"self": {
"href": "http://payg.cloudike.com/api/2/offers/67af3ec589695ea21a9ef830/"
},
"content": {
"href": "http://payg.cloudike.com/api/2/offers/67af3ec589695ea21a9ef830/content/"
},
"offer_view": {
"href": "http://payg.cloudike.com/offers/67af3ec589695ea21a9ef830"
}
}
}
]
}
}

Notes

The _embeddedoffers field contains the array of offers. Each responded offer contains 2 useful fields:

  • _linkscontent contains a link to download the offer content, which is formatted with HTML markup.

    • The URL could be used to insert the content into an HTML page.
  • _linksoffer_view contains a link to the web frontend’s view page, which would display the offer as a separate HTML page.

Method of User Authentication (Sign-up/Sign-in)

POST http://payg.cloudike.com/api/2/phone_otp_auth_tokens/

Input Parameters

ParameterTypeRequiredDescription
longlivedbooleanNoBy default False. Set to True to create long-lived tokens for mobile apps.
device_descriptionstringYes (if longlived=True)Description of the device.
tenant_namestringYesThe name of the project (tenant).
phonestringYesThe user’s phone number.
actionstringYesOne of "login" or "reg".
passwordstringNoUser’s password (if applicable).
sms_otpstringYesOne-time password (OTP) sent via SMS (e.g., "12345").

Output Parameters

ParameterTypeDescription
idstringID of the created authentication token.
client_typestringType of client.
device_descriptionstringTaken from the input parameter.
createdstringTimestamp of token creation (ISO 8601 format).
expiresstringExpiration time of the token (ISO 8601 format).
last_activitystringTime of last account activity (ISO 8601 format).
user_idnumberCloudike user account unique ID.
tenant_namestringTenant where the user’s account belongs.
tokenstringSession token (secret).
user_createdbooleanTrue if a new user account was created during authentication.

Return Values (HTTP Codes)

  • 201 Created – Token successfully created.
{
"id": "Z6Mk8BqiYtZ6Ffpd",
"client_type": "android-client",
"client_version": "1.2.0",
"device_description": "Android 10",
"created": "2025-02-05T08:44:32.229000+00:00",
"expires": "2025-03-08T08:44:32.229000+00:00",
"last_activity": null,
"user_id": 5,
"tenant_name": "project_123",
"secret": "Zt0q3CAcQg6OKMZwcGbtAQ",
"token": "Z6Lk8BqiYtZ6Ffpd:Zt0q3CAcQb6OKMZwcGbtAQ",
"user_created": false,
"_links": {
"self": { "href": "http://payg.cloudike.com/api/2/users/5/Z6Mk8BqiYtZ6Ffpd/" },
"user": { "href": "http://payg.cloudike.com/api/2/users/5/" },
"credential": { "href": "http://payg.cloudike.com/api/2/users/5/credentials/67a324ef1aa262d67a15fa4b/" },
"gd_user_info": { "href": "http://payg.cloudike.com/api/2/users/5/gd_user_info/" }
}
}
  • 422 ValidationError – Incorrect or missing input parameters. Usually requires additional parameters; check the body for specific required fields:
    • input OTP required
    • incorrect OTP was inputted
{
"code": "ValidationError",
"description": "The request has wrong parameters.",
"detail": {
"sms_otp": "Required",
"password": "Required"
}
}
  • 429 TooManyIncorrectAttempts – Too many incorrect attempts; temporary block applied. The amount of seconds until the end of blocking is responded to.

HTTP Headers

Retry-After: 59

Response Body

{
"code": "TooManyIncorrectAttempts",
"description": "The action could not be performed because there were too many incorrect attempts by the client. Try again after a while.",
"detail": {
"retry_after": 59
}
}

SMS Notifications Sent to the User

We have two options for sending SMS notifications:

  1. Customer provides Cloudike PAYG with an endpoint to the standard SMPP protocol interface.
  2. Customer implements the REST API as described below.

REST API for Sending SMS

POST https://smsgate.customer.com/send-sms

HTTP Headers

  • Authorization: Bearer JWT
  • Content-type: application/json

Input Parameters

ParameterTypeRequiredDescription
msisdnnumberYesRecipient's phone number.
messagestringYesMessage text.

Return Codes

HTTP CodeDescription
200 OKMessage was successfully sent.
400 Bad RequestIncorrect request format. The platform will not retry the message.
422 Unprocessable EntityInvalid phone number or message text (too long/invalid). The platform will not retry the message.
429 Too Many RequestsToo many requests were sent. The platform will retry the message later.
5xx Server ErrorsSMSGate is temporarily down. The platform will retry the message.

Example Request

POST https://smsgate.customer.com/send-sms

HTTP Headers

  • Authorization: Bearer JWT
  • Content-type: application/json

Request Body

{
"msisdn": 123456789012,
"message": "12345 - your secret code to login StarCloud"
}

User Subscriptions Management

Subscription Model and Concepts

Cloudike PAYG platform provides a specific set of packages tailored to each Customer. The tenant’s packages are available for subscription by tenant’s users.

Cloudike’s package model has the following fields:

Field NameTypeDescription
idstringUnique ID of the package&.
customer_product_idstringUnique ID of package from Customer’s side.
namestringHuman-readable name of the package.
costnumberThe package’s cost for one period, in the natural number of minor currency units (i.e. “cents”).
cost_scalenumberBy default, it is 100. This represents the number of minor currency units (“cents”) in one major currency unit (“dollar”).
currencystringThe currency’s code, from ISO 4217.
sizenumberThe amount of storage provided by subscription to the user’s quota (in bytes).
durationnumberThe number of period_type time periods included in the pre-paid period.
period_typestringThere are four variants: hour, day, month, year.
is_defaultbooleanWhether it is the default package or not. The default package can only exist once. If it exists, it is automatically purchased by the system for the user when they get a 0 quota.
is_enabledbooleanWhether the package is enabled or disabled. The system does not allow users to subscribe to a disabled package.
tenant_namestringAssigning the package to a specific Customer based on their tenant name.
descriptionstringAn internal brief summary (not visible to end users).

Subscription Rules

Cloudike’s end users initially have a 0 GB disk quota. Users cannot use Cloudike cloud functions with a 0 GB quota. To upload any data to the cloud, a positive disk quota (>0 GB) is required.

Subscription Mechanism

  • Packages are required for incremental increases in the user's disk quota.
  • Packages can be purchased by users either in Cloudike apps or via MO requests from the Customer’s System.
  • A successful package purchase results in an active subscription.
  • A user can have either no active subscription or only one active subscription at a time.
    • Users cannot have two or more active subscriptions simultaneously.

Upgrade & Downgrade Subscription Rules

If a user has an active subscription and orders another subscription:

  1. If the new subscription has a larger size, Cloudike will activate it, canceling the old subscription immediately.
  2. If the new subscription has a smaller or equal size, the system will block the change.

Subscription Cancellation

A User or Customer's System can initiate the cancellation of an active subscription.

  • Cancellation means:
    • Auto-prolongation stops.
    • The subscription remains active until the end of the current pre-paid period.
    • Once the pre-paid period expires, the subscription is automatically closed.

Default Package Requirement

  • The Customer must provide exactly one package marked as the default package.
  • Default package behavior:
    • Automatically purchased for new user accounts.
    • Automatically re-purchased when a user loses their active subscription and their quota drops to 0 GB.
    • Can be free (cost = 0) or paid, depending on Customer preference.

Subscription Approval

  • Subscription to any package requires approval from the Customer’s System.
  • Unsubscribing does not require approval, but Cloudike notifies the Customer’s system about any such event.

Subscription Renewal

  • Cloudike automatically renews active subscriptions based on the pre-paid period interval.
  • Cloudike attempts to approve the renewal in the Customer’s System up to six times with 8-hour intervals.
  • If renewal fails, the subscription is automatically canceled.

Grace Period & Account Deletion

  • If a user’s quota becomes empty for any reason (e.g., insufficient funds to purchase a new package), a 7-day grace period begins.
  • During the grace period, Cloudike sends daily SMS notifications about upcoming data and account removal.
  • If the user still has no package after 7 days, Cloudike deletes the user account and all associated data.

Customer's System API

User’s Subscription Approval

Cloudike will call the Customer API to approve actions related to user subscriptions, such as:

  • Creation of a new subscription
  • Renewal (prolongation) of an already active subscription

GET http://customer.com/purchase_package_approve

HTTP Headers

  • Authorization: Bearer JWT
  • Content-Type: application/json

Input Parameters

ParameterTypeDescription
msisdnnumberUser's phone number (MSISDN).
package_idstringUnique package ID in Cloudike system.
customer_package_idstringUnique package ID on Customer’s side.
actionstring"create" (new subscription) or "renew" (subscription prolongation).
costnumberSubscription cost in minor currency units (e.g., cents).
cost_scalenumberScale factor (default: 100, e.g., cents per dollar).
currencystringCurrency code (ISO 4217 format).
trx_idstringUnique transaction ID (max length: 100 bytes, UUID v4 recommended).

Response Codes

HTTP CodeDescription
200 OKRequest was successfully accepted and will be processed.
201 CreatedRequest was successfully accepted and will be processed.
400 Bad RequestIncorrect format of request. No retries required.
422 Unprocessable EntityInvalid msisdn, package_id, or other parameters. No retries required.
429 Too Many RequestsToo many requests sent. The sender can retry later.
5xx Server ErrorsWeb service is temporarily broken. The sender can retry later.

Cloudike’s Side API

MO Request to Purchase a Package for the User

This is an MO (Mobile Originated) message with a user’s request sent from the Customer’s side to the Cloudike system (as the content provider). The request invokes Cloudike to approve package purchase (by calling the purchase_package_approve() API from the previous section) and create a new subscription for the user.

This method can also be used to create a new user. If no user with such an MSISDN exists in Cloudike, the user will be created upon successful approval of the request.

POST https://payg.cloudike.com/api/2/purchase_package_request

HTTP Headers

  • Authorization: Bearer JWT
  • Content-Type: application/json

Request Parameters

ParameterTypeDescription
msisdnnumberUser's phone number (MSISDN).
package_idstringUnique package ID in Cloudike system.
actionstring"subscribe" (subscribe to package) or "unsubscribe" (unsubscribe from package).
trx_idstringUnique transaction ID (max length: 100 bytes, UUID v4 recommended).

Response Codes

HTTP CodeDescription
200 OKRequest was successfully accepted and will be processed.
201 CreatedRequest was successfully accepted and will be processed.
400 Bad RequestIncorrect format of request. No retries required.
401 UnauthorizedInvalid secret was sent. No retries required.
422 Unprocessable EntityInvalid msisdn, package_id, or other parameters. No retries required.
429 Too Many RequestsToo many requests sent. The sender can retry later.
5xx Server ErrorsWeb service is temporarily broken. The sender can retry later.

Port-out Notification for the User

The Customer’s System should inform Cloudike immediately if the user has performed a port-out action or contract cancellation.

POST https://payg.cloudike.com/api/2/user_portout

HTTP Headers

  • Authorization: Bearer JWT
  • Content-Type: application/json

Request Parameters

ParameterTypeDescription
msisdnnumberUser's phone number (MSISDN).
trx_idstringUnique transaction ID (max length: 100 bytes, UUID v4 recommended).

Response Codes

HTTP CodeDescription
200 OKRequest was successfully accepted and will be processed.
201 CreatedRequest was successfully accepted and will be processed.
400 Bad RequestIncorrect format of request. No retries required.
401 UnauthorizedInvalid tenant_name / secret pair sent. No retries required.
422 Unprocessable EntityInvalid msisdn or other parameters. No retries required.
429 Too Many RequestsToo many requests sent. The sender can retry later.
5xx Server ErrorsWeb service is temporarily broken. The sender can retry later.

MSISDN Change Notification

The Customer's System should inform Cloudike immediately when a user changes their MSISDN. The user's active subscription will be automatically transferred to the new MSISDN without requiring re-creation or additional actions.

POST https://payg.cloudike.com/api/2/user_change_msisdn

HTTP Headers

  • Authorization: Bearer JWT
  • Content-Type: application/json

Request Parameters

ParameterTypeDescription
msisdnnumberNew MSISDN value.
old_msisdnnumberPrevious (old) MSISDN value.
trx_idstringUnique transaction ID (max length: 100 bytes, UUUID v4 recommended).

Response Codes

HTTP CodeDescription
200 OKRequest was successfully accepted and will be processed.
201 CreatedRequest was successfully accepted and will be processed.
400 Bad RequestIncorrect format of request. No retries required.
401 UnauthorizedInvalid tenant_name / secret pair sent. No retries required.
422 Unprocessable EntityInvalid msisdn/ package_id or other parameters. No retries required.
429 Too Many RequestsToo many requests sent. The sender can retry later.
5xx Server ErrorsWeb service is temporarily broken. The sender can retry later.

Get JWT Token to Access a Private API

The Customer’s System should use a JWT token for authentication when making API requests to Cloudike services.
A JWT token is generated using the following API request:

POST https://payg.cloudike.com/api/3/applications/<app_id>/tokens/

HTTP Headers

  • Content-Type: application/json

Request Parameters

ParameterTypeDescription
access_keystringApplication's access key.
scope_namestringName of the scope (a list of functions the customer is allowed to call).

Response Body

FieldTypeDescription
tokenstringThe generated JWT token.
expiresstringDate-time of token expiration.

Response Codes

HTTP CodeDescription
201 CreatedRequest was successfully accepted, JWT token generated.
400 Bad RequestIncorrect format of request. No retries required.
422 Unprocessable EntityInvalid access_key or scope_name. No retries required.

User’s Actions Notifications Sent to Customer’s System

Cloudike will notify the Customer's System of various events occurring with the users. Only one callback will be used for this notification.

POST https://customer.com/user_event_notify

HTTP Headers

  • Authorization: Bearer JWT
  • Content-Type: application/json

Input Parameters

ParameterTypeDescription
createdstringThe date and time of the event in ISO-8601 format (e.g., "2025-02-25T08:37:20+00:00").
eventstringThe name of the occurred event (see table below).
msisdnnumberThe user's MSISDN (mobile number).
user_idnumberCloudike’s user ID.
parametersstructureThe JSON structure with variable additional parameters depending on the event.

Events

EventAdditional Parameters (JSON)Description
user_created{}The user account was created.
user_removed{}The user account with all its data was removed.
subscription_created{ "package_id": "9999", "customer_package_id": "CLOUD123" }The user was subscribed to a new subscription.
subscription_renewed{ "package_id": "9999", "customer_package_id": "CLOUD123" }The user's active subscription was successfully prolonged.
subscription_canceled{ "package_id": "9999", "customer_package_id": "CLOUD123" }The user's active subscription was canceled.
user_quota_exceed_80{}The user’s used storage has reached 80% of their available disk quota.
user_quota_exceed_90{}The user’s used storage has reached 90% of their available disk quota.
user_quota_exceed_95{}The user’s used storage has reached 95% of their available disk quota.
user_quota_exceed_100{}The user’s used storage has reached 100% of their available disk quota.
user_quota_zero{}The user's disk quota has reached zero, meaning their account is planned to be removed after 7 days.

Return Codes

HTTP CodeDescription
200 OKEvent was accepted by the Customer's System.
400 Bad RequestIncorrect format of request. The platform will not re-try the message.
401 UnauthorizedInvalid secret sent. Request was not accepted, no re-tries required.
422 Unprocessable EntityInvalid msisdn number or other parameters. The platform will not re-try the message.
429 Too Many RequestsToo many requests sent. The platform will re-try the message.
5xx Server ErrorsWeb service is temporarily broken. The platform will re-try the message.

The response body can be empty, since we won't read or analyze it.

Appendix: the sequence diagrams

User orders a new subscription in client application

MO request to Cloudike to subscribe a user to the package