RevenueCat

Documentation

RevenueCat helps you build payments and subscriptions in your mobile apps - from simple in-app-purchases to complex multi-channel subscriptions. Follow our development quickstart to start building your integration.

Get Started
Suggest Edits

RevenueCat REST API

 

Authentication

Authentication for the RevenueCat REST API is achieved by setting the Authorization header.

Authorization: Bearer YOUR_REVENUECAT_API_KEY

Payload

The body of the POST requests should be encoded in JSON and have the 'Content-Type' header set to 'application/json'.

{
  "app_user_id": "user-1456",
  "fetch_token": "MQABC...EFH1234="
}
Suggest Edits

subscribers

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.revenuecat.com/v1/subscribers/app_user_id
curl --request GET \
  --url https://api.revenuecat.com/v1/subscribers/app_user_id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.revenuecat.com/v1/subscribers/app_user_id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.revenuecat.com/v1/subscribers/app_user_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.revenuecat.com/v1/subscribers/app_user_id");

xhr.send(data);
import requests

url = "https://api.revenuecat.com/v1/subscribers/app_user_id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "subscriber": {
    "original_application_version": null,
    "other_purchases": {
      "one_off_consumable": {
        "purchase_date": "2017-07-06T01:28:21Z"
      }
    },
    "subscriptions": {
      "onemonth_freetrial": {
        "expires_date": "2017-08-30T02:40:36Z",
        "period_type": "trial"
      }
    },
    "entitlements": {
      "pro": {
        "expires_date": "2017-08-30T02:40:36Z",
        "purchase_date": "2017-01-30T02:40:36Z",
        "product_identifier": "onemonth_freetrial"
      }
    }
  }
}
{'message': "Bad parameters"}
{'message': "Invalid API key"}

Path Params

app_user_id
string
required

The app user id used with the mobile SDK.

 

Use this endpoint to pull the latest subscription status for a user.

Possible values for period_type:

  • trial: Free trial
  • intro: Introductory pricing
  • normal: Standard subscription
 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.revenuecat.com/v1/receipts
curl --request POST \
  --url https://api.revenuecat.com/v1/receipts
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.revenuecat.com/v1/receipts' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.revenuecat.com/v1/receipts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.revenuecat.com/v1/receipts");

xhr.send(data);
import requests

url = "https://api.revenuecat.com/v1/receipts"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "subscriber": {
    "original_application_version": null,
    "other_purchases": {
      "one_off_consumable": {
        "purchase_date": "2017-07-06T01:28:21Z"
      }
    },
    "subscriptions": {
      "onemonth_freetrial": {
        "expires_date": "2017-08-30T02:40:36Z",
        "period_type": "trial"
      }
    },
    "entitlements": {
      "pro": {
        "expires_date": "2017-08-30T02:40:36Z",
        "purchase_date": "2017-01-30T02:40:36Z",
        "product_identifier": "onemonth_freetrial"
      }
    }
  }
}
{'message': "Invalid API key"}

Body Params

app_user_id
string
required

User id of the user the receipt is associated with.

fetch_token
string
required

For iOS, the base64 encoded receipt file, for Android the receipt token.

price
float

Price paid, only if associated with a purchase. Not required for Android.

currency
string

Currency code paid

payment_mode
string

Optionally used by the iOS SDK to communicate intro pricing periods.

introductory_price
float

Introductory price paid

product_id
string

The Apple product identifier or SKU

Headers

X-Platform
string

android or ios

 

Possible values for payment_mode:

pay_as_you_go = 0
pay_up_front = 1
free_trial = 2
Suggest Edits

/subscribers/attribution

Attaches attribution data to a subscriber from specific supported networks.

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.revenuecat.com/v1/subscribers/app_user_id/attribution
curl --request POST \
  --url https://api.revenuecat.com/v1/subscribers/your%20user%20id/attribution
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.revenuecat.com/v1/subscribers/your%20user%20id/attribution' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.revenuecat.com/v1/subscribers/your%20user%20id/attribution")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.revenuecat.com/v1/subscribers/your%20user%20id/attribution");

xhr.send(data);
import requests

url = "https://api.revenuecat.com/v1/subscribers/your%20user%20id/attribution"

response = requests.request("POST", url)

print(response.text)
A binary file was returned

You couldn't be authenticated

{
  "subscriber": {
    "original_application_version": null,
    "other_purchases": {
      "one_off_consumable": {
        "purchase_date": "2017-07-06T01:28:21Z"
      }
    },
    "subscriptions": {
      "onemonth_freetrial": {
        "expires_date": "2017-08-30T02:40:36Z",
        "period_type": "trial"
      }
    },
    "entitlements": {
      "pro": {
        "expires_date": "2017-08-30T02:40:36Z",
        "purchase_date": "2017-01-30T02:40:36Z",
        "product_identifier": "onemonth_freetrial"
      }
    }
  }
}
{'message': "Bad parameters"}
{'message': "Invalid API key"}

Path Params

app_user_id
string
required

The app user id, or alias, of the subscriber.

Body Params

data
object
required

The data returned by the attribution network callbacks.

 
data.rc_idfa
string

The idfa from AdSupport on iOS. (iOS Only)

data.rc_gps_adid
string

The Google Play Services Advertising identifier. (Android Only)

network
int32
required

The attribution network the data is coming from. See table for possible values.

 

Attribution Source Network Codes

Attribution Source
Code

Apple Search Ads

0

Adjust

1

AppsFlyer

2

Branch

3